diff --git a/DialogflowCx/.OwlBot.yaml b/DialogflowCx/.OwlBot.yaml new file mode 100644 index 000000000000..6863ea7e8f12 --- /dev/null +++ b/DialogflowCx/.OwlBot.yaml @@ -0,0 +1,4 @@ +deep-copy-regex: + - source: /google/cloud/dialogflow/cx/(v3)/.*-php/(.*) + dest: /owl-bot-staging/DialogflowCx/$1/$2 +api-name: DialogflowCx diff --git a/DialogflowCx/.gitattributes b/DialogflowCx/.gitattributes new file mode 100644 index 000000000000..8119e7fcc1b2 --- /dev/null +++ b/DialogflowCx/.gitattributes @@ -0,0 +1,8 @@ +/*.xml.dist export-ignore +/.OwlBot.yaml export-ignore +/.github export-ignore +/.repo-metadata.json export-ignore +/owlbot.py export-ignore +/src/**/gapic_metadata.json export-ignore +/samples export-ignore +/tests export-ignore diff --git a/DialogflowCx/.github/pull_request_template.md b/DialogflowCx/.github/pull_request_template.md new file mode 100644 index 000000000000..d93d2c3013f9 --- /dev/null +++ b/DialogflowCx/.github/pull_request_template.md @@ -0,0 +1,24 @@ +**PLEASE READ THIS ENTIRE MESSAGE** + +Hello, and thank you for your contribution! Please note that this repository is +a read-only split of `googleapis/google-cloud-php`. As such, we are +unable to accept pull requests to this repository. + +We welcome your pull request and would be happy to consider it for inclusion in +our library if you follow these steps: + +* Clone the parent client library repository: + +```sh +$ git clone git@github.com:googleapis/google-cloud-php.git +``` + +* Move your changes into the correct location in that library. Library code +belongs in `DialogflowCx/src`, and tests in `DialogflowCx/tests`. + +* Push the changes in a new branch to a fork, and open a new pull request +[here](https://github.com/googleapis/google-cloud-php). + +Thanks again, and we look forward to seeing your proposed change! + +The Google Cloud PHP team diff --git a/DialogflowCx/.repo-metadata.json b/DialogflowCx/.repo-metadata.json new file mode 100644 index 000000000000..45b32b0b95d3 --- /dev/null +++ b/DialogflowCx/.repo-metadata.json @@ -0,0 +1,8 @@ +{ + "language": "php", + "distribution_name": "google/cloud-dialogflow-cx", + "release_level": "preview", + "client_documentation": "https://cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest", + "library_type": "GAPIC_AUTO", + "api_shortname": "dialogflow" +} diff --git a/DialogflowCx/CONTRIBUTING.md b/DialogflowCx/CONTRIBUTING.md new file mode 100644 index 000000000000..76ea811cacdb --- /dev/null +++ b/DialogflowCx/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. We accept +and review pull requests against the main +[Google Cloud PHP](https://github.com/googleapis/google-cloud-php) +repository, which contains all of our client libraries. You will also need to +sign a Contributor License Agreement. For more details about how to contribute, +see the +[CONTRIBUTING.md](https://github.com/googleapis/google-cloud-php/blob/main/CONTRIBUTING.md) +file in the main Google Cloud PHP repository. diff --git a/DialogflowCx/LICENSE b/DialogflowCx/LICENSE new file mode 100644 index 000000000000..8f71f43fee3f --- /dev/null +++ b/DialogflowCx/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.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/DialogflowCx/README.md b/DialogflowCx/README.md new file mode 100644 index 000000000000..a4d07a59723d --- /dev/null +++ b/DialogflowCx/README.md @@ -0,0 +1,45 @@ +# Google Cloud Dialogflow Cx for PHP + +> Idiomatic PHP client for [Google Cloud Dialogflow Cx](https://cloud.google.com/dialogflow). + +[![Latest Stable Version](https://poser.pugx.org/google/cloud-dialogflow-cx/v/stable)](https://packagist.org/packages/google/cloud-dialogflow-cx) [![Packagist](https://img.shields.io/packagist/dm/google/cloud-dialogflow-cx.svg)](https://packagist.org/packages/google/cloud-dialogflow-cx) + +* [API documentation](https://cloud.google.com/php/docs/reference/cloud-dialogflow-cx/latest) + +**NOTE:** This repository is part of [Google Cloud PHP](https://github.com/googleapis/google-cloud-php). Any +support requests, bug reports, or development contributions should be directed to +that project. + +### Installation + +To begin, install the preferred dependency manager for PHP, [Composer](https://getcomposer.org/). + +Now, install this component: + +```sh +$ composer require google/cloud-dialogflow-cx +``` + +> Browse the complete list of [Google Cloud APIs](https://cloud.google.com/php/docs/reference) +> for PHP + +This component supports both REST over HTTP/1.1 and gRPC. In order to take advantage of the benefits +offered by gRPC (such as streaming methods) please see our +[gRPC installation guide](https://cloud.google.com/php/grpc). + +### Authentication + +Please see our [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information +on authenticating your client. Once authenticated, you'll be ready to start making requests. + +### Sample + +See the [samples directory](https://github.com/googleapis/google-cloud-php-dialogflow-cx/tree/main/samples) for a canonical list of samples. + +### Version + +This component is considered alpha. As such, it is still a work-in-progress and is more likely to get backwards-incompatible updates. + +### Next Steps + +1. Understand the [official documentation](https://cloud.google.com/dialogflow/cx/docs/reference). diff --git a/DialogflowCx/VERSION b/DialogflowCx/VERSION new file mode 100644 index 000000000000..77d6f4ca2371 --- /dev/null +++ b/DialogflowCx/VERSION @@ -0,0 +1 @@ +0.0.0 diff --git a/DialogflowCx/composer.json b/DialogflowCx/composer.json new file mode 100644 index 000000000000..b3da400a0b9e --- /dev/null +++ b/DialogflowCx/composer.json @@ -0,0 +1,30 @@ +{ + "name": "google/cloud-dialogflow-cx", + "description": "Google Cloud Dialogflow Cx Client for PHP", + "license": "Apache-2.0", + "minimum-stability": "stable", + "autoload": { + "psr-4": { + "Google\\Cloud\\Dialogflow\\Cx\\": "src", + "GPBMetadata\\Google\\Cloud\\Dialogflow\\Cx\\": "metadata" + } + }, + "extra": { + "component": { + "id": "cloud-dialogflow-cx", + "path": "DialogflowCx", + "target": "googleapis/google-cloud-php-dialogflow-cx" + } + }, + "require": { + "php": ">=7.4", + "google/gax": "^1.25.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.0" + }, + "suggest": { + "ext-grpc": "Enables use of gRPC, a universal high-performance RPC framework created by Google.", + "ext-protobuf": "Provides a significant increase in throughput over the pure PHP protobuf implementation. See https://cloud.google.com/php/grpc for installation instructions." + } +} diff --git a/DialogflowCx/metadata/V3/AdvancedSettings.php b/DialogflowCx/metadata/V3/AdvancedSettings.php new file mode 100644 index 000000000000..c48431c45e09 --- /dev/null +++ b/DialogflowCx/metadata/V3/AdvancedSettings.php @@ -0,0 +1,41 @@ +internalAddGeneratedFile( + ' + +5google/cloud/dialogflow/cx/v3/advanced_settings.protogoogle.cloud.dialogflow.cx.v3\'google/cloud/dialogflow/cx/v3/gcs.proto" +AdvancedSettingsS +audio_export_gcs_destination ( 2-.google.cloud.dialogflow.cx.v3.GcsDestinationS + dtmf_settings ( 2<.google.cloud.dialogflow.cx.v3.AdvancedSettings.DtmfSettingsY +logging_settings ( 2?.google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettingsI + DtmfSettings +enabled ( + +max_digits ( + finish_digit ( Y +LoggingSettings" +enable_stackdriver_logging (" +enable_interaction_logging (B +!com.google.cloud.dialogflow.cx.v3BAdvancedSettingsProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpbDFGoogle.Cloud.Dialogflow.Cx.V3!Google::Cloud::Dialogflow::CX::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/Agent.php b/DialogflowCx/metadata/V3/Agent.php new file mode 100644 index 000000000000..713547082285 Binary files /dev/null and b/DialogflowCx/metadata/V3/Agent.php differ diff --git a/DialogflowCx/metadata/V3/AudioConfig.php b/DialogflowCx/metadata/V3/AudioConfig.php new file mode 100644 index 000000000000..90ebbbe774a6 Binary files /dev/null and b/DialogflowCx/metadata/V3/AudioConfig.php differ diff --git a/DialogflowCx/metadata/V3/Changelog.php b/DialogflowCx/metadata/V3/Changelog.php new file mode 100644 index 000000000000..b4e5c5eb2958 --- /dev/null +++ b/DialogflowCx/metadata/V3/Changelog.php @@ -0,0 +1,59 @@ +internalAddGeneratedFile( + ' + +-google/cloud/dialogflow/cx/v3/changelog.protogoogle.cloud.dialogflow.cx.v3google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/protobuf/timestamp.proto" +ListChangelogsRequest; +parent ( B+AA%#dialogflow.googleapis.com/Changelog +filter (  + page_size ( + +page_token ( "o +ListChangelogsResponse< + +changelogs ( 2(.google.cloud.dialogflow.cx.v3.Changelog +next_page_token ( "P +GetChangelogRequest9 +name ( B+AA% +#dialogflow.googleapis.com/Changelog" + Changelog +name (  + +user_email (  + display_name (  +action (  +type (  +resource ( / + create_time ( 2.google.protobuf.Timestamp:wAt +#dialogflow.googleapis.com/ChangelogMprojects/{project}/locations/{location}/agents/{agent}/changelogs/{changelog}2 + +Changelogs +ListChangelogs4.google.cloud.dialogflow.cx.v3.ListChangelogsRequest5.google.cloud.dialogflow.cx.v3.ListChangelogsResponse"H97/v3/{parent=projects/*/locations/*/agents/*}/changelogsAparent + GetChangelog2.google.cloud.dialogflow.cx.v3.GetChangelogRequest(.google.cloud.dialogflow.cx.v3.Changelog"F97/v3/{name=projects/*/locations/*/agents/*/changelogs/*}AnamexAdialogflow.googleapis.comAYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB +!com.google.cloud.dialogflow.cx.v3BChangelogProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpbDFGoogle.Cloud.Dialogflow.Cx.V3!Google::Cloud::Dialogflow::CX::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/DataStoreConnection.php b/DialogflowCx/metadata/V3/DataStoreConnection.php new file mode 100644 index 000000000000..aaea48045058 Binary files /dev/null and b/DialogflowCx/metadata/V3/DataStoreConnection.php differ diff --git a/DialogflowCx/metadata/V3/Deployment.php b/DialogflowCx/metadata/V3/Deployment.php new file mode 100644 index 000000000000..f759d26198bb Binary files /dev/null and b/DialogflowCx/metadata/V3/Deployment.php differ diff --git a/DialogflowCx/metadata/V3/EntityType.php b/DialogflowCx/metadata/V3/EntityType.php new file mode 100644 index 000000000000..bcc239cd9871 Binary files /dev/null and b/DialogflowCx/metadata/V3/EntityType.php differ diff --git a/DialogflowCx/metadata/V3/Environment.php b/DialogflowCx/metadata/V3/Environment.php new file mode 100644 index 000000000000..3262f8bbc900 Binary files /dev/null and b/DialogflowCx/metadata/V3/Environment.php differ diff --git a/DialogflowCx/metadata/V3/Experiment.php b/DialogflowCx/metadata/V3/Experiment.php new file mode 100644 index 000000000000..464a8986cd36 Binary files /dev/null and b/DialogflowCx/metadata/V3/Experiment.php differ diff --git a/DialogflowCx/metadata/V3/Flow.php b/DialogflowCx/metadata/V3/Flow.php new file mode 100644 index 000000000000..e9e42e1efdf0 Binary files /dev/null and b/DialogflowCx/metadata/V3/Flow.php differ diff --git a/DialogflowCx/metadata/V3/Fulfillment.php b/DialogflowCx/metadata/V3/Fulfillment.php new file mode 100644 index 000000000000..7c9288abf525 Binary files /dev/null and b/DialogflowCx/metadata/V3/Fulfillment.php differ diff --git a/DialogflowCx/metadata/V3/Gcs.php b/DialogflowCx/metadata/V3/Gcs.php new file mode 100644 index 000000000000..de37361c1e26 --- /dev/null +++ b/DialogflowCx/metadata/V3/Gcs.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' + +\'google/cloud/dialogflow/cx/v3/gcs.protogoogle.cloud.dialogflow.cx.v3"" +GcsDestination +uri ( BAB +!com.google.cloud.dialogflow.cx.v3BGcsProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpbDFGoogle.Cloud.Dialogflow.Cx.V3!Google::Cloud::Dialogflow::CX::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/GenerativeSettings.php b/DialogflowCx/metadata/V3/GenerativeSettings.php new file mode 100644 index 000000000000..192500f29b27 --- /dev/null +++ b/DialogflowCx/metadata/V3/GenerativeSettings.php @@ -0,0 +1,49 @@ +internalAddGeneratedFile( + ' + +7google/cloud/dialogflow/cx/v3/generative_settings.protogoogle.cloud.dialogflow.cx.v33google/cloud/dialogflow/cx/v3/safety_settings.proto" +GenerativeSettings +name ( ] +fallback_settings ( 2B.google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettingsQ +generative_safety_settings ( 2-.google.cloud.dialogflow.cx.v3.SafetySettingsr +knowledge_connector_settings ( 2L.google.cloud.dialogflow.cx.v3.GenerativeSettings.KnowledgeConnectorSettings + language_code (  +FallbackSettings +selected_prompt ( k +prompt_templates ( 2Q.google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings.PromptTemplateK +PromptTemplate + display_name (  + prompt_text (  +frozen ( +KnowledgeConnectorSettings +business (  +agent (  +agent_identity (  +business_description (  + agent_scope ( :A~ +1dialogflow.googleapis.com/AgentGenerativeSettingsIprojects/{project}/locations/{location}/agents/{agent}/generativeSettingsB +!com.google.cloud.dialogflow.cx.v3BGenerativeSettingsProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpbDFGoogle.Cloud.Dialogflow.Cx.V3!Google::Cloud::Dialogflow::CX::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/ImportStrategy.php b/DialogflowCx/metadata/V3/ImportStrategy.php new file mode 100644 index 000000000000..7397ef020c28 Binary files /dev/null and b/DialogflowCx/metadata/V3/ImportStrategy.php differ diff --git a/DialogflowCx/metadata/V3/Inline.php b/DialogflowCx/metadata/V3/Inline.php new file mode 100644 index 000000000000..bd34d01f3328 --- /dev/null +++ b/DialogflowCx/metadata/V3/Inline.php @@ -0,0 +1,32 @@ +internalAddGeneratedFile( + ' + +*google/cloud/dialogflow/cx/v3/inline.protogoogle.cloud.dialogflow.cx.v3") +InlineDestination +content ( BA" + InlineSource +content ( B +!com.google.cloud.dialogflow.cx.v3B InlineProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpbDFGoogle.Cloud.Dialogflow.Cx.V3!Google::Cloud::Dialogflow::CX::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/Intent.php b/DialogflowCx/metadata/V3/Intent.php new file mode 100644 index 000000000000..fb29edffd7a4 Binary files /dev/null and b/DialogflowCx/metadata/V3/Intent.php differ diff --git a/DialogflowCx/metadata/V3/Page.php b/DialogflowCx/metadata/V3/Page.php new file mode 100644 index 000000000000..028359f8f9af Binary files /dev/null and b/DialogflowCx/metadata/V3/Page.php differ diff --git a/DialogflowCx/metadata/V3/ResponseMessage.php b/DialogflowCx/metadata/V3/ResponseMessage.php new file mode 100644 index 000000000000..082c2698bdbe Binary files /dev/null and b/DialogflowCx/metadata/V3/ResponseMessage.php differ diff --git a/DialogflowCx/metadata/V3/SafetySettings.php b/DialogflowCx/metadata/V3/SafetySettings.php new file mode 100644 index 000000000000..7942d6ed9aac --- /dev/null +++ b/DialogflowCx/metadata/V3/SafetySettings.php @@ -0,0 +1,33 @@ +internalAddGeneratedFile( + ' + +3google/cloud/dialogflow/cx/v3/safety_settings.protogoogle.cloud.dialogflow.cx.v3" +SafetySettingsL +banned_phrases ( 24.google.cloud.dialogflow.cx.v3.SafetySettings.Phrase7 +Phrase +text ( BA + language_code ( BAB +!com.google.cloud.dialogflow.cx.v3BSafetySettingsProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpbDFGoogle.Cloud.Dialogflow.Cx.V3!Google::Cloud::Dialogflow::CX::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/SecuritySettings.php b/DialogflowCx/metadata/V3/SecuritySettings.php new file mode 100644 index 000000000000..d0ce6b8cb3db Binary files /dev/null and b/DialogflowCx/metadata/V3/SecuritySettings.php differ diff --git a/DialogflowCx/metadata/V3/Session.php b/DialogflowCx/metadata/V3/Session.php new file mode 100644 index 000000000000..2e769f1faefd Binary files /dev/null and b/DialogflowCx/metadata/V3/Session.php differ diff --git a/DialogflowCx/metadata/V3/SessionEntityType.php b/DialogflowCx/metadata/V3/SessionEntityType.php new file mode 100644 index 000000000000..86556bcc348e Binary files /dev/null and b/DialogflowCx/metadata/V3/SessionEntityType.php differ diff --git a/DialogflowCx/metadata/V3/TestCase.php b/DialogflowCx/metadata/V3/TestCase.php new file mode 100644 index 000000000000..fb05d5dffda7 Binary files /dev/null and b/DialogflowCx/metadata/V3/TestCase.php differ diff --git a/DialogflowCx/metadata/V3/TransitionRouteGroup.php b/DialogflowCx/metadata/V3/TransitionRouteGroup.php new file mode 100644 index 000000000000..9cf57729a7d1 --- /dev/null +++ b/DialogflowCx/metadata/V3/TransitionRouteGroup.php @@ -0,0 +1,70 @@ +internalAddGeneratedFile( + ' + +:google/cloud/dialogflow/cx/v3/transition_route_group.protogoogle.cloud.dialogflow.cx.v3google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto(google/cloud/dialogflow/cx/v3/page.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto" +TransitionRouteGroup +name (  + display_name ( BAI +transition_routes ( 2..google.cloud.dialogflow.cx.v3.TransitionRoute:A +.dialogflow.googleapis.com/TransitionRouteGrouprprojects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}eprojects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}*transitionRouteGroups2transitionRouteGroup" + ListTransitionRouteGroupsRequestF +parent ( B6AA0.dialogflow.googleapis.com/TransitionRouteGroup + page_size ( + +page_token (  + language_code ( " +!ListTransitionRouteGroupsResponseT +transition_route_groups ( 23.google.cloud.dialogflow.cx.v3.TransitionRouteGroup +next_page_token ( "} +GetTransitionRouteGroupRequestD +name ( B6AA0 +.dialogflow.googleapis.com/TransitionRouteGroup + language_code ( " +!CreateTransitionRouteGroupRequestF +parent ( B6AA0.dialogflow.googleapis.com/TransitionRouteGroupX +transition_route_group ( 23.google.cloud.dialogflow.cx.v3.TransitionRouteGroupBA + language_code ( " +!UpdateTransitionRouteGroupRequestX +transition_route_group ( 23.google.cloud.dialogflow.cx.v3.TransitionRouteGroupBA/ + update_mask ( 2.google.protobuf.FieldMask + language_code ( "x +!DeleteTransitionRouteGroupRequestD +name ( B6AA0 +.dialogflow.googleapis.com/TransitionRouteGroup +force (2 +TransitionRouteGroups +ListTransitionRouteGroups?.google.cloud.dialogflow.cx.v3.ListTransitionRouteGroupsRequest@.google.cloud.dialogflow.cx.v3.ListTransitionRouteGroupsResponse"J/v3/{parent=projects/*/locations/*/agents/*/flows/*}/transitionRouteGroupsZDB/v3/{parent=projects/*/locations/*/agents/*}/transitionRouteGroupsAparent +GetTransitionRouteGroup=.google.cloud.dialogflow.cx.v3.GetTransitionRouteGroupRequest3.google.cloud.dialogflow.cx.v3.TransitionRouteGroup"J/v3/{name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}ZDB/v3/{name=projects/*/locations/*/agents/*/transitionRouteGroups/*}Aname +CreateTransitionRouteGroup@.google.cloud.dialogflow.cx.v3.CreateTransitionRouteGroupRequest3.google.cloud.dialogflow.cx.v3.TransitionRouteGroup""J/v3/{parent=projects/*/locations/*/agents/*/flows/*}/transitionRouteGroups:transition_route_groupZ\\"B/v3/{parent=projects/*/locations/*/agents/*}/transitionRouteGroups:transition_route_groupAparent,transition_route_group +UpdateTransitionRouteGroup@.google.cloud.dialogflow.cx.v3.UpdateTransitionRouteGroupRequest3.google.cloud.dialogflow.cx.v3.TransitionRouteGroup"2a/v3/{transition_route_group.name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}:transition_route_groupZs2Y/v3/{transition_route_group.name=projects/*/locations/*/agents/*/transitionRouteGroups/*}:transition_route_groupA"transition_route_group,update_mask +DeleteTransitionRouteGroup@.google.cloud.dialogflow.cx.v3.DeleteTransitionRouteGroupRequest.google.protobuf.Empty"*J/v3/{name=projects/*/locations/*/agents/*/flows/*/transitionRouteGroups/*}ZD*B/v3/{name=projects/*/locations/*/agents/*/transitionRouteGroups/*}AnamexAdialogflow.googleapis.comAYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB +!com.google.cloud.dialogflow.cx.v3BTransitionRouteGroupProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpbDFGoogle.Cloud.Dialogflow.Cx.V3!Google::Cloud::Dialogflow::CX::V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/ValidationMessage.php b/DialogflowCx/metadata/V3/ValidationMessage.php new file mode 100644 index 000000000000..0729931438f1 Binary files /dev/null and b/DialogflowCx/metadata/V3/ValidationMessage.php differ diff --git a/DialogflowCx/metadata/V3/Version.php b/DialogflowCx/metadata/V3/Version.php new file mode 100644 index 000000000000..9a11195d2a92 Binary files /dev/null and b/DialogflowCx/metadata/V3/Version.php differ diff --git a/DialogflowCx/metadata/V3/Webhook.php b/DialogflowCx/metadata/V3/Webhook.php new file mode 100644 index 000000000000..0de7767e0b03 Binary files /dev/null and b/DialogflowCx/metadata/V3/Webhook.php differ diff --git a/DialogflowCx/owlbot.py b/DialogflowCx/owlbot.py new file mode 100644 index 000000000000..bac80b1da66b --- /dev/null +++ b/DialogflowCx/owlbot.py @@ -0,0 +1,62 @@ +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.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. + +"""This script is used to synthesize generated parts of this library.""" + +import logging +from pathlib import Path +import subprocess + +import synthtool as s +from synthtool.languages import php +from synthtool import _tracked_paths + +logging.basicConfig(level=logging.DEBUG) + +src = Path(f"../{php.STAGING_DIR}/DialogflowCx").resolve() +dest = Path().resolve() + +# Added so that we can pass copy_excludes in the owlbot_main() call +_tracked_paths.add(src) + +php.owlbot_main( + src=src, + dest=dest, + copy_excludes=[ + src / "**/[A-Z]*_*.php", + ] +) + +# remove class_alias code +s.replace( + "src/V*/**/*.php", + r"^// Adding a class alias for backwards compatibility with the previous class name.$" + + "\n" + + r"^class_alias\(.*\);$" + + "\n", + '') + +# format generated clients +subprocess.run([ + 'npm', + 'exec', + '--yes', + '--package=@prettier/plugin-php@^0.16', + '--', + 'prettier', + '**/BaseClient/*', + '--write', + '--parser=php', + '--single-quote', + '--print-width=80']) diff --git a/DialogflowCx/phpunit.xml.dist b/DialogflowCx/phpunit.xml.dist new file mode 100644 index 000000000000..6994596fa507 --- /dev/null +++ b/DialogflowCx/phpunit.xml.dist @@ -0,0 +1,16 @@ + + + + + tests/Unit + + + + + src + + src/V[!a-zA-Z]* + + + + diff --git a/DialogflowCx/samples/V3/AgentsClient/create_agent.php b/DialogflowCx/samples/V3/AgentsClient/create_agent.php new file mode 100644 index 000000000000..ba6981578c17 --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/create_agent.php @@ -0,0 +1,95 @@ +/locations/`. Please see + * {@see AgentsClient::locationName()} for help formatting this field. + * @param string $agentDisplayName The human-readable name of the agent, unique within the location. + * @param string $agentDefaultLanguageCode Immutable. The default language of the agent as a language tag. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * This field cannot be set by the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * @param string $agentTimeZone The time zone of the agent from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. + */ +function create_agent_sample( + string $formattedParent, + string $agentDisplayName, + string $agentDefaultLanguageCode, + string $agentTimeZone +): void { + // Create a client. + $agentsClient = new AgentsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $agent = (new Agent()) + ->setDisplayName($agentDisplayName) + ->setDefaultLanguageCode($agentDefaultLanguageCode) + ->setTimeZone($agentTimeZone); + + // Call the API and handle any network failures. + try { + /** @var Agent $response */ + $response = $agentsClient->createAgent($formattedParent, $agent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AgentsClient::locationName('[PROJECT]', '[LOCATION]'); + $agentDisplayName = '[DISPLAY_NAME]'; + $agentDefaultLanguageCode = '[DEFAULT_LANGUAGE_CODE]'; + $agentTimeZone = '[TIME_ZONE]'; + + create_agent_sample($formattedParent, $agentDisplayName, $agentDefaultLanguageCode, $agentTimeZone); +} +// [END dialogflow_v3_generated_Agents_CreateAgent_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/delete_agent.php b/DialogflowCx/samples/V3/AgentsClient/delete_agent.php new file mode 100644 index 000000000000..9f77bc9c0723 --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/delete_agent.php @@ -0,0 +1,65 @@ +/locations//agents/`. Please see + * {@see AgentsClient::agentName()} for help formatting this field. + */ +function delete_agent_sample(string $formattedName): void +{ + // Create a client. + $agentsClient = new AgentsClient(); + + // Call the API and handle any network failures. + try { + $agentsClient->deleteAgent($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AgentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + delete_agent_sample($formattedName); +} +// [END dialogflow_v3_generated_Agents_DeleteAgent_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/export_agent.php b/DialogflowCx/samples/V3/AgentsClient/export_agent.php new file mode 100644 index 000000000000..d4ef9b3af079 --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/export_agent.php @@ -0,0 +1,88 @@ +/locations//agents/`. Please see + * {@see AgentsClient::agentName()} for help formatting this field. + */ +function export_agent_sample(string $formattedName): void +{ + // Create a client. + $agentsClient = new AgentsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $agentsClient->exportAgent($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExportAgentResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AgentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + export_agent_sample($formattedName); +} +// [END dialogflow_v3_generated_Agents_ExportAgent_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/get_agent.php b/DialogflowCx/samples/V3/AgentsClient/get_agent.php new file mode 100644 index 000000000000..c26c6d2c84bf --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/get_agent.php @@ -0,0 +1,67 @@ +/locations//agents/`. Please see + * {@see AgentsClient::agentName()} for help formatting this field. + */ +function get_agent_sample(string $formattedName): void +{ + // Create a client. + $agentsClient = new AgentsClient(); + + // Call the API and handle any network failures. + try { + /** @var Agent $response */ + $response = $agentsClient->getAgent($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AgentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + get_agent_sample($formattedName); +} +// [END dialogflow_v3_generated_Agents_GetAgent_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/get_agent_validation_result.php b/DialogflowCx/samples/V3/AgentsClient/get_agent_validation_result.php new file mode 100644 index 000000000000..879591653c2c --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/get_agent_validation_result.php @@ -0,0 +1,69 @@ +/locations//agents//validationResult`. Please see + * {@see AgentsClient::agentValidationResultName()} for help formatting this field. + */ +function get_agent_validation_result_sample(string $formattedName): void +{ + // Create a client. + $agentsClient = new AgentsClient(); + + // Call the API and handle any network failures. + try { + /** @var AgentValidationResult $response */ + $response = $agentsClient->getAgentValidationResult($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AgentsClient::agentValidationResultName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + get_agent_validation_result_sample($formattedName); +} +// [END dialogflow_v3_generated_Agents_GetAgentValidationResult_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/get_generative_settings.php b/DialogflowCx/samples/V3/AgentsClient/get_generative_settings.php new file mode 100644 index 000000000000..84b5e0045ce3 --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/get_generative_settings.php @@ -0,0 +1,69 @@ +/locations//agents//generativeSettings`. Please see + * {@see AgentsClient::agentGenerativeSettingsName()} for help formatting this field. + * @param string $languageCode Language code of the generative settings. + */ +function get_generative_settings_sample(string $formattedName, string $languageCode): void +{ + // Create a client. + $agentsClient = new AgentsClient(); + + // Call the API and handle any network failures. + try { + /** @var GenerativeSettings $response */ + $response = $agentsClient->getGenerativeSettings($formattedName, $languageCode); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AgentsClient::agentGenerativeSettingsName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $languageCode = '[LANGUAGE_CODE]'; + + get_generative_settings_sample($formattedName, $languageCode); +} +// [END dialogflow_v3_generated_Agents_GetGenerativeSettings_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/get_location.php b/DialogflowCx/samples/V3/AgentsClient/get_location.php new file mode 100644 index 000000000000..6d31f74143a6 --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Agents_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/list_agents.php b/DialogflowCx/samples/V3/AgentsClient/list_agents.php new file mode 100644 index 000000000000..988f161c5745 --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/list_agents.php @@ -0,0 +1,72 @@ +/locations/`. Please see + * {@see AgentsClient::locationName()} for help formatting this field. + */ +function list_agents_sample(string $formattedParent): void +{ + // Create a client. + $agentsClient = new AgentsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $agentsClient->listAgents($formattedParent); + + /** @var Agent $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = AgentsClient::locationName('[PROJECT]', '[LOCATION]'); + + list_agents_sample($formattedParent); +} +// [END dialogflow_v3_generated_Agents_ListAgents_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/list_locations.php b/DialogflowCx/samples/V3/AgentsClient/list_locations.php new file mode 100644 index 000000000000..680ad836190a --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Agents_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/restore_agent.php b/DialogflowCx/samples/V3/AgentsClient/restore_agent.php new file mode 100644 index 000000000000..3df24506f35a --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/restore_agent.php @@ -0,0 +1,92 @@ +/locations//agents/`. Please see + * {@see AgentsClient::agentName()} for help formatting this field. + */ +function restore_agent_sample(string $formattedName): void +{ + // Create a client. + $agentsClient = new AgentsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $agentsClient->restoreAgent($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AgentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + restore_agent_sample($formattedName); +} +// [END dialogflow_v3_generated_Agents_RestoreAgent_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/update_agent.php b/DialogflowCx/samples/V3/AgentsClient/update_agent.php new file mode 100644 index 000000000000..ef947fcb9570 --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/update_agent.php @@ -0,0 +1,90 @@ +setDisplayName($agentDisplayName) + ->setDefaultLanguageCode($agentDefaultLanguageCode) + ->setTimeZone($agentTimeZone); + + // Call the API and handle any network failures. + try { + /** @var Agent $response */ + $response = $agentsClient->updateAgent($agent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $agentDisplayName = '[DISPLAY_NAME]'; + $agentDefaultLanguageCode = '[DEFAULT_LANGUAGE_CODE]'; + $agentTimeZone = '[TIME_ZONE]'; + + update_agent_sample($agentDisplayName, $agentDefaultLanguageCode, $agentTimeZone); +} +// [END dialogflow_v3_generated_Agents_UpdateAgent_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/update_generative_settings.php b/DialogflowCx/samples/V3/AgentsClient/update_generative_settings.php new file mode 100644 index 000000000000..37872104b275 --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/update_generative_settings.php @@ -0,0 +1,56 @@ +updateGenerativeSettings($generativeSettings); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Agents_UpdateGenerativeSettings_sync] diff --git a/DialogflowCx/samples/V3/AgentsClient/validate_agent.php b/DialogflowCx/samples/V3/AgentsClient/validate_agent.php new file mode 100644 index 000000000000..7579edfa9a8a --- /dev/null +++ b/DialogflowCx/samples/V3/AgentsClient/validate_agent.php @@ -0,0 +1,69 @@ +/locations//agents/`. Please see + * {@see AgentsClient::agentName()} for help formatting this field. + */ +function validate_agent_sample(string $formattedName): void +{ + // Create a client. + $agentsClient = new AgentsClient(); + + // Call the API and handle any network failures. + try { + /** @var AgentValidationResult $response */ + $response = $agentsClient->validateAgent($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = AgentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + validate_agent_sample($formattedName); +} +// [END dialogflow_v3_generated_Agents_ValidateAgent_sync] diff --git a/DialogflowCx/samples/V3/ChangelogsClient/get_changelog.php b/DialogflowCx/samples/V3/ChangelogsClient/get_changelog.php new file mode 100644 index 000000000000..f21eab0ce86b --- /dev/null +++ b/DialogflowCx/samples/V3/ChangelogsClient/get_changelog.php @@ -0,0 +1,73 @@ +/locations//agents//changelogs/`. Please see + * {@see ChangelogsClient::changelogName()} for help formatting this field. + */ +function get_changelog_sample(string $formattedName): void +{ + // Create a client. + $changelogsClient = new ChangelogsClient(); + + // Call the API and handle any network failures. + try { + /** @var Changelog $response */ + $response = $changelogsClient->getChangelog($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ChangelogsClient::changelogName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[CHANGELOG]' + ); + + get_changelog_sample($formattedName); +} +// [END dialogflow_v3_generated_Changelogs_GetChangelog_sync] diff --git a/DialogflowCx/samples/V3/ChangelogsClient/get_location.php b/DialogflowCx/samples/V3/ChangelogsClient/get_location.php new file mode 100644 index 000000000000..978ba5dbfd10 --- /dev/null +++ b/DialogflowCx/samples/V3/ChangelogsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Changelogs_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/ChangelogsClient/list_changelogs.php b/DialogflowCx/samples/V3/ChangelogsClient/list_changelogs.php new file mode 100644 index 000000000000..caead0cb16a2 --- /dev/null +++ b/DialogflowCx/samples/V3/ChangelogsClient/list_changelogs.php @@ -0,0 +1,72 @@ +/locations//agents/`. Please see + * {@see ChangelogsClient::agentName()} for help formatting this field. + */ +function list_changelogs_sample(string $formattedParent): void +{ + // Create a client. + $changelogsClient = new ChangelogsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $changelogsClient->listChangelogs($formattedParent); + + /** @var Changelog $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ChangelogsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_changelogs_sample($formattedParent); +} +// [END dialogflow_v3_generated_Changelogs_ListChangelogs_sync] diff --git a/DialogflowCx/samples/V3/ChangelogsClient/list_locations.php b/DialogflowCx/samples/V3/ChangelogsClient/list_locations.php new file mode 100644 index 000000000000..3f818f58406e --- /dev/null +++ b/DialogflowCx/samples/V3/ChangelogsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Changelogs_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/DeploymentsClient/get_deployment.php b/DialogflowCx/samples/V3/DeploymentsClient/get_deployment.php new file mode 100644 index 000000000000..1a0f6f10dcaa --- /dev/null +++ b/DialogflowCx/samples/V3/DeploymentsClient/get_deployment.php @@ -0,0 +1,76 @@ +/locations//agents//environments//deployments/`. Please see + * {@see DeploymentsClient::deploymentName()} for help formatting this field. + */ +function get_deployment_sample(string $formattedName): void +{ + // Create a client. + $deploymentsClient = new DeploymentsClient(); + + // Call the API and handle any network failures. + try { + /** @var Deployment $response */ + $response = $deploymentsClient->getDeployment($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = DeploymentsClient::deploymentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]', + '[DEPLOYMENT]' + ); + + get_deployment_sample($formattedName); +} +// [END dialogflow_v3_generated_Deployments_GetDeployment_sync] diff --git a/DialogflowCx/samples/V3/DeploymentsClient/get_location.php b/DialogflowCx/samples/V3/DeploymentsClient/get_location.php new file mode 100644 index 000000000000..232f5f032cb5 --- /dev/null +++ b/DialogflowCx/samples/V3/DeploymentsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Deployments_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/DeploymentsClient/list_deployments.php b/DialogflowCx/samples/V3/DeploymentsClient/list_deployments.php new file mode 100644 index 000000000000..7f21d4bae752 --- /dev/null +++ b/DialogflowCx/samples/V3/DeploymentsClient/list_deployments.php @@ -0,0 +1,80 @@ +/locations//agents//environments/`. Please see + * {@see DeploymentsClient::environmentName()} for help formatting this field. + */ +function list_deployments_sample(string $formattedParent): void +{ + // Create a client. + $deploymentsClient = new DeploymentsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $deploymentsClient->listDeployments($formattedParent); + + /** @var Deployment $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = DeploymentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + + list_deployments_sample($formattedParent); +} +// [END dialogflow_v3_generated_Deployments_ListDeployments_sync] diff --git a/DialogflowCx/samples/V3/DeploymentsClient/list_locations.php b/DialogflowCx/samples/V3/DeploymentsClient/list_locations.php new file mode 100644 index 000000000000..dc67996cf9fd --- /dev/null +++ b/DialogflowCx/samples/V3/DeploymentsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Deployments_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/EntityTypesClient/create_entity_type.php b/DialogflowCx/samples/V3/EntityTypesClient/create_entity_type.php new file mode 100644 index 000000000000..b536ce190972 --- /dev/null +++ b/DialogflowCx/samples/V3/EntityTypesClient/create_entity_type.php @@ -0,0 +1,85 @@ +/locations//agents/`. Please see + * {@see EntityTypesClient::agentName()} for help formatting this field. + * @param string $entityTypeDisplayName The human-readable name of the entity type, unique within the + * agent. + * @param int $entityTypeKind Indicates the kind of entity type. + */ +function create_entity_type_sample( + string $formattedParent, + string $entityTypeDisplayName, + int $entityTypeKind +): void { + // Create a client. + $entityTypesClient = new EntityTypesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $entityType = (new EntityType()) + ->setDisplayName($entityTypeDisplayName) + ->setKind($entityTypeKind); + + // Call the API and handle any network failures. + try { + /** @var EntityType $response */ + $response = $entityTypesClient->createEntityType($formattedParent, $entityType); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = EntityTypesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $entityTypeDisplayName = '[DISPLAY_NAME]'; + $entityTypeKind = Kind::KIND_UNSPECIFIED; + + create_entity_type_sample($formattedParent, $entityTypeDisplayName, $entityTypeKind); +} +// [END dialogflow_v3_generated_EntityTypes_CreateEntityType_sync] diff --git a/DialogflowCx/samples/V3/EntityTypesClient/delete_entity_type.php b/DialogflowCx/samples/V3/EntityTypesClient/delete_entity_type.php new file mode 100644 index 000000000000..a81719d3adc1 --- /dev/null +++ b/DialogflowCx/samples/V3/EntityTypesClient/delete_entity_type.php @@ -0,0 +1,75 @@ +/locations//agents//entityTypes/`. Please see + * {@see EntityTypesClient::entityTypeName()} for help formatting this field. + */ +function delete_entity_type_sample(string $formattedName): void +{ + // Create a client. + $entityTypesClient = new EntityTypesClient(); + + // Call the API and handle any network failures. + try { + $entityTypesClient->deleteEntityType($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = EntityTypesClient::entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENTITY_TYPE]' + ); + + delete_entity_type_sample($formattedName); +} +// [END dialogflow_v3_generated_EntityTypes_DeleteEntityType_sync] diff --git a/DialogflowCx/samples/V3/EntityTypesClient/get_entity_type.php b/DialogflowCx/samples/V3/EntityTypesClient/get_entity_type.php new file mode 100644 index 000000000000..d4a8dffa6745 --- /dev/null +++ b/DialogflowCx/samples/V3/EntityTypesClient/get_entity_type.php @@ -0,0 +1,73 @@ +/locations//agents//entityTypes/`. Please see + * {@see EntityTypesClient::entityTypeName()} for help formatting this field. + */ +function get_entity_type_sample(string $formattedName): void +{ + // Create a client. + $entityTypesClient = new EntityTypesClient(); + + // Call the API and handle any network failures. + try { + /** @var EntityType $response */ + $response = $entityTypesClient->getEntityType($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = EntityTypesClient::entityTypeName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENTITY_TYPE]' + ); + + get_entity_type_sample($formattedName); +} +// [END dialogflow_v3_generated_EntityTypes_GetEntityType_sync] diff --git a/DialogflowCx/samples/V3/EntityTypesClient/get_location.php b/DialogflowCx/samples/V3/EntityTypesClient/get_location.php new file mode 100644 index 000000000000..ae2e8b85f6a7 --- /dev/null +++ b/DialogflowCx/samples/V3/EntityTypesClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_EntityTypes_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/EntityTypesClient/list_entity_types.php b/DialogflowCx/samples/V3/EntityTypesClient/list_entity_types.php new file mode 100644 index 000000000000..b6e450580482 --- /dev/null +++ b/DialogflowCx/samples/V3/EntityTypesClient/list_entity_types.php @@ -0,0 +1,72 @@ +/locations//agents/`. Please see + * {@see EntityTypesClient::agentName()} for help formatting this field. + */ +function list_entity_types_sample(string $formattedParent): void +{ + // Create a client. + $entityTypesClient = new EntityTypesClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $entityTypesClient->listEntityTypes($formattedParent); + + /** @var EntityType $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = EntityTypesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_entity_types_sample($formattedParent); +} +// [END dialogflow_v3_generated_EntityTypes_ListEntityTypes_sync] diff --git a/DialogflowCx/samples/V3/EntityTypesClient/list_locations.php b/DialogflowCx/samples/V3/EntityTypesClient/list_locations.php new file mode 100644 index 000000000000..ab29e47f9445 --- /dev/null +++ b/DialogflowCx/samples/V3/EntityTypesClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_EntityTypes_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/EntityTypesClient/update_entity_type.php b/DialogflowCx/samples/V3/EntityTypesClient/update_entity_type.php new file mode 100644 index 000000000000..02f22ac9c07a --- /dev/null +++ b/DialogflowCx/samples/V3/EntityTypesClient/update_entity_type.php @@ -0,0 +1,78 @@ +setDisplayName($entityTypeDisplayName) + ->setKind($entityTypeKind); + + // Call the API and handle any network failures. + try { + /** @var EntityType $response */ + $response = $entityTypesClient->updateEntityType($entityType); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $entityTypeDisplayName = '[DISPLAY_NAME]'; + $entityTypeKind = Kind::KIND_UNSPECIFIED; + + update_entity_type_sample($entityTypeDisplayName, $entityTypeKind); +} +// [END dialogflow_v3_generated_EntityTypes_UpdateEntityType_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/create_environment.php b/DialogflowCx/samples/V3/EnvironmentsClient/create_environment.php new file mode 100644 index 000000000000..760c9e98cb76 --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/create_environment.php @@ -0,0 +1,96 @@ +/locations//agents/`. Please see + * {@see EnvironmentsClient::agentName()} for help formatting this field. + * @param string $environmentDisplayName The human-readable name of the environment (unique in an agent). + * Limit of 64 characters. + */ +function create_environment_sample(string $formattedParent, string $environmentDisplayName): void +{ + // Create a client. + $environmentsClient = new EnvironmentsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $environment = (new Environment()) + ->setDisplayName($environmentDisplayName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $environmentsClient->createEnvironment($formattedParent, $environment); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Environment $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = EnvironmentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $environmentDisplayName = '[DISPLAY_NAME]'; + + create_environment_sample($formattedParent, $environmentDisplayName); +} +// [END dialogflow_v3_generated_Environments_CreateEnvironment_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/delete_environment.php b/DialogflowCx/samples/V3/EnvironmentsClient/delete_environment.php new file mode 100644 index 000000000000..67c2166b2dc7 --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/delete_environment.php @@ -0,0 +1,73 @@ +/locations//agents//environments/`. Please see + * {@see EnvironmentsClient::environmentName()} for help formatting this field. + */ +function delete_environment_sample(string $formattedName): void +{ + // Create a client. + $environmentsClient = new EnvironmentsClient(); + + // Call the API and handle any network failures. + try { + $environmentsClient->deleteEnvironment($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = EnvironmentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + + delete_environment_sample($formattedName); +} +// [END dialogflow_v3_generated_Environments_DeleteEnvironment_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/deploy_flow.php b/DialogflowCx/samples/V3/EnvironmentsClient/deploy_flow.php new file mode 100644 index 000000000000..57a58eee6cd5 --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/deploy_flow.php @@ -0,0 +1,106 @@ +/locations//agents// + * environments/`. Please see + * {@see EnvironmentsClient::environmentName()} for help formatting this field. + * @param string $formattedFlowVersion The flow version to deploy. + * Format: `projects//locations//agents// + * flows//versions/`. Please see + * {@see EnvironmentsClient::versionName()} for help formatting this field. + */ +function deploy_flow_sample(string $formattedEnvironment, string $formattedFlowVersion): void +{ + // Create a client. + $environmentsClient = new EnvironmentsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $environmentsClient->deployFlow($formattedEnvironment, $formattedFlowVersion); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var DeployFlowResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedEnvironment = EnvironmentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + $formattedFlowVersion = EnvironmentsClient::versionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]', + '[VERSION]' + ); + + deploy_flow_sample($formattedEnvironment, $formattedFlowVersion); +} +// [END dialogflow_v3_generated_Environments_DeployFlow_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/get_environment.php b/DialogflowCx/samples/V3/EnvironmentsClient/get_environment.php new file mode 100644 index 000000000000..5d000f5947e5 --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/get_environment.php @@ -0,0 +1,75 @@ +/locations//agents//environments/`. Please see + * {@see EnvironmentsClient::environmentName()} for help formatting this field. + */ +function get_environment_sample(string $formattedName): void +{ + // Create a client. + $environmentsClient = new EnvironmentsClient(); + + // Call the API and handle any network failures. + try { + /** @var Environment $response */ + $response = $environmentsClient->getEnvironment($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = EnvironmentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + + get_environment_sample($formattedName); +} +// [END dialogflow_v3_generated_Environments_GetEnvironment_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/get_location.php b/DialogflowCx/samples/V3/EnvironmentsClient/get_location.php new file mode 100644 index 000000000000..7b5417306553 --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Environments_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/list_continuous_test_results.php b/DialogflowCx/samples/V3/EnvironmentsClient/list_continuous_test_results.php new file mode 100644 index 000000000000..f05df473962e --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/list_continuous_test_results.php @@ -0,0 +1,78 @@ +/locations//agents// + * environments/`. Please see + * {@see EnvironmentsClient::environmentName()} for help formatting this field. + */ +function list_continuous_test_results_sample(string $formattedParent): void +{ + // Create a client. + $environmentsClient = new EnvironmentsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $environmentsClient->listContinuousTestResults($formattedParent); + + /** @var ContinuousTestResult $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = EnvironmentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + + list_continuous_test_results_sample($formattedParent); +} +// [END dialogflow_v3_generated_Environments_ListContinuousTestResults_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/list_environments.php b/DialogflowCx/samples/V3/EnvironmentsClient/list_environments.php new file mode 100644 index 000000000000..9591f1a8da7e --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/list_environments.php @@ -0,0 +1,74 @@ +/locations//agents/`. Please see + * {@see EnvironmentsClient::agentName()} for help formatting this field. + */ +function list_environments_sample(string $formattedParent): void +{ + // Create a client. + $environmentsClient = new EnvironmentsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $environmentsClient->listEnvironments($formattedParent); + + /** @var Environment $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = EnvironmentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_environments_sample($formattedParent); +} +// [END dialogflow_v3_generated_Environments_ListEnvironments_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/list_locations.php b/DialogflowCx/samples/V3/EnvironmentsClient/list_locations.php new file mode 100644 index 000000000000..e05ac218a40c --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Environments_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/lookup_environment_history.php b/DialogflowCx/samples/V3/EnvironmentsClient/lookup_environment_history.php new file mode 100644 index 000000000000..af93b16126bf --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/lookup_environment_history.php @@ -0,0 +1,79 @@ +/locations//agents//environments/`. Please see + * {@see EnvironmentsClient::environmentName()} for help formatting this field. + */ +function lookup_environment_history_sample(string $formattedName): void +{ + // Create a client. + $environmentsClient = new EnvironmentsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $environmentsClient->lookupEnvironmentHistory($formattedName); + + /** @var Environment $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = EnvironmentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + + lookup_environment_history_sample($formattedName); +} +// [END dialogflow_v3_generated_Environments_LookupEnvironmentHistory_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/run_continuous_test.php b/DialogflowCx/samples/V3/EnvironmentsClient/run_continuous_test.php new file mode 100644 index 000000000000..9387471357fe --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/run_continuous_test.php @@ -0,0 +1,94 @@ +/locations//agents//environments/`. Please see + * {@see EnvironmentsClient::environmentName()} for help formatting this field. + */ +function run_continuous_test_sample(string $formattedEnvironment): void +{ + // Create a client. + $environmentsClient = new EnvironmentsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $environmentsClient->runContinuousTest($formattedEnvironment); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RunContinuousTestResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedEnvironment = EnvironmentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + + run_continuous_test_sample($formattedEnvironment); +} +// [END dialogflow_v3_generated_Environments_RunContinuousTest_sync] diff --git a/DialogflowCx/samples/V3/EnvironmentsClient/update_environment.php b/DialogflowCx/samples/V3/EnvironmentsClient/update_environment.php new file mode 100644 index 000000000000..da86c99f5dcd --- /dev/null +++ b/DialogflowCx/samples/V3/EnvironmentsClient/update_environment.php @@ -0,0 +1,93 @@ +setDisplayName($environmentDisplayName); + $updateMask = new FieldMask(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $environmentsClient->updateEnvironment($environment, $updateMask); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Environment $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $environmentDisplayName = '[DISPLAY_NAME]'; + + update_environment_sample($environmentDisplayName); +} +// [END dialogflow_v3_generated_Environments_UpdateEnvironment_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/create_experiment.php b/DialogflowCx/samples/V3/ExperimentsClient/create_experiment.php new file mode 100644 index 000000000000..d8ecc02da010 --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/create_experiment.php @@ -0,0 +1,82 @@ +/locations//agents//environments/`. Please see + * {@see ExperimentsClient::environmentName()} for help formatting this field. + * @param string $experimentDisplayName The human-readable name of the experiment (unique in an + * environment). Limit of 64 characters. + */ +function create_experiment_sample(string $formattedParent, string $experimentDisplayName): void +{ + // Create a client. + $experimentsClient = new ExperimentsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $experiment = (new Experiment()) + ->setDisplayName($experimentDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Experiment $response */ + $response = $experimentsClient->createExperiment($formattedParent, $experiment); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ExperimentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + $experimentDisplayName = '[DISPLAY_NAME]'; + + create_experiment_sample($formattedParent, $experimentDisplayName); +} +// [END dialogflow_v3_generated_Experiments_CreateExperiment_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/delete_experiment.php b/DialogflowCx/samples/V3/ExperimentsClient/delete_experiment.php new file mode 100644 index 000000000000..dc7eb292055c --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/delete_experiment.php @@ -0,0 +1,74 @@ +/locations//agents//environments//experiments/`. Please see + * {@see ExperimentsClient::experimentName()} for help formatting this field. + */ +function delete_experiment_sample(string $formattedName): void +{ + // Create a client. + $experimentsClient = new ExperimentsClient(); + + // Call the API and handle any network failures. + try { + $experimentsClient->deleteExperiment($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExperimentsClient::experimentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]', + '[EXPERIMENT]' + ); + + delete_experiment_sample($formattedName); +} +// [END dialogflow_v3_generated_Experiments_DeleteExperiment_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/get_experiment.php b/DialogflowCx/samples/V3/ExperimentsClient/get_experiment.php new file mode 100644 index 000000000000..f24aa5b2b73f --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/get_experiment.php @@ -0,0 +1,76 @@ +/locations//agents//environments//experiments/`. Please see + * {@see ExperimentsClient::experimentName()} for help formatting this field. + */ +function get_experiment_sample(string $formattedName): void +{ + // Create a client. + $experimentsClient = new ExperimentsClient(); + + // Call the API and handle any network failures. + try { + /** @var Experiment $response */ + $response = $experimentsClient->getExperiment($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExperimentsClient::experimentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]', + '[EXPERIMENT]' + ); + + get_experiment_sample($formattedName); +} +// [END dialogflow_v3_generated_Experiments_GetExperiment_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/get_location.php b/DialogflowCx/samples/V3/ExperimentsClient/get_location.php new file mode 100644 index 000000000000..2e430e0ab69b --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Experiments_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/list_experiments.php b/DialogflowCx/samples/V3/ExperimentsClient/list_experiments.php new file mode 100644 index 000000000000..9f38d5cb9bc9 --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/list_experiments.php @@ -0,0 +1,80 @@ +/locations//agents//environments/`. Please see + * {@see ExperimentsClient::environmentName()} for help formatting this field. + */ +function list_experiments_sample(string $formattedParent): void +{ + // Create a client. + $experimentsClient = new ExperimentsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $experimentsClient->listExperiments($formattedParent); + + /** @var Experiment $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ExperimentsClient::environmentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]' + ); + + list_experiments_sample($formattedParent); +} +// [END dialogflow_v3_generated_Experiments_ListExperiments_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/list_locations.php b/DialogflowCx/samples/V3/ExperimentsClient/list_locations.php new file mode 100644 index 000000000000..a1e6e4706f69 --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Experiments_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/start_experiment.php b/DialogflowCx/samples/V3/ExperimentsClient/start_experiment.php new file mode 100644 index 000000000000..659118339be9 --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/start_experiment.php @@ -0,0 +1,76 @@ +/locations//agents//environments//experiments/`. Please see + * {@see ExperimentsClient::experimentName()} for help formatting this field. + */ +function start_experiment_sample(string $formattedName): void +{ + // Create a client. + $experimentsClient = new ExperimentsClient(); + + // Call the API and handle any network failures. + try { + /** @var Experiment $response */ + $response = $experimentsClient->startExperiment($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExperimentsClient::experimentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]', + '[EXPERIMENT]' + ); + + start_experiment_sample($formattedName); +} +// [END dialogflow_v3_generated_Experiments_StartExperiment_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/stop_experiment.php b/DialogflowCx/samples/V3/ExperimentsClient/stop_experiment.php new file mode 100644 index 000000000000..642c3afc03b4 --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/stop_experiment.php @@ -0,0 +1,75 @@ +/locations//agents//environments//experiments/`. Please see + * {@see ExperimentsClient::experimentName()} for help formatting this field. + */ +function stop_experiment_sample(string $formattedName): void +{ + // Create a client. + $experimentsClient = new ExperimentsClient(); + + // Call the API and handle any network failures. + try { + /** @var Experiment $response */ + $response = $experimentsClient->stopExperiment($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExperimentsClient::experimentName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[ENVIRONMENT]', + '[EXPERIMENT]' + ); + + stop_experiment_sample($formattedName); +} +// [END dialogflow_v3_generated_Experiments_StopExperiment_sync] diff --git a/DialogflowCx/samples/V3/ExperimentsClient/update_experiment.php b/DialogflowCx/samples/V3/ExperimentsClient/update_experiment.php new file mode 100644 index 000000000000..acec26fdcc9f --- /dev/null +++ b/DialogflowCx/samples/V3/ExperimentsClient/update_experiment.php @@ -0,0 +1,73 @@ +setDisplayName($experimentDisplayName); + $updateMask = new FieldMask(); + + // Call the API and handle any network failures. + try { + /** @var Experiment $response */ + $response = $experimentsClient->updateExperiment($experiment, $updateMask); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $experimentDisplayName = '[DISPLAY_NAME]'; + + update_experiment_sample($experimentDisplayName); +} +// [END dialogflow_v3_generated_Experiments_UpdateExperiment_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/create_flow.php b/DialogflowCx/samples/V3/FlowsClient/create_flow.php new file mode 100644 index 000000000000..fab9c1bf749e --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/create_flow.php @@ -0,0 +1,77 @@ +/locations//agents/`. Please see + * {@see FlowsClient::agentName()} for help formatting this field. + * @param string $flowDisplayName The human-readable name of the flow. + */ +function create_flow_sample(string $formattedParent, string $flowDisplayName): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $flow = (new Flow()) + ->setDisplayName($flowDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Flow $response */ + $response = $flowsClient->createFlow($formattedParent, $flow); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = FlowsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $flowDisplayName = '[DISPLAY_NAME]'; + + create_flow_sample($formattedParent, $flowDisplayName); +} +// [END dialogflow_v3_generated_Flows_CreateFlow_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/delete_flow.php b/DialogflowCx/samples/V3/FlowsClient/delete_flow.php new file mode 100644 index 000000000000..16b576625873 --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/delete_flow.php @@ -0,0 +1,66 @@ +/locations//agents//flows/`. Please see + * {@see FlowsClient::flowName()} for help formatting this field. + */ +function delete_flow_sample(string $formattedName): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Call the API and handle any network failures. + try { + $flowsClient->deleteFlow($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + + delete_flow_sample($formattedName); +} +// [END dialogflow_v3_generated_Flows_DeleteFlow_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/export_flow.php b/DialogflowCx/samples/V3/FlowsClient/export_flow.php new file mode 100644 index 000000000000..5230de34e396 --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/export_flow.php @@ -0,0 +1,92 @@ +/locations//agents//flows/`. Please see + * {@see FlowsClient::flowName()} for help formatting this field. + */ +function export_flow_sample(string $formattedName): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $flowsClient->exportFlow($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExportFlowResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + + export_flow_sample($formattedName); +} +// [END dialogflow_v3_generated_Flows_ExportFlow_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/get_flow.php b/DialogflowCx/samples/V3/FlowsClient/get_flow.php new file mode 100644 index 000000000000..1e03ef911afd --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/get_flow.php @@ -0,0 +1,68 @@ +/locations//agents//flows/`. Please see + * {@see FlowsClient::flowName()} for help formatting this field. + */ +function get_flow_sample(string $formattedName): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Call the API and handle any network failures. + try { + /** @var Flow $response */ + $response = $flowsClient->getFlow($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + + get_flow_sample($formattedName); +} +// [END dialogflow_v3_generated_Flows_GetFlow_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/get_flow_validation_result.php b/DialogflowCx/samples/V3/FlowsClient/get_flow_validation_result.php new file mode 100644 index 000000000000..e8bf068caa34 --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/get_flow_validation_result.php @@ -0,0 +1,74 @@ +/locations//agents//flows//validationResult`. Please see + * {@see FlowsClient::flowValidationResultName()} for help formatting this field. + */ +function get_flow_validation_result_sample(string $formattedName): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Call the API and handle any network failures. + try { + /** @var FlowValidationResult $response */ + $response = $flowsClient->getFlowValidationResult($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = FlowsClient::flowValidationResultName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]' + ); + + get_flow_validation_result_sample($formattedName); +} +// [END dialogflow_v3_generated_Flows_GetFlowValidationResult_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/get_location.php b/DialogflowCx/samples/V3/FlowsClient/get_location.php new file mode 100644 index 000000000000..ee4821b62211 --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Flows_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/import_flow.php b/DialogflowCx/samples/V3/FlowsClient/import_flow.php new file mode 100644 index 000000000000..eba189bcb62e --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/import_flow.php @@ -0,0 +1,92 @@ +/locations//agents/`. Please see + * {@see FlowsClient::agentName()} for help formatting this field. + */ +function import_flow_sample(string $formattedParent): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $flowsClient->importFlow($formattedParent); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ImportFlowResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = FlowsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + import_flow_sample($formattedParent); +} +// [END dialogflow_v3_generated_Flows_ImportFlow_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/list_flows.php b/DialogflowCx/samples/V3/FlowsClient/list_flows.php new file mode 100644 index 000000000000..b0ac9ad7a078 --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/list_flows.php @@ -0,0 +1,72 @@ +/locations//agents/`. Please see + * {@see FlowsClient::agentName()} for help formatting this field. + */ +function list_flows_sample(string $formattedParent): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $flowsClient->listFlows($formattedParent); + + /** @var Flow $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = FlowsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_flows_sample($formattedParent); +} +// [END dialogflow_v3_generated_Flows_ListFlows_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/list_locations.php b/DialogflowCx/samples/V3/FlowsClient/list_locations.php new file mode 100644 index 000000000000..0473daea63ab --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Flows_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/train_flow.php b/DialogflowCx/samples/V3/FlowsClient/train_flow.php new file mode 100644 index 000000000000..0563d0a6d0a8 --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/train_flow.php @@ -0,0 +1,91 @@ +/locations//agents//flows/`. Please see + * {@see FlowsClient::flowName()} for help formatting this field. + */ +function train_flow_sample(string $formattedName): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $flowsClient->trainFlow($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + + train_flow_sample($formattedName); +} +// [END dialogflow_v3_generated_Flows_TrainFlow_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/update_flow.php b/DialogflowCx/samples/V3/FlowsClient/update_flow.php new file mode 100644 index 000000000000..59e7bd05b0d3 --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/update_flow.php @@ -0,0 +1,73 @@ +setDisplayName($flowDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Flow $response */ + $response = $flowsClient->updateFlow($flow); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $flowDisplayName = '[DISPLAY_NAME]'; + + update_flow_sample($flowDisplayName); +} +// [END dialogflow_v3_generated_Flows_UpdateFlow_sync] diff --git a/DialogflowCx/samples/V3/FlowsClient/validate_flow.php b/DialogflowCx/samples/V3/FlowsClient/validate_flow.php new file mode 100644 index 000000000000..eafd2bbedfae --- /dev/null +++ b/DialogflowCx/samples/V3/FlowsClient/validate_flow.php @@ -0,0 +1,70 @@ +/locations//agents//flows/`. Please see + * {@see FlowsClient::flowName()} for help formatting this field. + */ +function validate_flow_sample(string $formattedName): void +{ + // Create a client. + $flowsClient = new FlowsClient(); + + // Call the API and handle any network failures. + try { + /** @var FlowValidationResult $response */ + $response = $flowsClient->validateFlow($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = FlowsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + + validate_flow_sample($formattedName); +} +// [END dialogflow_v3_generated_Flows_ValidateFlow_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/create_intent.php b/DialogflowCx/samples/V3/IntentsClient/create_intent.php new file mode 100644 index 000000000000..8da24bdfca57 --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/create_intent.php @@ -0,0 +1,77 @@ +/locations//agents/`. Please see + * {@see IntentsClient::agentName()} for help formatting this field. + * @param string $intentDisplayName The human-readable name of the intent, unique within the agent. + */ +function create_intent_sample(string $formattedParent, string $intentDisplayName): void +{ + // Create a client. + $intentsClient = new IntentsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $intent = (new Intent()) + ->setDisplayName($intentDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Intent $response */ + $response = $intentsClient->createIntent($formattedParent, $intent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = IntentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $intentDisplayName = '[DISPLAY_NAME]'; + + create_intent_sample($formattedParent, $intentDisplayName); +} +// [END dialogflow_v3_generated_Intents_CreateIntent_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/delete_intent.php b/DialogflowCx/samples/V3/IntentsClient/delete_intent.php new file mode 100644 index 000000000000..ed3141f0880b --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/delete_intent.php @@ -0,0 +1,70 @@ +/locations//agents//intents/`. Please see + * {@see IntentsClient::intentName()} for help formatting this field. + */ +function delete_intent_sample(string $formattedName): void +{ + // Create a client. + $intentsClient = new IntentsClient(); + + // Call the API and handle any network failures. + try { + $intentsClient->deleteIntent($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = IntentsClient::intentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[INTENT]'); + + delete_intent_sample($formattedName); +} +// [END dialogflow_v3_generated_Intents_DeleteIntent_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/export_intents.php b/DialogflowCx/samples/V3/IntentsClient/export_intents.php new file mode 100644 index 000000000000..705b8787e161 --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/export_intents.php @@ -0,0 +1,96 @@ +/locations//agents/`. Please see + * {@see IntentsClient::agentName()} for help formatting this field. + * @param string $intentsElement The name of the intents to export. + * Format: `projects//locations//agents//intents/`. + */ +function export_intents_sample(string $formattedParent, string $intentsElement): void +{ + // Create a client. + $intentsClient = new IntentsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $intents = [$intentsElement,]; + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $intentsClient->exportIntents($formattedParent, $intents); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExportIntentsResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = IntentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $intentsElement = '[INTENTS]'; + + export_intents_sample($formattedParent, $intentsElement); +} +// [END dialogflow_v3_generated_Intents_ExportIntents_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/get_intent.php b/DialogflowCx/samples/V3/IntentsClient/get_intent.php new file mode 100644 index 000000000000..dc6ec01f2b9e --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/get_intent.php @@ -0,0 +1,68 @@ +/locations//agents//intents/`. Please see + * {@see IntentsClient::intentName()} for help formatting this field. + */ +function get_intent_sample(string $formattedName): void +{ + // Create a client. + $intentsClient = new IntentsClient(); + + // Call the API and handle any network failures. + try { + /** @var Intent $response */ + $response = $intentsClient->getIntent($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = IntentsClient::intentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[INTENT]'); + + get_intent_sample($formattedName); +} +// [END dialogflow_v3_generated_Intents_GetIntent_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/get_location.php b/DialogflowCx/samples/V3/IntentsClient/get_location.php new file mode 100644 index 000000000000..2bc81b563adc --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Intents_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/import_intents.php b/DialogflowCx/samples/V3/IntentsClient/import_intents.php new file mode 100644 index 000000000000..b1d85e26f055 --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/import_intents.php @@ -0,0 +1,88 @@ +/locations//agents/`. Please see + * {@see IntentsClient::agentName()} for help formatting this field. + */ +function import_intents_sample(string $formattedParent): void +{ + // Create a client. + $intentsClient = new IntentsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $intentsClient->importIntents($formattedParent); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ImportIntentsResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = IntentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + import_intents_sample($formattedParent); +} +// [END dialogflow_v3_generated_Intents_ImportIntents_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/list_intents.php b/DialogflowCx/samples/V3/IntentsClient/list_intents.php new file mode 100644 index 000000000000..9580b931ab10 --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/list_intents.php @@ -0,0 +1,72 @@ +/locations//agents/`. Please see + * {@see IntentsClient::agentName()} for help formatting this field. + */ +function list_intents_sample(string $formattedParent): void +{ + // Create a client. + $intentsClient = new IntentsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $intentsClient->listIntents($formattedParent); + + /** @var Intent $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = IntentsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_intents_sample($formattedParent); +} +// [END dialogflow_v3_generated_Intents_ListIntents_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/list_locations.php b/DialogflowCx/samples/V3/IntentsClient/list_locations.php new file mode 100644 index 000000000000..01f26c5f5c82 --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Intents_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/IntentsClient/update_intent.php b/DialogflowCx/samples/V3/IntentsClient/update_intent.php new file mode 100644 index 000000000000..da1750837b80 --- /dev/null +++ b/DialogflowCx/samples/V3/IntentsClient/update_intent.php @@ -0,0 +1,73 @@ +setDisplayName($intentDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Intent $response */ + $response = $intentsClient->updateIntent($intent); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $intentDisplayName = '[DISPLAY_NAME]'; + + update_intent_sample($intentDisplayName); +} +// [END dialogflow_v3_generated_Intents_UpdateIntent_sync] diff --git a/DialogflowCx/samples/V3/PagesClient/create_page.php b/DialogflowCx/samples/V3/PagesClient/create_page.php new file mode 100644 index 000000000000..6ec2a046a555 --- /dev/null +++ b/DialogflowCx/samples/V3/PagesClient/create_page.php @@ -0,0 +1,78 @@ +/locations//agents//flows/`. Please see + * {@see PagesClient::flowName()} for help formatting this field. + * @param string $pageDisplayName The human-readable name of the page, unique within the flow. + */ +function create_page_sample(string $formattedParent, string $pageDisplayName): void +{ + // Create a client. + $pagesClient = new PagesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $page = (new Page()) + ->setDisplayName($pageDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Page $response */ + $response = $pagesClient->createPage($formattedParent, $page); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = PagesClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + $pageDisplayName = '[DISPLAY_NAME]'; + + create_page_sample($formattedParent, $pageDisplayName); +} +// [END dialogflow_v3_generated_Pages_CreatePage_sync] diff --git a/DialogflowCx/samples/V3/PagesClient/delete_page.php b/DialogflowCx/samples/V3/PagesClient/delete_page.php new file mode 100644 index 000000000000..8ed6a24fa56f --- /dev/null +++ b/DialogflowCx/samples/V3/PagesClient/delete_page.php @@ -0,0 +1,70 @@ +/locations//agents//Flows//pages/`. Please see + * {@see PagesClient::pageName()} for help formatting this field. + */ +function delete_page_sample(string $formattedName): void +{ + // Create a client. + $pagesClient = new PagesClient(); + + // Call the API and handle any network failures. + try { + $pagesClient->deletePage($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = PagesClient::pageName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[PAGE]'); + + delete_page_sample($formattedName); +} +// [END dialogflow_v3_generated_Pages_DeletePage_sync] diff --git a/DialogflowCx/samples/V3/PagesClient/get_location.php b/DialogflowCx/samples/V3/PagesClient/get_location.php new file mode 100644 index 000000000000..49c712376b42 --- /dev/null +++ b/DialogflowCx/samples/V3/PagesClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Pages_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/PagesClient/get_page.php b/DialogflowCx/samples/V3/PagesClient/get_page.php new file mode 100644 index 000000000000..e6c7069f4c87 --- /dev/null +++ b/DialogflowCx/samples/V3/PagesClient/get_page.php @@ -0,0 +1,68 @@ +/locations//agents//flows//pages/`. Please see + * {@see PagesClient::pageName()} for help formatting this field. + */ +function get_page_sample(string $formattedName): void +{ + // Create a client. + $pagesClient = new PagesClient(); + + // Call the API and handle any network failures. + try { + /** @var Page $response */ + $response = $pagesClient->getPage($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = PagesClient::pageName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[PAGE]'); + + get_page_sample($formattedName); +} +// [END dialogflow_v3_generated_Pages_GetPage_sync] diff --git a/DialogflowCx/samples/V3/PagesClient/list_locations.php b/DialogflowCx/samples/V3/PagesClient/list_locations.php new file mode 100644 index 000000000000..c27c8ea3306a --- /dev/null +++ b/DialogflowCx/samples/V3/PagesClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Pages_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/PagesClient/list_pages.php b/DialogflowCx/samples/V3/PagesClient/list_pages.php new file mode 100644 index 000000000000..86ade7949aa3 --- /dev/null +++ b/DialogflowCx/samples/V3/PagesClient/list_pages.php @@ -0,0 +1,73 @@ +/locations//agents//flows/`. Please see + * {@see PagesClient::flowName()} for help formatting this field. + */ +function list_pages_sample(string $formattedParent): void +{ + // Create a client. + $pagesClient = new PagesClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $pagesClient->listPages($formattedParent); + + /** @var Page $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = PagesClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + + list_pages_sample($formattedParent); +} +// [END dialogflow_v3_generated_Pages_ListPages_sync] diff --git a/DialogflowCx/samples/V3/PagesClient/update_page.php b/DialogflowCx/samples/V3/PagesClient/update_page.php new file mode 100644 index 000000000000..e0c16dbc9d2b --- /dev/null +++ b/DialogflowCx/samples/V3/PagesClient/update_page.php @@ -0,0 +1,73 @@ +setDisplayName($pageDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Page $response */ + $response = $pagesClient->updatePage($page); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $pageDisplayName = '[DISPLAY_NAME]'; + + update_page_sample($pageDisplayName); +} +// [END dialogflow_v3_generated_Pages_UpdatePage_sync] diff --git a/DialogflowCx/samples/V3/SecuritySettingsServiceClient/create_security_settings.php b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/create_security_settings.php new file mode 100644 index 000000000000..30b2a7806643 --- /dev/null +++ b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/create_security_settings.php @@ -0,0 +1,80 @@ +/locations/`. Please see + * {@see SecuritySettingsServiceClient::locationName()} for help formatting this field. + * @param string $securitySettingsDisplayName The human-readable name of the security settings, unique within + * the location. + */ +function create_security_settings_sample( + string $formattedParent, + string $securitySettingsDisplayName +): void { + // Create a client. + $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $securitySettings = (new SecuritySettings()) + ->setDisplayName($securitySettingsDisplayName); + + // Call the API and handle any network failures. + try { + /** @var SecuritySettings $response */ + $response = $securitySettingsServiceClient->createSecuritySettings( + $formattedParent, + $securitySettings + ); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SecuritySettingsServiceClient::locationName('[PROJECT]', '[LOCATION]'); + $securitySettingsDisplayName = '[DISPLAY_NAME]'; + + create_security_settings_sample($formattedParent, $securitySettingsDisplayName); +} +// [END dialogflow_v3_generated_SecuritySettingsService_CreateSecuritySettings_sync] diff --git a/DialogflowCx/samples/V3/SecuritySettingsServiceClient/delete_security_settings.php b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/delete_security_settings.php new file mode 100644 index 000000000000..8b7b5e3ec991 --- /dev/null +++ b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/delete_security_settings.php @@ -0,0 +1,72 @@ +/locations//securitySettings/`. Please see + * {@see SecuritySettingsServiceClient::securitySettingsName()} for help formatting this field. + */ +function delete_security_settings_sample(string $formattedName): void +{ + // Create a client. + $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + + // Call the API and handle any network failures. + try { + $securitySettingsServiceClient->deleteSecuritySettings($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SecuritySettingsServiceClient::securitySettingsName( + '[PROJECT]', + '[LOCATION]', + '[SECURITY_SETTINGS]' + ); + + delete_security_settings_sample($formattedName); +} +// [END dialogflow_v3_generated_SecuritySettingsService_DeleteSecuritySettings_sync] diff --git a/DialogflowCx/samples/V3/SecuritySettingsServiceClient/get_location.php b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/get_location.php new file mode 100644 index 000000000000..0dcacaefb3ad --- /dev/null +++ b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_SecuritySettingsService_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/SecuritySettingsServiceClient/get_security_settings.php b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/get_security_settings.php new file mode 100644 index 000000000000..0d8d4736a343 --- /dev/null +++ b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/get_security_settings.php @@ -0,0 +1,74 @@ +/locations//securitySettings/`. Please see + * {@see SecuritySettingsServiceClient::securitySettingsName()} for help formatting this field. + */ +function get_security_settings_sample(string $formattedName): void +{ + // Create a client. + $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + + // Call the API and handle any network failures. + try { + /** @var SecuritySettings $response */ + $response = $securitySettingsServiceClient->getSecuritySettings($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SecuritySettingsServiceClient::securitySettingsName( + '[PROJECT]', + '[LOCATION]', + '[SECURITY_SETTINGS]' + ); + + get_security_settings_sample($formattedName); +} +// [END dialogflow_v3_generated_SecuritySettingsService_GetSecuritySettings_sync] diff --git a/DialogflowCx/samples/V3/SecuritySettingsServiceClient/list_locations.php b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/list_locations.php new file mode 100644 index 000000000000..bf4accef8b62 --- /dev/null +++ b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_SecuritySettingsService_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/SecuritySettingsServiceClient/list_security_settings.php b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/list_security_settings.php new file mode 100644 index 000000000000..e2342cfeb402 --- /dev/null +++ b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/list_security_settings.php @@ -0,0 +1,72 @@ +/locations/`. Please see + * {@see SecuritySettingsServiceClient::locationName()} for help formatting this field. + */ +function list_security_settings_sample(string $formattedParent): void +{ + // Create a client. + $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $securitySettingsServiceClient->listSecuritySettings($formattedParent); + + /** @var SecuritySettings $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SecuritySettingsServiceClient::locationName('[PROJECT]', '[LOCATION]'); + + list_security_settings_sample($formattedParent); +} +// [END dialogflow_v3_generated_SecuritySettingsService_ListSecuritySettings_sync] diff --git a/DialogflowCx/samples/V3/SecuritySettingsServiceClient/update_security_settings.php b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/update_security_settings.php new file mode 100644 index 000000000000..9eb8b5f84a08 --- /dev/null +++ b/DialogflowCx/samples/V3/SecuritySettingsServiceClient/update_security_settings.php @@ -0,0 +1,73 @@ +setDisplayName($securitySettingsDisplayName); + $updateMask = new FieldMask(); + + // Call the API and handle any network failures. + try { + /** @var SecuritySettings $response */ + $response = $securitySettingsServiceClient->updateSecuritySettings($securitySettings, $updateMask); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $securitySettingsDisplayName = '[DISPLAY_NAME]'; + + update_security_settings_sample($securitySettingsDisplayName); +} +// [END dialogflow_v3_generated_SecuritySettingsService_UpdateSecuritySettings_sync] diff --git a/DialogflowCx/samples/V3/SessionEntityTypesClient/create_session_entity_type.php b/DialogflowCx/samples/V3/SessionEntityTypesClient/create_session_entity_type.php new file mode 100644 index 000000000000..4cccdab488eb --- /dev/null +++ b/DialogflowCx/samples/V3/SessionEntityTypesClient/create_session_entity_type.php @@ -0,0 +1,135 @@ +/locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. Please see + * {@see SessionEntityTypesClient::sessionName()} for help formatting this field. + * @param string $sessionEntityTypeName The unique identifier of the session entity type. + * Format: `projects//locations//agents//sessions//entityTypes/` or `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param int $sessionEntityTypeEntityOverrideMode Indicates whether the additional data should override or + * supplement the custom entity type definition. + * @param string $sessionEntityTypeEntitiesValue 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 canonical 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). + * @param string $sessionEntityTypeEntitiesSynonymsElement 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`. + */ +function create_session_entity_type_sample( + string $formattedParent, + string $sessionEntityTypeName, + int $sessionEntityTypeEntityOverrideMode, + string $sessionEntityTypeEntitiesValue, + string $sessionEntityTypeEntitiesSynonymsElement +): void { + // Create a client. + $sessionEntityTypesClient = new SessionEntityTypesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $sessionEntityTypeEntitiesSynonyms = [$sessionEntityTypeEntitiesSynonymsElement,]; + $entity = (new Entity()) + ->setValue($sessionEntityTypeEntitiesValue) + ->setSynonyms($sessionEntityTypeEntitiesSynonyms); + $sessionEntityTypeEntities = [$entity,]; + $sessionEntityType = (new SessionEntityType()) + ->setName($sessionEntityTypeName) + ->setEntityOverrideMode($sessionEntityTypeEntityOverrideMode) + ->setEntities($sessionEntityTypeEntities); + + // Call the API and handle any network failures. + try { + /** @var SessionEntityType $response */ + $response = $sessionEntityTypesClient->createSessionEntityType( + $formattedParent, + $sessionEntityType + ); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SessionEntityTypesClient::sessionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[SESSION]' + ); + $sessionEntityTypeName = '[NAME]'; + $sessionEntityTypeEntityOverrideMode = EntityOverrideMode::ENTITY_OVERRIDE_MODE_UNSPECIFIED; + $sessionEntityTypeEntitiesValue = '[VALUE]'; + $sessionEntityTypeEntitiesSynonymsElement = '[SYNONYMS]'; + + create_session_entity_type_sample( + $formattedParent, + $sessionEntityTypeName, + $sessionEntityTypeEntityOverrideMode, + $sessionEntityTypeEntitiesValue, + $sessionEntityTypeEntitiesSynonymsElement + ); +} +// [END dialogflow_v3_generated_SessionEntityTypes_CreateSessionEntityType_sync] diff --git a/DialogflowCx/samples/V3/SessionEntityTypesClient/delete_session_entity_type.php b/DialogflowCx/samples/V3/SessionEntityTypesClient/delete_session_entity_type.php new file mode 100644 index 000000000000..f885465342d5 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionEntityTypesClient/delete_session_entity_type.php @@ -0,0 +1,76 @@ +/locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. Please see + * {@see SessionEntityTypesClient::sessionEntityTypeName()} for help formatting this field. + */ +function delete_session_entity_type_sample(string $formattedName): void +{ + // Create a client. + $sessionEntityTypesClient = new SessionEntityTypesClient(); + + // Call the API and handle any network failures. + try { + $sessionEntityTypesClient->deleteSessionEntityType($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SessionEntityTypesClient::sessionEntityTypeName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[SESSION]', + '[ENTITY_TYPE]' + ); + + delete_session_entity_type_sample($formattedName); +} +// [END dialogflow_v3_generated_SessionEntityTypes_DeleteSessionEntityType_sync] diff --git a/DialogflowCx/samples/V3/SessionEntityTypesClient/get_location.php b/DialogflowCx/samples/V3/SessionEntityTypesClient/get_location.php new file mode 100644 index 000000000000..c598855fc003 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionEntityTypesClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_SessionEntityTypes_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/SessionEntityTypesClient/get_session_entity_type.php b/DialogflowCx/samples/V3/SessionEntityTypesClient/get_session_entity_type.php new file mode 100644 index 000000000000..b4f5b704c660 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionEntityTypesClient/get_session_entity_type.php @@ -0,0 +1,78 @@ +/locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. Please see + * {@see SessionEntityTypesClient::sessionEntityTypeName()} for help formatting this field. + */ +function get_session_entity_type_sample(string $formattedName): void +{ + // Create a client. + $sessionEntityTypesClient = new SessionEntityTypesClient(); + + // Call the API and handle any network failures. + try { + /** @var SessionEntityType $response */ + $response = $sessionEntityTypesClient->getSessionEntityType($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = SessionEntityTypesClient::sessionEntityTypeName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[SESSION]', + '[ENTITY_TYPE]' + ); + + get_session_entity_type_sample($formattedName); +} +// [END dialogflow_v3_generated_SessionEntityTypes_GetSessionEntityType_sync] diff --git a/DialogflowCx/samples/V3/SessionEntityTypesClient/list_locations.php b/DialogflowCx/samples/V3/SessionEntityTypesClient/list_locations.php new file mode 100644 index 000000000000..fa8045a3c9f1 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionEntityTypesClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_SessionEntityTypes_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/SessionEntityTypesClient/list_session_entity_types.php b/DialogflowCx/samples/V3/SessionEntityTypesClient/list_session_entity_types.php new file mode 100644 index 000000000000..b1dff0ca02c3 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionEntityTypesClient/list_session_entity_types.php @@ -0,0 +1,81 @@ +/locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. Please see + * {@see SessionEntityTypesClient::sessionName()} for help formatting this field. + */ +function list_session_entity_types_sample(string $formattedParent): void +{ + // Create a client. + $sessionEntityTypesClient = new SessionEntityTypesClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $sessionEntityTypesClient->listSessionEntityTypes($formattedParent); + + /** @var SessionEntityType $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = SessionEntityTypesClient::sessionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[SESSION]' + ); + + list_session_entity_types_sample($formattedParent); +} +// [END dialogflow_v3_generated_SessionEntityTypes_ListSessionEntityTypes_sync] diff --git a/DialogflowCx/samples/V3/SessionEntityTypesClient/update_session_entity_type.php b/DialogflowCx/samples/V3/SessionEntityTypesClient/update_session_entity_type.php new file mode 100644 index 000000000000..c5a04bbb01ab --- /dev/null +++ b/DialogflowCx/samples/V3/SessionEntityTypesClient/update_session_entity_type.php @@ -0,0 +1,117 @@ +/locations//agents//sessions//entityTypes/` or `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param int $sessionEntityTypeEntityOverrideMode Indicates whether the additional data should override or + * supplement the custom entity type definition. + * @param string $sessionEntityTypeEntitiesValue 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 canonical 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). + * @param string $sessionEntityTypeEntitiesSynonymsElement 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`. + */ +function update_session_entity_type_sample( + string $sessionEntityTypeName, + int $sessionEntityTypeEntityOverrideMode, + string $sessionEntityTypeEntitiesValue, + string $sessionEntityTypeEntitiesSynonymsElement +): void { + // Create a client. + $sessionEntityTypesClient = new SessionEntityTypesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $sessionEntityTypeEntitiesSynonyms = [$sessionEntityTypeEntitiesSynonymsElement,]; + $entity = (new Entity()) + ->setValue($sessionEntityTypeEntitiesValue) + ->setSynonyms($sessionEntityTypeEntitiesSynonyms); + $sessionEntityTypeEntities = [$entity,]; + $sessionEntityType = (new SessionEntityType()) + ->setName($sessionEntityTypeName) + ->setEntityOverrideMode($sessionEntityTypeEntityOverrideMode) + ->setEntities($sessionEntityTypeEntities); + + // Call the API and handle any network failures. + try { + /** @var SessionEntityType $response */ + $response = $sessionEntityTypesClient->updateSessionEntityType($sessionEntityType); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $sessionEntityTypeName = '[NAME]'; + $sessionEntityTypeEntityOverrideMode = EntityOverrideMode::ENTITY_OVERRIDE_MODE_UNSPECIFIED; + $sessionEntityTypeEntitiesValue = '[VALUE]'; + $sessionEntityTypeEntitiesSynonymsElement = '[SYNONYMS]'; + + update_session_entity_type_sample( + $sessionEntityTypeName, + $sessionEntityTypeEntityOverrideMode, + $sessionEntityTypeEntitiesValue, + $sessionEntityTypeEntitiesSynonymsElement + ); +} +// [END dialogflow_v3_generated_SessionEntityTypes_UpdateSessionEntityType_sync] diff --git a/DialogflowCx/samples/V3/SessionsClient/detect_intent.php b/DialogflowCx/samples/V3/SessionsClient/detect_intent.php new file mode 100644 index 000000000000..4e61757c9581 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionsClient/detect_intent.php @@ -0,0 +1,98 @@ +/locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). Please see + * {@see SessionsClient::sessionName()} for help formatting this field. + * @param string $queryInputLanguageCode The language of the input. See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * 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. + */ +function detect_intent_sample(string $formattedSession, string $queryInputLanguageCode): void +{ + // Create a client. + $sessionsClient = new SessionsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $queryInput = (new QueryInput()) + ->setLanguageCode($queryInputLanguageCode); + + // Call the API and handle any network failures. + try { + /** @var DetectIntentResponse $response */ + $response = $sessionsClient->detectIntent($formattedSession, $queryInput); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SessionsClient::sessionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]'); + $queryInputLanguageCode = '[LANGUAGE_CODE]'; + + detect_intent_sample($formattedSession, $queryInputLanguageCode); +} +// [END dialogflow_v3_generated_Sessions_DetectIntent_sync] diff --git a/DialogflowCx/samples/V3/SessionsClient/fulfill_intent.php b/DialogflowCx/samples/V3/SessionsClient/fulfill_intent.php new file mode 100644 index 000000000000..99d06a70da02 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionsClient/fulfill_intent.php @@ -0,0 +1,59 @@ +fulfillIntent(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Sessions_FulfillIntent_sync] diff --git a/DialogflowCx/samples/V3/SessionsClient/get_location.php b/DialogflowCx/samples/V3/SessionsClient/get_location.php new file mode 100644 index 000000000000..f5d5625ccef2 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Sessions_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/SessionsClient/list_locations.php b/DialogflowCx/samples/V3/SessionsClient/list_locations.php new file mode 100644 index 000000000000..f1464e5d2e77 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Sessions_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/SessionsClient/match_intent.php b/DialogflowCx/samples/V3/SessionsClient/match_intent.php new file mode 100644 index 000000000000..233acf36a2bc --- /dev/null +++ b/DialogflowCx/samples/V3/SessionsClient/match_intent.php @@ -0,0 +1,88 @@ +/locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). Please see + * {@see SessionsClient::sessionName()} for help formatting this field. + * @param string $queryInputLanguageCode The language of the input. See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * 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. + */ +function match_intent_sample(string $formattedSession, string $queryInputLanguageCode): void +{ + // Create a client. + $sessionsClient = new SessionsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $queryInput = (new QueryInput()) + ->setLanguageCode($queryInputLanguageCode); + + // Call the API and handle any network failures. + try { + /** @var MatchIntentResponse $response */ + $response = $sessionsClient->matchIntent($formattedSession, $queryInput); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedSession = SessionsClient::sessionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]'); + $queryInputLanguageCode = '[LANGUAGE_CODE]'; + + match_intent_sample($formattedSession, $queryInputLanguageCode); +} +// [END dialogflow_v3_generated_Sessions_MatchIntent_sync] diff --git a/DialogflowCx/samples/V3/SessionsClient/streaming_detect_intent.php b/DialogflowCx/samples/V3/SessionsClient/streaming_detect_intent.php new file mode 100644 index 000000000000..e0d917aedff7 --- /dev/null +++ b/DialogflowCx/samples/V3/SessionsClient/streaming_detect_intent.php @@ -0,0 +1,88 @@ +setLanguageCode($queryInputLanguageCode); + $request = (new StreamingDetectIntentRequest()) + ->setQueryInput($queryInput); + + // Call the API and handle any network failures. + try { + /** @var BidiStream $stream */ + $stream = $sessionsClient->streamingDetectIntent(); + $stream->writeAll([$request,]); + + /** @var StreamingDetectIntentResponse $element */ + foreach ($stream->closeWriteAndReadAll() as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $queryInputLanguageCode = '[LANGUAGE_CODE]'; + + streaming_detect_intent_sample($queryInputLanguageCode); +} +// [END dialogflow_v3_generated_Sessions_StreamingDetectIntent_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/batch_delete_test_cases.php b/DialogflowCx/samples/V3/TestCasesClient/batch_delete_test_cases.php new file mode 100644 index 000000000000..57118005f019 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/batch_delete_test_cases.php @@ -0,0 +1,79 @@ +/locations//agents/`. Please see + * {@see TestCasesClient::agentName()} for help formatting this field. + * @param string $formattedNamesElement Format of test case names: `projects//locations/ + * /agents//testCases/`. Please see + * {@see TestCasesClient::testCaseName()} for help formatting this field. + */ +function batch_delete_test_cases_sample( + string $formattedParent, + string $formattedNamesElement +): void { + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $formattedNames = [$formattedNamesElement,]; + + // Call the API and handle any network failures. + try { + $testCasesClient->batchDeleteTestCases($formattedParent, $formattedNames); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $formattedNamesElement = TestCasesClient::testCaseName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[TEST_CASE]' + ); + + batch_delete_test_cases_sample($formattedParent, $formattedNamesElement); +} +// [END dialogflow_v3_generated_TestCases_BatchDeleteTestCases_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/batch_run_test_cases.php b/DialogflowCx/samples/V3/TestCasesClient/batch_run_test_cases.php new file mode 100644 index 000000000000..2436668c29fd --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/batch_run_test_cases.php @@ -0,0 +1,102 @@ +/locations//agents/ `. Please see + * {@see TestCasesClient::agentName()} for help formatting this field. + * @param string $formattedTestCasesElement Format: `projects//locations//agents//testCases/`. Please see + * {@see TestCasesClient::testCaseName()} for help formatting this field. + */ +function batch_run_test_cases_sample( + string $formattedParent, + string $formattedTestCasesElement +): void { + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $formattedTestCases = [$formattedTestCasesElement,]; + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $testCasesClient->batchRunTestCases($formattedParent, $formattedTestCases); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var BatchRunTestCasesResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $formattedTestCasesElement = TestCasesClient::testCaseName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[TEST_CASE]' + ); + + batch_run_test_cases_sample($formattedParent, $formattedTestCasesElement); +} +// [END dialogflow_v3_generated_TestCases_BatchRunTestCases_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/calculate_coverage.php b/DialogflowCx/samples/V3/TestCasesClient/calculate_coverage.php new file mode 100644 index 000000000000..dc4d206aca34 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/calculate_coverage.php @@ -0,0 +1,70 @@ +/locations//agents/`. Please see + * {@see TestCasesClient::agentName()} for help formatting this field. + * @param int $type The type of coverage requested. + */ +function calculate_coverage_sample(string $formattedAgent, int $type): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Call the API and handle any network failures. + try { + /** @var CalculateCoverageResponse $response */ + $response = $testCasesClient->calculateCoverage($formattedAgent, $type); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedAgent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $type = CoverageType::COVERAGE_TYPE_UNSPECIFIED; + + calculate_coverage_sample($formattedAgent, $type); +} +// [END dialogflow_v3_generated_TestCases_CalculateCoverage_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/create_test_case.php b/DialogflowCx/samples/V3/TestCasesClient/create_test_case.php new file mode 100644 index 000000000000..fe6ca56fc1a0 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/create_test_case.php @@ -0,0 +1,74 @@ +/locations//agents/`. Please see + * {@see TestCasesClient::agentName()} for help formatting this field. + * @param string $testCaseDisplayName The human-readable name of the test case, unique within the + * agent. Limit of 200 characters. + */ +function create_test_case_sample(string $formattedParent, string $testCaseDisplayName): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $testCase = (new TestCase()) + ->setDisplayName($testCaseDisplayName); + + // Call the API and handle any network failures. + try { + /** @var TestCase $response */ + $response = $testCasesClient->createTestCase($formattedParent, $testCase); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $testCaseDisplayName = '[DISPLAY_NAME]'; + + create_test_case_sample($formattedParent, $testCaseDisplayName); +} +// [END dialogflow_v3_generated_TestCases_CreateTestCase_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/export_test_cases.php b/DialogflowCx/samples/V3/TestCasesClient/export_test_cases.php new file mode 100644 index 000000000000..525274bfd729 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/export_test_cases.php @@ -0,0 +1,89 @@ +/locations//agents/`. Please see + * {@see TestCasesClient::agentName()} for help formatting this field. + */ +function export_test_cases_sample(string $formattedParent): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $testCasesClient->exportTestCases($formattedParent); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExportTestCasesResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + export_test_cases_sample($formattedParent); +} +// [END dialogflow_v3_generated_TestCases_ExportTestCases_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/get_location.php b/DialogflowCx/samples/V3/TestCasesClient/get_location.php new file mode 100644 index 000000000000..9bf99a63c293 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_TestCases_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/get_test_case.php b/DialogflowCx/samples/V3/TestCasesClient/get_test_case.php new file mode 100644 index 000000000000..a326c128df01 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/get_test_case.php @@ -0,0 +1,68 @@ +/locations//agents//testCases/`. Please see + * {@see TestCasesClient::testCaseName()} for help formatting this field. + */ +function get_test_case_sample(string $formattedName): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Call the API and handle any network failures. + try { + /** @var TestCase $response */ + $response = $testCasesClient->getTestCase($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TestCasesClient::testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]'); + + get_test_case_sample($formattedName); +} +// [END dialogflow_v3_generated_TestCases_GetTestCase_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/get_test_case_result.php b/DialogflowCx/samples/V3/TestCasesClient/get_test_case_result.php new file mode 100644 index 000000000000..633520b18c8e --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/get_test_case_result.php @@ -0,0 +1,74 @@ +/locations//agents//testCases//results/`. Please see + * {@see TestCasesClient::testCaseResultName()} for help formatting this field. + */ +function get_test_case_result_sample(string $formattedName): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Call the API and handle any network failures. + try { + /** @var TestCaseResult $response */ + $response = $testCasesClient->getTestCaseResult($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TestCasesClient::testCaseResultName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[TEST_CASE]', + '[RESULT]' + ); + + get_test_case_result_sample($formattedName); +} +// [END dialogflow_v3_generated_TestCases_GetTestCaseResult_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/import_test_cases.php b/DialogflowCx/samples/V3/TestCasesClient/import_test_cases.php new file mode 100644 index 000000000000..2a25f7fed38e --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/import_test_cases.php @@ -0,0 +1,90 @@ +/locations//agents/`. Please see + * {@see TestCasesClient::agentName()} for help formatting this field. + */ +function import_test_cases_sample(string $formattedParent): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $testCasesClient->importTestCases($formattedParent); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ImportTestCasesResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + import_test_cases_sample($formattedParent); +} +// [END dialogflow_v3_generated_TestCases_ImportTestCases_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/list_locations.php b/DialogflowCx/samples/V3/TestCasesClient/list_locations.php new file mode 100644 index 000000000000..6ea271acf874 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_TestCases_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/list_test_case_results.php b/DialogflowCx/samples/V3/TestCasesClient/list_test_case_results.php new file mode 100644 index 000000000000..55908883caac --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/list_test_case_results.php @@ -0,0 +1,80 @@ +/locations//agents// + * testCases/`. Specify a `-` as a wildcard for TestCase ID to + * list results across multiple test cases. Please see + * {@see TestCasesClient::testCaseName()} for help formatting this field. + */ +function list_test_case_results_sample(string $formattedParent): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $testCasesClient->listTestCaseResults($formattedParent); + + /** @var TestCaseResult $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TestCasesClient::testCaseName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[TEST_CASE]' + ); + + list_test_case_results_sample($formattedParent); +} +// [END dialogflow_v3_generated_TestCases_ListTestCaseResults_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/list_test_cases.php b/DialogflowCx/samples/V3/TestCasesClient/list_test_cases.php new file mode 100644 index 000000000000..739c0ee9a032 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/list_test_cases.php @@ -0,0 +1,72 @@ +/locations//agents/`. Please see + * {@see TestCasesClient::agentName()} for help formatting this field. + */ +function list_test_cases_sample(string $formattedParent): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $testCasesClient->listTestCases($formattedParent); + + /** @var TestCase $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TestCasesClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_test_cases_sample($formattedParent); +} +// [END dialogflow_v3_generated_TestCases_ListTestCases_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/run_test_case.php b/DialogflowCx/samples/V3/TestCasesClient/run_test_case.php new file mode 100644 index 000000000000..a6fb009bd584 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/run_test_case.php @@ -0,0 +1,88 @@ +/locations/ /agents//testCases/`. Please see + * {@see TestCasesClient::testCaseName()} for help formatting this field. + */ +function run_test_case_sample(string $formattedName): void +{ + // Create a client. + $testCasesClient = new TestCasesClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $testCasesClient->runTestCase($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var RunTestCaseResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TestCasesClient::testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]'); + + run_test_case_sample($formattedName); +} +// [END dialogflow_v3_generated_TestCases_RunTestCase_sync] diff --git a/DialogflowCx/samples/V3/TestCasesClient/update_test_case.php b/DialogflowCx/samples/V3/TestCasesClient/update_test_case.php new file mode 100644 index 000000000000..b13a42dfe883 --- /dev/null +++ b/DialogflowCx/samples/V3/TestCasesClient/update_test_case.php @@ -0,0 +1,72 @@ +setDisplayName($testCaseDisplayName); + $updateMask = new FieldMask(); + + // Call the API and handle any network failures. + try { + /** @var TestCase $response */ + $response = $testCasesClient->updateTestCase($testCase, $updateMask); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $testCaseDisplayName = '[DISPLAY_NAME]'; + + update_test_case_sample($testCaseDisplayName); +} +// [END dialogflow_v3_generated_TestCases_UpdateTestCase_sync] diff --git a/DialogflowCx/samples/V3/TransitionRouteGroupsClient/create_transition_route_group.php b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/create_transition_route_group.php new file mode 100644 index 000000000000..dd9c109be5ab --- /dev/null +++ b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/create_transition_route_group.php @@ -0,0 +1,94 @@ +/locations//agents//flows/` + * or `projects//locations//agents/` + * for agent-level groups. Please see + * {@see TransitionRouteGroupsClient::flowName()} for help formatting this field. + * @param string $transitionRouteGroupDisplayName The human-readable name of the transition route group, unique + * within the flow. The display name can be no longer than 30 characters. + */ +function create_transition_route_group_sample( + string $formattedParent, + string $transitionRouteGroupDisplayName +): void { + // Create a client. + $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $transitionRouteGroup = (new TransitionRouteGroup()) + ->setDisplayName($transitionRouteGroupDisplayName); + + // Call the API and handle any network failures. + try { + /** @var TransitionRouteGroup $response */ + $response = $transitionRouteGroupsClient->createTransitionRouteGroup( + $formattedParent, + $transitionRouteGroup + ); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TransitionRouteGroupsClient::flowName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]' + ); + $transitionRouteGroupDisplayName = '[DISPLAY_NAME]'; + + create_transition_route_group_sample($formattedParent, $transitionRouteGroupDisplayName); +} +// [END dialogflow_v3_generated_TransitionRouteGroups_CreateTransitionRouteGroup_sync] diff --git a/DialogflowCx/samples/V3/TransitionRouteGroupsClient/delete_transition_route_group.php b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/delete_transition_route_group.php new file mode 100644 index 000000000000..dad2ce289200 --- /dev/null +++ b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/delete_transition_route_group.php @@ -0,0 +1,80 @@ +/locations//agents//flows//transitionRouteGroups/` or `projects//locations//agents//transitionRouteGroups/`. Please see + * {@see TransitionRouteGroupsClient::transitionRouteGroupName()} for help formatting this field. + */ +function delete_transition_route_group_sample(string $formattedName): void +{ + // Create a client. + $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + + // Call the API and handle any network failures. + try { + $transitionRouteGroupsClient->deleteTransitionRouteGroup($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TransitionRouteGroupsClient::transitionRouteGroupName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]', + '[TRANSITION_ROUTE_GROUP]' + ); + + delete_transition_route_group_sample($formattedName); +} +// [END dialogflow_v3_generated_TransitionRouteGroups_DeleteTransitionRouteGroup_sync] diff --git a/DialogflowCx/samples/V3/TransitionRouteGroupsClient/get_location.php b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/get_location.php new file mode 100644 index 000000000000..899f69945d3d --- /dev/null +++ b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_TransitionRouteGroups_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/TransitionRouteGroupsClient/get_transition_route_group.php b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/get_transition_route_group.php new file mode 100644 index 000000000000..47e86f74badc --- /dev/null +++ b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/get_transition_route_group.php @@ -0,0 +1,78 @@ +/locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/`. Please see + * {@see TransitionRouteGroupsClient::transitionRouteGroupName()} for help formatting this field. + */ +function get_transition_route_group_sample(string $formattedName): void +{ + // Create a client. + $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + + // Call the API and handle any network failures. + try { + /** @var TransitionRouteGroup $response */ + $response = $transitionRouteGroupsClient->getTransitionRouteGroup($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = TransitionRouteGroupsClient::transitionRouteGroupName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]', + '[TRANSITION_ROUTE_GROUP]' + ); + + get_transition_route_group_sample($formattedName); +} +// [END dialogflow_v3_generated_TransitionRouteGroups_GetTransitionRouteGroup_sync] diff --git a/DialogflowCx/samples/V3/TransitionRouteGroupsClient/list_locations.php b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/list_locations.php new file mode 100644 index 000000000000..c09e43eab405 --- /dev/null +++ b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_TransitionRouteGroups_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/TransitionRouteGroupsClient/list_transition_route_groups.php b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/list_transition_route_groups.php new file mode 100644 index 000000000000..6bd60cdca0e0 --- /dev/null +++ b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/list_transition_route_groups.php @@ -0,0 +1,79 @@ +/locations//agents//flows/` + * or `projects//locations//agents/. Please see + * {@see TransitionRouteGroupsClient::flowName()} for help formatting this field. + */ +function list_transition_route_groups_sample(string $formattedParent): void +{ + // Create a client. + $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $transitionRouteGroupsClient->listTransitionRouteGroups($formattedParent); + + /** @var TransitionRouteGroup $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = TransitionRouteGroupsClient::flowName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]' + ); + + list_transition_route_groups_sample($formattedParent); +} +// [END dialogflow_v3_generated_TransitionRouteGroups_ListTransitionRouteGroups_sync] diff --git a/DialogflowCx/samples/V3/TransitionRouteGroupsClient/update_transition_route_group.php b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/update_transition_route_group.php new file mode 100644 index 000000000000..e0ba191204a9 --- /dev/null +++ b/DialogflowCx/samples/V3/TransitionRouteGroupsClient/update_transition_route_group.php @@ -0,0 +1,75 @@ +setDisplayName($transitionRouteGroupDisplayName); + + // Call the API and handle any network failures. + try { + /** @var TransitionRouteGroup $response */ + $response = $transitionRouteGroupsClient->updateTransitionRouteGroup($transitionRouteGroup); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $transitionRouteGroupDisplayName = '[DISPLAY_NAME]'; + + update_transition_route_group_sample($transitionRouteGroupDisplayName); +} +// [END dialogflow_v3_generated_TransitionRouteGroups_UpdateTransitionRouteGroup_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/compare_versions.php b/DialogflowCx/samples/V3/VersionsClient/compare_versions.php new file mode 100644 index 000000000000..356b639c9c69 --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/compare_versions.php @@ -0,0 +1,90 @@ +/locations//agents/ + * /flows//versions/`. Please see + * {@see VersionsClient::versionName()} for help formatting this field. + * @param string $formattedTargetVersion Name of the target flow version to compare with the + * base version. Use version ID `0` to indicate the draft version of the + * specified flow. Format: `projects//locations//agents//flows//versions/`. Please see + * {@see VersionsClient::versionName()} for help formatting this field. + */ +function compare_versions_sample( + string $formattedBaseVersion, + string $formattedTargetVersion +): void { + // Create a client. + $versionsClient = new VersionsClient(); + + // Call the API and handle any network failures. + try { + /** @var CompareVersionsResponse $response */ + $response = $versionsClient->compareVersions($formattedBaseVersion, $formattedTargetVersion); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedBaseVersion = VersionsClient::versionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]', + '[VERSION]' + ); + $formattedTargetVersion = VersionsClient::versionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]', + '[VERSION]' + ); + + compare_versions_sample($formattedBaseVersion, $formattedTargetVersion); +} +// [END dialogflow_v3_generated_Versions_CompareVersions_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/create_version.php b/DialogflowCx/samples/V3/VersionsClient/create_version.php new file mode 100644 index 000000000000..fabbe2b59f80 --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/create_version.php @@ -0,0 +1,96 @@ +/locations//agents//flows/`. Please see + * {@see VersionsClient::flowName()} for help formatting this field. + * @param string $versionDisplayName The human-readable name of the version. Limit of 64 characters. + */ +function create_version_sample(string $formattedParent, string $versionDisplayName): void +{ + // Create a client. + $versionsClient = new VersionsClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $version = (new Version()) + ->setDisplayName($versionDisplayName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $versionsClient->createVersion($formattedParent, $version); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Version $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VersionsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + $versionDisplayName = '[DISPLAY_NAME]'; + + create_version_sample($formattedParent, $versionDisplayName); +} +// [END dialogflow_v3_generated_Versions_CreateVersion_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/delete_version.php b/DialogflowCx/samples/V3/VersionsClient/delete_version.php new file mode 100644 index 000000000000..b56e57b509e5 --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/delete_version.php @@ -0,0 +1,72 @@ +/locations//agents//flows//versions/`. Please see + * {@see VersionsClient::versionName()} for help formatting this field. + */ +function delete_version_sample(string $formattedName): void +{ + // Create a client. + $versionsClient = new VersionsClient(); + + // Call the API and handle any network failures. + try { + $versionsClient->deleteVersion($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VersionsClient::versionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]', + '[VERSION]' + ); + + delete_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Versions_DeleteVersion_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/get_location.php b/DialogflowCx/samples/V3/VersionsClient/get_location.php new file mode 100644 index 000000000000..440a5f88952c --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Versions_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/get_version.php b/DialogflowCx/samples/V3/VersionsClient/get_version.php new file mode 100644 index 000000000000..26af15bde8b7 --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/get_version.php @@ -0,0 +1,74 @@ +/locations//agents//flows//versions/`. Please see + * {@see VersionsClient::versionName()} for help formatting this field. + */ +function get_version_sample(string $formattedName): void +{ + // Create a client. + $versionsClient = new VersionsClient(); + + // Call the API and handle any network failures. + try { + /** @var Version $response */ + $response = $versionsClient->getVersion($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VersionsClient::versionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]', + '[VERSION]' + ); + + get_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Versions_GetVersion_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/list_locations.php b/DialogflowCx/samples/V3/VersionsClient/list_locations.php new file mode 100644 index 000000000000..777031f524f9 --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Versions_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/list_versions.php b/DialogflowCx/samples/V3/VersionsClient/list_versions.php new file mode 100644 index 000000000000..7231e7b581a4 --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/list_versions.php @@ -0,0 +1,74 @@ +/locations//agents//flows/`. Please see + * {@see VersionsClient::flowName()} for help formatting this field. + */ +function list_versions_sample(string $formattedParent): void +{ + // Create a client. + $versionsClient = new VersionsClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $versionsClient->listVersions($formattedParent); + + /** @var Version $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = VersionsClient::flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + + list_versions_sample($formattedParent); +} +// [END dialogflow_v3_generated_Versions_ListVersions_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/load_version.php b/DialogflowCx/samples/V3/VersionsClient/load_version.php new file mode 100644 index 000000000000..b4102f309c21 --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/load_version.php @@ -0,0 +1,92 @@ +/locations//agents//flows//versions/`. Please see + * {@see VersionsClient::versionName()} for help formatting this field. + */ +function load_version_sample(string $formattedName): void +{ + // Create a client. + $versionsClient = new VersionsClient(); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $versionsClient->loadVersion($formattedName); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + printf('Operation completed successfully.' . PHP_EOL); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = VersionsClient::versionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[FLOW]', + '[VERSION]' + ); + + load_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Versions_LoadVersion_sync] diff --git a/DialogflowCx/samples/V3/VersionsClient/update_version.php b/DialogflowCx/samples/V3/VersionsClient/update_version.php new file mode 100644 index 000000000000..743606142ab9 --- /dev/null +++ b/DialogflowCx/samples/V3/VersionsClient/update_version.php @@ -0,0 +1,71 @@ +setDisplayName($versionDisplayName); + $updateMask = new FieldMask(); + + // Call the API and handle any network failures. + try { + /** @var Version $response */ + $response = $versionsClient->updateVersion($version, $updateMask); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $versionDisplayName = '[DISPLAY_NAME]'; + + update_version_sample($versionDisplayName); +} +// [END dialogflow_v3_generated_Versions_UpdateVersion_sync] diff --git a/DialogflowCx/samples/V3/WebhooksClient/create_webhook.php b/DialogflowCx/samples/V3/WebhooksClient/create_webhook.php new file mode 100644 index 000000000000..72bdc0670a54 --- /dev/null +++ b/DialogflowCx/samples/V3/WebhooksClient/create_webhook.php @@ -0,0 +1,73 @@ +/locations//agents/`. Please see + * {@see WebhooksClient::agentName()} for help formatting this field. + * @param string $webhookDisplayName The human-readable name of the webhook, unique within the agent. + */ +function create_webhook_sample(string $formattedParent, string $webhookDisplayName): void +{ + // Create a client. + $webhooksClient = new WebhooksClient(); + + // Prepare any non-scalar elements to be passed along with the request. + $webhook = (new Webhook()) + ->setDisplayName($webhookDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Webhook $response */ + $response = $webhooksClient->createWebhook($formattedParent, $webhook); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebhooksClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $webhookDisplayName = '[DISPLAY_NAME]'; + + create_webhook_sample($formattedParent, $webhookDisplayName); +} +// [END dialogflow_v3_generated_Webhooks_CreateWebhook_sync] diff --git a/DialogflowCx/samples/V3/WebhooksClient/delete_webhook.php b/DialogflowCx/samples/V3/WebhooksClient/delete_webhook.php new file mode 100644 index 000000000000..c2b898eb57c0 --- /dev/null +++ b/DialogflowCx/samples/V3/WebhooksClient/delete_webhook.php @@ -0,0 +1,66 @@ +/locations//agents//webhooks/`. Please see + * {@see WebhooksClient::webhookName()} for help formatting this field. + */ +function delete_webhook_sample(string $formattedName): void +{ + // Create a client. + $webhooksClient = new WebhooksClient(); + + // Call the API and handle any network failures. + try { + $webhooksClient->deleteWebhook($formattedName); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WebhooksClient::webhookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[WEBHOOK]'); + + delete_webhook_sample($formattedName); +} +// [END dialogflow_v3_generated_Webhooks_DeleteWebhook_sync] diff --git a/DialogflowCx/samples/V3/WebhooksClient/get_location.php b/DialogflowCx/samples/V3/WebhooksClient/get_location.php new file mode 100644 index 000000000000..1ed4dccc7543 --- /dev/null +++ b/DialogflowCx/samples/V3/WebhooksClient/get_location.php @@ -0,0 +1,53 @@ +getLocation(); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Webhooks_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/WebhooksClient/get_webhook.php b/DialogflowCx/samples/V3/WebhooksClient/get_webhook.php new file mode 100644 index 000000000000..450787c35bfe --- /dev/null +++ b/DialogflowCx/samples/V3/WebhooksClient/get_webhook.php @@ -0,0 +1,68 @@ +/locations//agents//webhooks/`. Please see + * {@see WebhooksClient::webhookName()} for help formatting this field. + */ +function get_webhook_sample(string $formattedName): void +{ + // Create a client. + $webhooksClient = new WebhooksClient(); + + // Call the API and handle any network failures. + try { + /** @var Webhook $response */ + $response = $webhooksClient->getWebhook($formattedName); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = WebhooksClient::webhookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[WEBHOOK]'); + + get_webhook_sample($formattedName); +} +// [END dialogflow_v3_generated_Webhooks_GetWebhook_sync] diff --git a/DialogflowCx/samples/V3/WebhooksClient/list_locations.php b/DialogflowCx/samples/V3/WebhooksClient/list_locations.php new file mode 100644 index 000000000000..c4d350911da0 --- /dev/null +++ b/DialogflowCx/samples/V3/WebhooksClient/list_locations.php @@ -0,0 +1,58 @@ +listLocations(); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Webhooks_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/WebhooksClient/list_webhooks.php b/DialogflowCx/samples/V3/WebhooksClient/list_webhooks.php new file mode 100644 index 000000000000..c29d65d1cb4f --- /dev/null +++ b/DialogflowCx/samples/V3/WebhooksClient/list_webhooks.php @@ -0,0 +1,72 @@ +/locations//agents/`. Please see + * {@see WebhooksClient::agentName()} for help formatting this field. + */ +function list_webhooks_sample(string $formattedParent): void +{ + // Create a client. + $webhooksClient = new WebhooksClient(); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $webhooksClient->listWebhooks($formattedParent); + + /** @var Webhook $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = WebhooksClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_webhooks_sample($formattedParent); +} +// [END dialogflow_v3_generated_Webhooks_ListWebhooks_sync] diff --git a/DialogflowCx/samples/V3/WebhooksClient/update_webhook.php b/DialogflowCx/samples/V3/WebhooksClient/update_webhook.php new file mode 100644 index 000000000000..4520515ef93c --- /dev/null +++ b/DialogflowCx/samples/V3/WebhooksClient/update_webhook.php @@ -0,0 +1,69 @@ +setDisplayName($webhookDisplayName); + + // Call the API and handle any network failures. + try { + /** @var Webhook $response */ + $response = $webhooksClient->updateWebhook($webhook); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $webhookDisplayName = '[DISPLAY_NAME]'; + + update_webhook_sample($webhookDisplayName); +} +// [END dialogflow_v3_generated_Webhooks_UpdateWebhook_sync] diff --git a/DialogflowCx/src/V3/AdvancedSettings.php b/DialogflowCx/src/V3/AdvancedSettings.php new file mode 100644 index 000000000000..efe22330ada5 --- /dev/null +++ b/DialogflowCx/src/V3/AdvancedSettings.php @@ -0,0 +1,225 @@ +Flow->Page->Fulfillment/Parameter. + * + * Generated from protobuf message google.cloud.dialogflow.cx.v3.AdvancedSettings + */ +class AdvancedSettings extends \Google\Protobuf\Internal\Message +{ + /** + * If present, incoming audio is exported by Dialogflow to the configured + * Google Cloud Storage destination. + * Exposed at the following levels: + * - Agent level + * - Flow level + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GcsDestination audio_export_gcs_destination = 2; + */ + protected $audio_export_gcs_destination = null; + /** + * Settings for DTMF. + * Exposed at the following levels: + * - Agent level + * - Flow level + * - Page level + * - Parameter level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings.DtmfSettings dtmf_settings = 5; + */ + protected $dtmf_settings = null; + /** + * Settings for logging. + * Settings for Dialogflow History, Contact Center messages, StackDriver logs, + * and speech logging. + * Exposed at the following levels: + * - Agent level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettings logging_settings = 6; + */ + protected $logging_settings = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\GcsDestination $audio_export_gcs_destination + * If present, incoming audio is exported by Dialogflow to the configured + * Google Cloud Storage destination. + * Exposed at the following levels: + * - Agent level + * - Flow level + * @type \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings\DtmfSettings $dtmf_settings + * Settings for DTMF. + * Exposed at the following levels: + * - Agent level + * - Flow level + * - Page level + * - Parameter level. + * @type \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings\LoggingSettings $logging_settings + * Settings for logging. + * Settings for Dialogflow History, Contact Center messages, StackDriver logs, + * and speech logging. + * Exposed at the following levels: + * - Agent level. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::initOnce(); + parent::__construct($data); + } + + /** + * If present, incoming audio is exported by Dialogflow to the configured + * Google Cloud Storage destination. + * Exposed at the following levels: + * - Agent level + * - Flow level + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GcsDestination audio_export_gcs_destination = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\GcsDestination|null + */ + public function getAudioExportGcsDestination() + { + return $this->audio_export_gcs_destination; + } + + public function hasAudioExportGcsDestination() + { + return isset($this->audio_export_gcs_destination); + } + + public function clearAudioExportGcsDestination() + { + unset($this->audio_export_gcs_destination); + } + + /** + * If present, incoming audio is exported by Dialogflow to the configured + * Google Cloud Storage destination. + * Exposed at the following levels: + * - Agent level + * - Flow level + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GcsDestination audio_export_gcs_destination = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\GcsDestination $var + * @return $this + */ + public function setAudioExportGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\GcsDestination::class); + $this->audio_export_gcs_destination = $var; + + return $this; + } + + /** + * Settings for DTMF. + * Exposed at the following levels: + * - Agent level + * - Flow level + * - Page level + * - Parameter level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings.DtmfSettings dtmf_settings = 5; + * @return \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings\DtmfSettings|null + */ + public function getDtmfSettings() + { + return $this->dtmf_settings; + } + + public function hasDtmfSettings() + { + return isset($this->dtmf_settings); + } + + public function clearDtmfSettings() + { + unset($this->dtmf_settings); + } + + /** + * Settings for DTMF. + * Exposed at the following levels: + * - Agent level + * - Flow level + * - Page level + * - Parameter level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings.DtmfSettings dtmf_settings = 5; + * @param \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings\DtmfSettings $var + * @return $this + */ + public function setDtmfSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings\DtmfSettings::class); + $this->dtmf_settings = $var; + + return $this; + } + + /** + * Settings for logging. + * Settings for Dialogflow History, Contact Center messages, StackDriver logs, + * and speech logging. + * Exposed at the following levels: + * - Agent level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettings logging_settings = 6; + * @return \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings\LoggingSettings|null + */ + public function getLoggingSettings() + { + return $this->logging_settings; + } + + public function hasLoggingSettings() + { + return isset($this->logging_settings); + } + + public function clearLoggingSettings() + { + unset($this->logging_settings); + } + + /** + * Settings for logging. + * Settings for Dialogflow History, Contact Center messages, StackDriver logs, + * and speech logging. + * Exposed at the following levels: + * - Agent level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettings logging_settings = 6; + * @param \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings\LoggingSettings $var + * @return $this + */ + public function setLoggingSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings\LoggingSettings::class); + $this->logging_settings = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/AdvancedSettings/DtmfSettings.php b/DialogflowCx/src/V3/AdvancedSettings/DtmfSettings.php new file mode 100644 index 000000000000..0b5d912a9773 --- /dev/null +++ b/DialogflowCx/src/V3/AdvancedSettings/DtmfSettings.php @@ -0,0 +1,156 @@ +google.cloud.dialogflow.cx.v3.AdvancedSettings.DtmfSettings + */ +class DtmfSettings extends \Google\Protobuf\Internal\Message +{ + /** + * If true, incoming audio is processed for DTMF (dual tone multi frequency) + * events. For example, if the caller presses a button on their telephone + * keypad and DTMF processing is enabled, Dialogflow will detect the + * event (e.g. a "3" was pressed) in the incoming audio and pass the event + * to the bot to drive business logic (e.g. when 3 is pressed, return the + * account balance). + * + * Generated from protobuf field bool enabled = 1; + */ + protected $enabled = false; + /** + * Max length of DTMF digits. + * + * Generated from protobuf field int32 max_digits = 2; + */ + protected $max_digits = 0; + /** + * The digit that terminates a DTMF digit sequence. + * + * Generated from protobuf field string finish_digit = 3; + */ + protected $finish_digit = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * If true, incoming audio is processed for DTMF (dual tone multi frequency) + * events. For example, if the caller presses a button on their telephone + * keypad and DTMF processing is enabled, Dialogflow will detect the + * event (e.g. a "3" was pressed) in the incoming audio and pass the event + * to the bot to drive business logic (e.g. when 3 is pressed, return the + * account balance). + * @type int $max_digits + * Max length of DTMF digits. + * @type string $finish_digit + * The digit that terminates a DTMF digit sequence. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::initOnce(); + parent::__construct($data); + } + + /** + * If true, incoming audio is processed for DTMF (dual tone multi frequency) + * events. For example, if the caller presses a button on their telephone + * keypad and DTMF processing is enabled, Dialogflow will detect the + * event (e.g. a "3" was pressed) in the incoming audio and pass the event + * to the bot to drive business logic (e.g. when 3 is pressed, return the + * account balance). + * + * Generated from protobuf field bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * If true, incoming audio is processed for DTMF (dual tone multi frequency) + * events. For example, if the caller presses a button on their telephone + * keypad and DTMF processing is enabled, Dialogflow will detect the + * event (e.g. a "3" was pressed) in the incoming audio and pass the event + * to the bot to drive business logic (e.g. when 3 is pressed, return the + * account balance). + * + * Generated from protobuf field bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * Max length of DTMF digits. + * + * Generated from protobuf field int32 max_digits = 2; + * @return int + */ + public function getMaxDigits() + { + return $this->max_digits; + } + + /** + * Max length of DTMF digits. + * + * Generated from protobuf field int32 max_digits = 2; + * @param int $var + * @return $this + */ + public function setMaxDigits($var) + { + GPBUtil::checkInt32($var); + $this->max_digits = $var; + + return $this; + } + + /** + * The digit that terminates a DTMF digit sequence. + * + * Generated from protobuf field string finish_digit = 3; + * @return string + */ + public function getFinishDigit() + { + return $this->finish_digit; + } + + /** + * The digit that terminates a DTMF digit sequence. + * + * Generated from protobuf field string finish_digit = 3; + * @param string $var + * @return $this + */ + public function setFinishDigit($var) + { + GPBUtil::checkString($var, True); + $this->finish_digit = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/AdvancedSettings/LoggingSettings.php b/DialogflowCx/src/V3/AdvancedSettings/LoggingSettings.php new file mode 100644 index 000000000000..217364b71858 --- /dev/null +++ b/DialogflowCx/src/V3/AdvancedSettings/LoggingSettings.php @@ -0,0 +1,102 @@ +google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettings + */ +class LoggingSettings extends \Google\Protobuf\Internal\Message +{ + /** + * If true, StackDriver logging is currently enabled. + * + * Generated from protobuf field bool enable_stackdriver_logging = 2; + */ + protected $enable_stackdriver_logging = false; + /** + * If true, DF Interaction logging is currently enabled. + * + * Generated from protobuf field bool enable_interaction_logging = 3; + */ + protected $enable_interaction_logging = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable_stackdriver_logging + * If true, StackDriver logging is currently enabled. + * @type bool $enable_interaction_logging + * If true, DF Interaction logging is currently enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::initOnce(); + parent::__construct($data); + } + + /** + * If true, StackDriver logging is currently enabled. + * + * Generated from protobuf field bool enable_stackdriver_logging = 2; + * @return bool + */ + public function getEnableStackdriverLogging() + { + return $this->enable_stackdriver_logging; + } + + /** + * If true, StackDriver logging is currently enabled. + * + * Generated from protobuf field bool enable_stackdriver_logging = 2; + * @param bool $var + * @return $this + */ + public function setEnableStackdriverLogging($var) + { + GPBUtil::checkBool($var); + $this->enable_stackdriver_logging = $var; + + return $this; + } + + /** + * If true, DF Interaction logging is currently enabled. + * + * Generated from protobuf field bool enable_interaction_logging = 3; + * @return bool + */ + public function getEnableInteractionLogging() + { + return $this->enable_interaction_logging; + } + + /** + * If true, DF Interaction logging is currently enabled. + * + * Generated from protobuf field bool enable_interaction_logging = 3; + * @param bool $var + * @return $this + */ + public function setEnableInteractionLogging($var) + { + GPBUtil::checkBool($var); + $this->enable_interaction_logging = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Agent.php b/DialogflowCx/src/V3/Agent.php new file mode 100644 index 000000000000..d336090e9cc5 --- /dev/null +++ b/DialogflowCx/src/V3/Agent.php @@ -0,0 +1,805 @@ +google.cloud.dialogflow.cx.v3.Agent + */ +class Agent extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the agent. + * Required for the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * [Agents.CreateAgent][google.cloud.dialogflow.cx.v3.Agents.CreateAgent] + * populates the name automatically. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the agent, unique within the location. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Required. Immutable. The default language of the agent as a language tag. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * This field cannot be set by the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * + * Generated from protobuf field string default_language_code = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $default_language_code = ''; + /** + * The list of all languages supported by the agent (except for the + * `default_language_code`). + * + * Generated from protobuf field repeated string supported_language_codes = 4; + */ + private $supported_language_codes; + /** + * Required. The time zone of the agent from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. + * + * Generated from protobuf field string time_zone = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $time_zone = ''; + /** + * The description of the agent. The maximum length is 500 characters. If + * exceeded, the request is rejected. + * + * Generated from protobuf field string description = 6; + */ + protected $description = ''; + /** + * The URI of the agent's avatar. Avatars are used throughout the Dialogflow + * console and in the self-hosted [Web + * Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + * integration. + * + * Generated from protobuf field string avatar_uri = 7; + */ + protected $avatar_uri = ''; + /** + * Speech recognition related settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SpeechToTextSettings speech_to_text_settings = 13; + */ + protected $speech_to_text_settings = null; + /** + * Immutable. Name of the start flow in this agent. A start flow will be + * automatically created when the agent is created, and can only be deleted by + * deleting the agent. Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string start_flow = 16 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + */ + protected $start_flow = ''; + /** + * Name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] + * reference for the agent. Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string security_settings = 17 [(.google.api.resource_reference) = { + */ + protected $security_settings = ''; + /** + * Indicates if stackdriver logging is enabled for the agent. + * Please use + * [agent.advanced_settings][google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettings] + * instead. + * + * Generated from protobuf field bool enable_stackdriver_logging = 18 [deprecated = true]; + * @deprecated + */ + protected $enable_stackdriver_logging = false; + /** + * Indicates if automatic spell correction is enabled in detect intent + * requests. + * + * Generated from protobuf field bool enable_spell_correction = 20; + */ + protected $enable_spell_correction = false; + /** + * Indicates whether the agent is locked for changes. If the agent is locked, + * modifications to the agent will be rejected except for [RestoreAgent][]. + * + * Generated from protobuf field bool locked = 27; + */ + protected $locked = false; + /** + * Hierarchical advanced settings for this agent. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 22; + */ + protected $advanced_settings = null; + /** + * Git integration settings for this agent. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Agent.GitIntegrationSettings git_integration_settings = 30; + */ + protected $git_integration_settings = null; + /** + * Settings on instructing the speech synthesizer on how to generate the + * output audio content. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TextToSpeechSettings text_to_speech_settings = 31; + */ + protected $text_to_speech_settings = null; + /** + * Gen App Builder-related agent-level settings. + * + * Generated from protobuf field optional .google.cloud.dialogflow.cx.v3.Agent.GenAppBuilderSettings gen_app_builder_settings = 33; + */ + protected $gen_app_builder_settings = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the agent. + * Required for the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * [Agents.CreateAgent][google.cloud.dialogflow.cx.v3.Agents.CreateAgent] + * populates the name automatically. + * Format: `projects//locations//agents/`. + * @type string $display_name + * Required. The human-readable name of the agent, unique within the location. + * @type string $default_language_code + * Required. Immutable. The default language of the agent as a language tag. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * This field cannot be set by the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * @type array|\Google\Protobuf\Internal\RepeatedField $supported_language_codes + * The list of all languages supported by the agent (except for the + * `default_language_code`). + * @type string $time_zone + * Required. The time zone of the agent from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. + * @type string $description + * The description of the agent. The maximum length is 500 characters. If + * exceeded, the request is rejected. + * @type string $avatar_uri + * The URI of the agent's avatar. Avatars are used throughout the Dialogflow + * console and in the self-hosted [Web + * Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + * integration. + * @type \Google\Cloud\Dialogflow\Cx\V3\SpeechToTextSettings $speech_to_text_settings + * Speech recognition related settings. + * @type string $start_flow + * Immutable. Name of the start flow in this agent. A start flow will be + * automatically created when the agent is created, and can only be deleted by + * deleting the agent. Format: `projects//locations//agents//flows/`. + * @type string $security_settings + * Name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] + * reference for the agent. Format: `projects//locations//securitySettings/`. + * @type bool $enable_stackdriver_logging + * Indicates if stackdriver logging is enabled for the agent. + * Please use + * [agent.advanced_settings][google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettings] + * instead. + * @type bool $enable_spell_correction + * Indicates if automatic spell correction is enabled in detect intent + * requests. + * @type bool $locked + * Indicates whether the agent is locked for changes. If the agent is locked, + * modifications to the agent will be rejected except for [RestoreAgent][]. + * @type \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $advanced_settings + * Hierarchical advanced settings for this agent. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * @type \Google\Cloud\Dialogflow\Cx\V3\Agent\GitIntegrationSettings $git_integration_settings + * Git integration settings for this agent. + * @type \Google\Cloud\Dialogflow\Cx\V3\TextToSpeechSettings $text_to_speech_settings + * Settings on instructing the speech synthesizer on how to generate the + * output audio content. + * @type \Google\Cloud\Dialogflow\Cx\V3\Agent\GenAppBuilderSettings $gen_app_builder_settings + * Gen App Builder-related agent-level settings. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the agent. + * Required for the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * [Agents.CreateAgent][google.cloud.dialogflow.cx.v3.Agents.CreateAgent] + * populates the name automatically. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the agent. + * Required for the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * [Agents.CreateAgent][google.cloud.dialogflow.cx.v3.Agents.CreateAgent] + * populates the name automatically. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the agent, unique within the location. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the agent, unique within the location. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. Immutable. The default language of the agent as a language tag. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * This field cannot be set by the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * + * Generated from protobuf field string default_language_code = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getDefaultLanguageCode() + { + return $this->default_language_code; + } + + /** + * Required. Immutable. The default language of the agent as a language tag. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * This field cannot be set by the + * [Agents.UpdateAgent][google.cloud.dialogflow.cx.v3.Agents.UpdateAgent] + * method. + * + * Generated from protobuf field string default_language_code = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setDefaultLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->default_language_code = $var; + + return $this; + } + + /** + * The list of all languages supported by the agent (except for the + * `default_language_code`). + * + * Generated from protobuf field repeated string supported_language_codes = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSupportedLanguageCodes() + { + return $this->supported_language_codes; + } + + /** + * The list of all languages supported by the agent (except for the + * `default_language_code`). + * + * Generated from protobuf field repeated string supported_language_codes = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSupportedLanguageCodes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->supported_language_codes = $arr; + + return $this; + } + + /** + * Required. The time zone of the agent from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. + * + * Generated from protobuf field string time_zone = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTimeZone() + { + return $this->time_zone; + } + + /** + * Required. The time zone of the agent from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. + * + * Generated from protobuf field string time_zone = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTimeZone($var) + { + GPBUtil::checkString($var, True); + $this->time_zone = $var; + + return $this; + } + + /** + * The description of the agent. The maximum length is 500 characters. If + * exceeded, the request is rejected. + * + * Generated from protobuf field string description = 6; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the agent. The maximum length is 500 characters. If + * exceeded, the request is rejected. + * + * Generated from protobuf field string description = 6; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The URI of the agent's avatar. Avatars are used throughout the Dialogflow + * console and in the self-hosted [Web + * Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + * integration. + * + * Generated from protobuf field string avatar_uri = 7; + * @return string + */ + public function getAvatarUri() + { + return $this->avatar_uri; + } + + /** + * The URI of the agent's avatar. Avatars are used throughout the Dialogflow + * console and in the self-hosted [Web + * Demo](https://cloud.google.com/dialogflow/docs/integrations/web-demo) + * integration. + * + * Generated from protobuf field string avatar_uri = 7; + * @param string $var + * @return $this + */ + public function setAvatarUri($var) + { + GPBUtil::checkString($var, True); + $this->avatar_uri = $var; + + return $this; + } + + /** + * Speech recognition related settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SpeechToTextSettings speech_to_text_settings = 13; + * @return \Google\Cloud\Dialogflow\Cx\V3\SpeechToTextSettings|null + */ + public function getSpeechToTextSettings() + { + return $this->speech_to_text_settings; + } + + public function hasSpeechToTextSettings() + { + return isset($this->speech_to_text_settings); + } + + public function clearSpeechToTextSettings() + { + unset($this->speech_to_text_settings); + } + + /** + * Speech recognition related settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SpeechToTextSettings speech_to_text_settings = 13; + * @param \Google\Cloud\Dialogflow\Cx\V3\SpeechToTextSettings $var + * @return $this + */ + public function setSpeechToTextSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SpeechToTextSettings::class); + $this->speech_to_text_settings = $var; + + return $this; + } + + /** + * Immutable. Name of the start flow in this agent. A start flow will be + * automatically created when the agent is created, and can only be deleted by + * deleting the agent. Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string start_flow = 16 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @return string + */ + public function getStartFlow() + { + return $this->start_flow; + } + + /** + * Immutable. Name of the start flow in this agent. A start flow will be + * automatically created when the agent is created, and can only be deleted by + * deleting the agent. Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string start_flow = 16 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setStartFlow($var) + { + GPBUtil::checkString($var, True); + $this->start_flow = $var; + + return $this; + } + + /** + * Name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] + * reference for the agent. Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string security_settings = 17 [(.google.api.resource_reference) = { + * @return string + */ + public function getSecuritySettings() + { + return $this->security_settings; + } + + /** + * Name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] + * reference for the agent. Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string security_settings = 17 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecuritySettings($var) + { + GPBUtil::checkString($var, True); + $this->security_settings = $var; + + return $this; + } + + /** + * Indicates if stackdriver logging is enabled for the agent. + * Please use + * [agent.advanced_settings][google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettings] + * instead. + * + * Generated from protobuf field bool enable_stackdriver_logging = 18 [deprecated = true]; + * @return bool + * @deprecated + */ + public function getEnableStackdriverLogging() + { + @trigger_error('enable_stackdriver_logging is deprecated.', E_USER_DEPRECATED); + return $this->enable_stackdriver_logging; + } + + /** + * Indicates if stackdriver logging is enabled for the agent. + * Please use + * [agent.advanced_settings][google.cloud.dialogflow.cx.v3.AdvancedSettings.LoggingSettings] + * instead. + * + * Generated from protobuf field bool enable_stackdriver_logging = 18 [deprecated = true]; + * @param bool $var + * @return $this + * @deprecated + */ + public function setEnableStackdriverLogging($var) + { + @trigger_error('enable_stackdriver_logging is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkBool($var); + $this->enable_stackdriver_logging = $var; + + return $this; + } + + /** + * Indicates if automatic spell correction is enabled in detect intent + * requests. + * + * Generated from protobuf field bool enable_spell_correction = 20; + * @return bool + */ + public function getEnableSpellCorrection() + { + return $this->enable_spell_correction; + } + + /** + * Indicates if automatic spell correction is enabled in detect intent + * requests. + * + * Generated from protobuf field bool enable_spell_correction = 20; + * @param bool $var + * @return $this + */ + public function setEnableSpellCorrection($var) + { + GPBUtil::checkBool($var); + $this->enable_spell_correction = $var; + + return $this; + } + + /** + * Indicates whether the agent is locked for changes. If the agent is locked, + * modifications to the agent will be rejected except for [RestoreAgent][]. + * + * Generated from protobuf field bool locked = 27; + * @return bool + */ + public function getLocked() + { + return $this->locked; + } + + /** + * Indicates whether the agent is locked for changes. If the agent is locked, + * modifications to the agent will be rejected except for [RestoreAgent][]. + * + * Generated from protobuf field bool locked = 27; + * @param bool $var + * @return $this + */ + public function setLocked($var) + { + GPBUtil::checkBool($var); + $this->locked = $var; + + return $this; + } + + /** + * Hierarchical advanced settings for this agent. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 22; + * @return \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings|null + */ + public function getAdvancedSettings() + { + return $this->advanced_settings; + } + + public function hasAdvancedSettings() + { + return isset($this->advanced_settings); + } + + public function clearAdvancedSettings() + { + unset($this->advanced_settings); + } + + /** + * Hierarchical advanced settings for this agent. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 22; + * @param \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $var + * @return $this + */ + public function setAdvancedSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::class); + $this->advanced_settings = $var; + + return $this; + } + + /** + * Git integration settings for this agent. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Agent.GitIntegrationSettings git_integration_settings = 30; + * @return \Google\Cloud\Dialogflow\Cx\V3\Agent\GitIntegrationSettings|null + */ + public function getGitIntegrationSettings() + { + return $this->git_integration_settings; + } + + public function hasGitIntegrationSettings() + { + return isset($this->git_integration_settings); + } + + public function clearGitIntegrationSettings() + { + unset($this->git_integration_settings); + } + + /** + * Git integration settings for this agent. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Agent.GitIntegrationSettings git_integration_settings = 30; + * @param \Google\Cloud\Dialogflow\Cx\V3\Agent\GitIntegrationSettings $var + * @return $this + */ + public function setGitIntegrationSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Agent\GitIntegrationSettings::class); + $this->git_integration_settings = $var; + + return $this; + } + + /** + * Settings on instructing the speech synthesizer on how to generate the + * output audio content. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TextToSpeechSettings text_to_speech_settings = 31; + * @return \Google\Cloud\Dialogflow\Cx\V3\TextToSpeechSettings|null + */ + public function getTextToSpeechSettings() + { + return $this->text_to_speech_settings; + } + + public function hasTextToSpeechSettings() + { + return isset($this->text_to_speech_settings); + } + + public function clearTextToSpeechSettings() + { + unset($this->text_to_speech_settings); + } + + /** + * Settings on instructing the speech synthesizer on how to generate the + * output audio content. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TextToSpeechSettings text_to_speech_settings = 31; + * @param \Google\Cloud\Dialogflow\Cx\V3\TextToSpeechSettings $var + * @return $this + */ + public function setTextToSpeechSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TextToSpeechSettings::class); + $this->text_to_speech_settings = $var; + + return $this; + } + + /** + * Gen App Builder-related agent-level settings. + * + * Generated from protobuf field optional .google.cloud.dialogflow.cx.v3.Agent.GenAppBuilderSettings gen_app_builder_settings = 33; + * @return \Google\Cloud\Dialogflow\Cx\V3\Agent\GenAppBuilderSettings|null + */ + public function getGenAppBuilderSettings() + { + return $this->gen_app_builder_settings; + } + + public function hasGenAppBuilderSettings() + { + return isset($this->gen_app_builder_settings); + } + + public function clearGenAppBuilderSettings() + { + unset($this->gen_app_builder_settings); + } + + /** + * Gen App Builder-related agent-level settings. + * + * Generated from protobuf field optional .google.cloud.dialogflow.cx.v3.Agent.GenAppBuilderSettings gen_app_builder_settings = 33; + * @param \Google\Cloud\Dialogflow\Cx\V3\Agent\GenAppBuilderSettings $var + * @return $this + */ + public function setGenAppBuilderSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Agent\GenAppBuilderSettings::class); + $this->gen_app_builder_settings = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Agent/GenAppBuilderSettings.php b/DialogflowCx/src/V3/Agent/GenAppBuilderSettings.php new file mode 100644 index 000000000000..e26188cd47ce --- /dev/null +++ b/DialogflowCx/src/V3/Agent/GenAppBuilderSettings.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.Agent.GenAppBuilderSettings + */ +class GenAppBuilderSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The full name of the Gen App Builder engine related to this + * agent if there is one. Format: `projects/{Project ID}/locations/{Location + * ID}/collections/{Collection ID}/engines/{Engine ID}` + * + * Generated from protobuf field string engine = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $engine = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $engine + * Required. The full name of the Gen App Builder engine related to this + * agent if there is one. Format: `projects/{Project ID}/locations/{Location + * ID}/collections/{Collection ID}/engines/{Engine ID}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The full name of the Gen App Builder engine related to this + * agent if there is one. Format: `projects/{Project ID}/locations/{Location + * ID}/collections/{Collection ID}/engines/{Engine ID}` + * + * Generated from protobuf field string engine = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEngine() + { + return $this->engine; + } + + /** + * Required. The full name of the Gen App Builder engine related to this + * agent if there is one. Format: `projects/{Project ID}/locations/{Location + * ID}/collections/{Collection ID}/engines/{Engine ID}` + * + * Generated from protobuf field string engine = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEngine($var) + { + GPBUtil::checkString($var, True); + $this->engine = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Agent/GitIntegrationSettings.php b/DialogflowCx/src/V3/Agent/GitIntegrationSettings.php new file mode 100644 index 000000000000..7f23c07067aa --- /dev/null +++ b/DialogflowCx/src/V3/Agent/GitIntegrationSettings.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.Agent.GitIntegrationSettings + */ +class GitIntegrationSettings extends \Google\Protobuf\Internal\Message +{ + protected $git_settings; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Agent\GitIntegrationSettings\GithubSettings $github_settings + * GitHub settings. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * GitHub settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Agent.GitIntegrationSettings.GithubSettings github_settings = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\Agent\GitIntegrationSettings\GithubSettings|null + */ + public function getGithubSettings() + { + return $this->readOneof(1); + } + + public function hasGithubSettings() + { + return $this->hasOneof(1); + } + + /** + * GitHub settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Agent.GitIntegrationSettings.GithubSettings github_settings = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\Agent\GitIntegrationSettings\GithubSettings $var + * @return $this + */ + public function setGithubSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Agent\GitIntegrationSettings\GithubSettings::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getGitSettings() + { + return $this->whichOneof("git_settings"); + } + +} + + diff --git a/DialogflowCx/src/V3/Agent/GitIntegrationSettings/GithubSettings.php b/DialogflowCx/src/V3/Agent/GitIntegrationSettings/GithubSettings.php new file mode 100644 index 000000000000..70f58899afa2 --- /dev/null +++ b/DialogflowCx/src/V3/Agent/GitIntegrationSettings/GithubSettings.php @@ -0,0 +1,208 @@ +google.cloud.dialogflow.cx.v3.Agent.GitIntegrationSettings.GithubSettings + */ +class GithubSettings extends \Google\Protobuf\Internal\Message +{ + /** + * The unique repository display name for the GitHub repository. + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + /** + * The GitHub repository URI related to the agent. + * + * Generated from protobuf field string repository_uri = 2; + */ + protected $repository_uri = ''; + /** + * The branch of the GitHub repository tracked for this agent. + * + * Generated from protobuf field string tracking_branch = 3; + */ + protected $tracking_branch = ''; + /** + * The access token used to authenticate the access to the GitHub + * repository. + * + * Generated from protobuf field string access_token = 4; + */ + protected $access_token = ''; + /** + * A list of branches configured to be used from Dialogflow. + * + * Generated from protobuf field repeated string branches = 5; + */ + private $branches; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * The unique repository display name for the GitHub repository. + * @type string $repository_uri + * The GitHub repository URI related to the agent. + * @type string $tracking_branch + * The branch of the GitHub repository tracked for this agent. + * @type string $access_token + * The access token used to authenticate the access to the GitHub + * repository. + * @type array|\Google\Protobuf\Internal\RepeatedField $branches + * A list of branches configured to be used from Dialogflow. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * The unique repository display name for the GitHub repository. + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The unique repository display name for the GitHub repository. + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The GitHub repository URI related to the agent. + * + * Generated from protobuf field string repository_uri = 2; + * @return string + */ + public function getRepositoryUri() + { + return $this->repository_uri; + } + + /** + * The GitHub repository URI related to the agent. + * + * Generated from protobuf field string repository_uri = 2; + * @param string $var + * @return $this + */ + public function setRepositoryUri($var) + { + GPBUtil::checkString($var, True); + $this->repository_uri = $var; + + return $this; + } + + /** + * The branch of the GitHub repository tracked for this agent. + * + * Generated from protobuf field string tracking_branch = 3; + * @return string + */ + public function getTrackingBranch() + { + return $this->tracking_branch; + } + + /** + * The branch of the GitHub repository tracked for this agent. + * + * Generated from protobuf field string tracking_branch = 3; + * @param string $var + * @return $this + */ + public function setTrackingBranch($var) + { + GPBUtil::checkString($var, True); + $this->tracking_branch = $var; + + return $this; + } + + /** + * The access token used to authenticate the access to the GitHub + * repository. + * + * Generated from protobuf field string access_token = 4; + * @return string + */ + public function getAccessToken() + { + return $this->access_token; + } + + /** + * The access token used to authenticate the access to the GitHub + * repository. + * + * Generated from protobuf field string access_token = 4; + * @param string $var + * @return $this + */ + public function setAccessToken($var) + { + GPBUtil::checkString($var, True); + $this->access_token = $var; + + return $this; + } + + /** + * A list of branches configured to be used from Dialogflow. + * + * Generated from protobuf field repeated string branches = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBranches() + { + return $this->branches; + } + + /** + * A list of branches configured to be used from Dialogflow. + * + * Generated from protobuf field repeated string branches = 5; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBranches($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->branches = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/AgentValidationResult.php b/DialogflowCx/src/V3/AgentValidationResult.php new file mode 100644 index 000000000000..db66f3142df8 --- /dev/null +++ b/DialogflowCx/src/V3/AgentValidationResult.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.AgentValidationResult + */ +class AgentValidationResult extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the agent validation result. + * Format: `projects//locations//agents//validationResult`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Contains all flow validation results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.FlowValidationResult flow_validation_results = 2; + */ + private $flow_validation_results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the agent validation result. + * Format: `projects//locations//agents//validationResult`. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\FlowValidationResult>|\Google\Protobuf\Internal\RepeatedField $flow_validation_results + * Contains all flow validation results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the agent validation result. + * Format: `projects//locations//agents//validationResult`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the agent validation result. + * Format: `projects//locations//agents//validationResult`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Contains all flow validation results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.FlowValidationResult flow_validation_results = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFlowValidationResults() + { + return $this->flow_validation_results; + } + + /** + * Contains all flow validation results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.FlowValidationResult flow_validation_results = 2; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\FlowValidationResult>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFlowValidationResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\FlowValidationResult::class); + $this->flow_validation_results = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/AgentsClient.php b/DialogflowCx/src/V3/AgentsClient.php new file mode 100644 index 000000000000..a8f41a02aaca --- /dev/null +++ b/DialogflowCx/src/V3/AgentsClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.AudioEncoding + */ +class AudioEncoding +{ + /** + * Not specified. + * + * Generated from protobuf enum AUDIO_ENCODING_UNSPECIFIED = 0; + */ + const AUDIO_ENCODING_UNSPECIFIED = 0; + /** + * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * + * Generated from protobuf enum AUDIO_ENCODING_LINEAR_16 = 1; + */ + const AUDIO_ENCODING_LINEAR_16 = 1; + /** + * [`FLAC`](https://xiph.org/flac/documentation.html) (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. + * + * Generated from protobuf enum AUDIO_ENCODING_FLAC = 2; + */ + const AUDIO_ENCODING_FLAC = 2; + /** + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + * + * Generated from protobuf enum AUDIO_ENCODING_MULAW = 3; + */ + const AUDIO_ENCODING_MULAW = 3; + /** + * Adaptive Multi-Rate Narrowband codec. `sample_rate_hertz` must be 8000. + * + * Generated from protobuf enum AUDIO_ENCODING_AMR = 4; + */ + const AUDIO_ENCODING_AMR = 4; + /** + * Adaptive Multi-Rate Wideband codec. `sample_rate_hertz` must be 16000. + * + * Generated from protobuf enum AUDIO_ENCODING_AMR_WB = 5; + */ + const AUDIO_ENCODING_AMR_WB = 5; + /** + * Opus encoded audio frames in Ogg container + * ([OggOpus](https://wiki.xiph.org/OggOpus)). + * `sample_rate_hertz` must be 16000. + * + * Generated from protobuf enum AUDIO_ENCODING_OGG_OPUS = 6; + */ + const AUDIO_ENCODING_OGG_OPUS = 6; + /** + * 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](https://speex.org/) 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](https://tools.ietf.org/html/rfc5574). + * 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. + * + * Generated from protobuf enum AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; + */ + const AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE = 7; + + private static $valueToName = [ + self::AUDIO_ENCODING_UNSPECIFIED => 'AUDIO_ENCODING_UNSPECIFIED', + self::AUDIO_ENCODING_LINEAR_16 => 'AUDIO_ENCODING_LINEAR_16', + self::AUDIO_ENCODING_FLAC => 'AUDIO_ENCODING_FLAC', + self::AUDIO_ENCODING_MULAW => 'AUDIO_ENCODING_MULAW', + self::AUDIO_ENCODING_AMR => 'AUDIO_ENCODING_AMR', + self::AUDIO_ENCODING_AMR_WB => 'AUDIO_ENCODING_AMR_WB', + self::AUDIO_ENCODING_OGG_OPUS => 'AUDIO_ENCODING_OGG_OPUS', + self::AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE => 'AUDIO_ENCODING_SPEEX_WITH_HEADER_BYTE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DialogflowCx/src/V3/AudioInput.php b/DialogflowCx/src/V3/AudioInput.php new file mode 100644 index 000000000000..167a38437c9a --- /dev/null +++ b/DialogflowCx/src/V3/AudioInput.php @@ -0,0 +1,143 @@ +google.cloud.dialogflow.cx.v3.AudioInput + */ +class AudioInput extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Instructs the speech recognizer how to process the speech audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InputAudioConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $config = null; + /** + * The natural language speech audio to be processed. + * A single request can contain up to 2 minutes of speech audio data. + * The [transcribed + * text][google.cloud.dialogflow.cx.v3.QueryResult.transcript] cannot contain + * more than 256 bytes. + * For non-streaming audio detect intent, both `config` and `audio` must be + * provided. + * For streaming audio detect intent, `config` must be provided in + * the first request and `audio` must be provided in all following requests. + * + * Generated from protobuf field bytes audio = 2; + */ + protected $audio = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\InputAudioConfig $config + * Required. Instructs the speech recognizer how to process the speech audio. + * @type string $audio + * The natural language speech audio to be processed. + * A single request can contain up to 2 minutes of speech audio data. + * The [transcribed + * text][google.cloud.dialogflow.cx.v3.QueryResult.transcript] cannot contain + * more than 256 bytes. + * For non-streaming audio detect intent, both `config` and `audio` must be + * provided. + * For streaming audio detect intent, `config` must be provided in + * the first request and `audio` must be provided in all following requests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Required. Instructs the speech recognizer how to process the speech audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InputAudioConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\InputAudioConfig|null + */ + public function getConfig() + { + return $this->config; + } + + public function hasConfig() + { + return isset($this->config); + } + + public function clearConfig() + { + unset($this->config); + } + + /** + * Required. Instructs the speech recognizer how to process the speech audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InputAudioConfig config = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\InputAudioConfig $var + * @return $this + */ + public function setConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\InputAudioConfig::class); + $this->config = $var; + + return $this; + } + + /** + * The natural language speech audio to be processed. + * A single request can contain up to 2 minutes of speech audio data. + * The [transcribed + * text][google.cloud.dialogflow.cx.v3.QueryResult.transcript] cannot contain + * more than 256 bytes. + * For non-streaming audio detect intent, both `config` and `audio` must be + * provided. + * For streaming audio detect intent, `config` must be provided in + * the first request and `audio` must be provided in all following requests. + * + * Generated from protobuf field bytes audio = 2; + * @return string + */ + public function getAudio() + { + return $this->audio; + } + + /** + * The natural language speech audio to be processed. + * A single request can contain up to 2 minutes of speech audio data. + * The [transcribed + * text][google.cloud.dialogflow.cx.v3.QueryResult.transcript] cannot contain + * more than 256 bytes. + * For non-streaming audio detect intent, both `config` and `audio` must be + * provided. + * For streaming audio detect intent, `config` must be provided in + * the first request and `audio` must be provided in all following requests. + * + * Generated from protobuf field bytes audio = 2; + * @param string $var + * @return $this + */ + public function setAudio($var) + { + GPBUtil::checkString($var, False); + $this->audio = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/BatchDeleteTestCasesRequest.php b/DialogflowCx/src/V3/BatchDeleteTestCasesRequest.php new file mode 100644 index 000000000000..9a319d901f89 --- /dev/null +++ b/DialogflowCx/src/V3/BatchDeleteTestCasesRequest.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.BatchDeleteTestCasesRequest + */ +class BatchDeleteTestCasesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to delete test cases from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. Format of test case names: `projects//locations/ + * /agents//testCases/`. + * + * Generated from protobuf field repeated string names = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to delete test cases from. + * Format: `projects//locations//agents/`. + * @type array|\Google\Protobuf\Internal\RepeatedField $names + * Required. Format of test case names: `projects//locations/ + * /agents//testCases/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to delete test cases from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to delete test cases from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. Format of test case names: `projects//locations/ + * /agents//testCases/`. + * + * Generated from protobuf field repeated string names = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNames() + { + return $this->names; + } + + /** + * Required. Format of test case names: `projects//locations/ + * /agents//testCases/`. + * + * Generated from protobuf field repeated string names = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->names = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/BatchRunTestCasesMetadata.php b/DialogflowCx/src/V3/BatchRunTestCasesMetadata.php new file mode 100644 index 000000000000..06cd870d8e94 --- /dev/null +++ b/DialogflowCx/src/V3/BatchRunTestCasesMetadata.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.BatchRunTestCasesMetadata + */ +class BatchRunTestCasesMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The test errors. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError errors = 1; + */ + private $errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TestError>|\Google\Protobuf\Internal\RepeatedField $errors + * The test errors. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The test errors. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError errors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * The test errors. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError errors = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TestError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TestError::class); + $this->errors = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/BatchRunTestCasesRequest.php b/DialogflowCx/src/V3/BatchRunTestCasesRequest.php new file mode 100644 index 000000000000..588b6971f4a9 --- /dev/null +++ b/DialogflowCx/src/V3/BatchRunTestCasesRequest.php @@ -0,0 +1,152 @@ +google.cloud.dialogflow.cx.v3.BatchRunTestCasesRequest + */ +class BatchRunTestCasesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Agent name. Format: `projects//locations//agents/ `. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. If not set, draft environment is assumed. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $environment = ''; + /** + * Required. Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field repeated string test_cases = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $test_cases; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Agent name. Format: `projects//locations//agents/ `. + * @type string $environment + * Optional. If not set, draft environment is assumed. Format: + * `projects//locations//agents//environments/`. + * @type array|\Google\Protobuf\Internal\RepeatedField $test_cases + * Required. Format: `projects//locations//agents//testCases/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. Agent name. Format: `projects//locations//agents/ `. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Agent name. Format: `projects//locations//agents/ `. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. If not set, draft environment is assumed. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Optional. If not set, draft environment is assumed. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkString($var, True); + $this->environment = $var; + + return $this; + } + + /** + * Required. Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field repeated string test_cases = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTestCases() + { + return $this->test_cases; + } + + /** + * Required. Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field repeated string test_cases = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTestCases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->test_cases = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/BatchRunTestCasesResponse.php b/DialogflowCx/src/V3/BatchRunTestCasesResponse.php new file mode 100644 index 000000000000..78f84cda38a6 --- /dev/null +++ b/DialogflowCx/src/V3/BatchRunTestCasesResponse.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.BatchRunTestCasesResponse + */ +class BatchRunTestCasesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The test case results. The detailed + * [conversation + * turns][google.cloud.dialogflow.cx.v3.TestCaseResult.conversation_turns] are + * empty in this response. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseResult results = 1; + */ + private $results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TestCaseResult>|\Google\Protobuf\Internal\RepeatedField $results + * The test case results. The detailed + * [conversation + * turns][google.cloud.dialogflow.cx.v3.TestCaseResult.conversation_turns] are + * empty in this response. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The test case results. The detailed + * [conversation + * turns][google.cloud.dialogflow.cx.v3.TestCaseResult.conversation_turns] are + * empty in this response. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseResult results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResults() + { + return $this->results; + } + + /** + * The test case results. The detailed + * [conversation + * turns][google.cloud.dialogflow.cx.v3.TestCaseResult.conversation_turns] are + * empty in this response. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseResult results = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TestCaseResult>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TestCaseResult::class); + $this->results = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CalculateCoverageRequest.php b/DialogflowCx/src/V3/CalculateCoverageRequest.php new file mode 100644 index 000000000000..d99eceebfa52 --- /dev/null +++ b/DialogflowCx/src/V3/CalculateCoverageRequest.php @@ -0,0 +1,106 @@ +google.cloud.dialogflow.cx.v3.CalculateCoverageRequest + */ +class CalculateCoverageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string agent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $agent = ''; + /** + * Required. The type of coverage requested. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.CalculateCoverageRequest.CoverageType type = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $agent + * Required. The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * @type int $type + * Required. The type of coverage requested. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string agent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getAgent() + { + return $this->agent; + } + + /** + * Required. The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string agent = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAgent($var) + { + GPBUtil::checkString($var, True); + $this->agent = $var; + + return $this; + } + + /** + * Required. The type of coverage requested. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.CalculateCoverageRequest.CoverageType type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Required. The type of coverage requested. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.CalculateCoverageRequest.CoverageType type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\CalculateCoverageRequest\CoverageType::class); + $this->type = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CalculateCoverageRequest/CoverageType.php b/DialogflowCx/src/V3/CalculateCoverageRequest/CoverageType.php new file mode 100644 index 000000000000..0a561b33c1bf --- /dev/null +++ b/DialogflowCx/src/V3/CalculateCoverageRequest/CoverageType.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.CalculateCoverageRequest.CoverageType + */ +class CoverageType +{ + /** + * Should never be used. + * + * Generated from protobuf enum COVERAGE_TYPE_UNSPECIFIED = 0; + */ + const COVERAGE_TYPE_UNSPECIFIED = 0; + /** + * Intent coverage. + * + * Generated from protobuf enum INTENT = 1; + */ + const INTENT = 1; + /** + * Page transition coverage. + * + * Generated from protobuf enum PAGE_TRANSITION = 2; + */ + const PAGE_TRANSITION = 2; + /** + * Transition route group coverage. + * + * Generated from protobuf enum TRANSITION_ROUTE_GROUP = 3; + */ + const TRANSITION_ROUTE_GROUP = 3; + + private static $valueToName = [ + self::COVERAGE_TYPE_UNSPECIFIED => 'COVERAGE_TYPE_UNSPECIFIED', + self::INTENT => 'INTENT', + self::PAGE_TRANSITION => 'PAGE_TRANSITION', + self::TRANSITION_ROUTE_GROUP => 'TRANSITION_ROUTE_GROUP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/CalculateCoverageResponse.php b/DialogflowCx/src/V3/CalculateCoverageResponse.php new file mode 100644 index 000000000000..1d21d3a7b51e --- /dev/null +++ b/DialogflowCx/src/V3/CalculateCoverageResponse.php @@ -0,0 +1,180 @@ +google.cloud.dialogflow.cx.v3.CalculateCoverageResponse + */ +class CalculateCoverageResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string agent = 5 [(.google.api.resource_reference) = { + */ + protected $agent = ''; + protected $coverage_type; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $agent + * The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\IntentCoverage $intent_coverage + * Intent coverage. + * @type \Google\Cloud\Dialogflow\Cx\V3\TransitionCoverage $transition_coverage + * Transition (excluding transition route groups) coverage. + * @type \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroupCoverage $route_group_coverage + * Transition route group coverage. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string agent = 5 [(.google.api.resource_reference) = { + * @return string + */ + public function getAgent() + { + return $this->agent; + } + + /** + * The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string agent = 5 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAgent($var) + { + GPBUtil::checkString($var, True); + $this->agent = $var; + + return $this; + } + + /** + * Intent coverage. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.IntentCoverage intent_coverage = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\IntentCoverage|null + */ + public function getIntentCoverage() + { + return $this->readOneof(2); + } + + public function hasIntentCoverage() + { + return $this->hasOneof(2); + } + + /** + * Intent coverage. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.IntentCoverage intent_coverage = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\IntentCoverage $var + * @return $this + */ + public function setIntentCoverage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\IntentCoverage::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Transition (excluding transition route groups) coverage. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TransitionCoverage transition_coverage = 4; + * @return \Google\Cloud\Dialogflow\Cx\V3\TransitionCoverage|null + */ + public function getTransitionCoverage() + { + return $this->readOneof(4); + } + + public function hasTransitionCoverage() + { + return $this->hasOneof(4); + } + + /** + * Transition (excluding transition route groups) coverage. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TransitionCoverage transition_coverage = 4; + * @param \Google\Cloud\Dialogflow\Cx\V3\TransitionCoverage $var + * @return $this + */ + public function setTransitionCoverage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TransitionCoverage::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Transition route group coverage. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TransitionRouteGroupCoverage route_group_coverage = 6; + * @return \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroupCoverage|null + */ + public function getRouteGroupCoverage() + { + return $this->readOneof(6); + } + + public function hasRouteGroupCoverage() + { + return $this->hasOneof(6); + } + + /** + * Transition route group coverage. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TransitionRouteGroupCoverage route_group_coverage = 6; + * @param \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroupCoverage $var + * @return $this + */ + public function setRouteGroupCoverage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroupCoverage::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * @return string + */ + public function getCoverageType() + { + return $this->whichOneof("coverage_type"); + } + +} + diff --git a/DialogflowCx/src/V3/Changelog.php b/DialogflowCx/src/V3/Changelog.php new file mode 100644 index 000000000000..824b99dd8cc4 --- /dev/null +++ b/DialogflowCx/src/V3/Changelog.php @@ -0,0 +1,289 @@ +google.cloud.dialogflow.cx.v3.Changelog + */ +class Changelog extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the changelog. + * Format: `projects//locations//agents//changelogs/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Email address of the authenticated user. + * + * Generated from protobuf field string user_email = 2; + */ + protected $user_email = ''; + /** + * The affected resource display name of the change. + * + * Generated from protobuf field string display_name = 7; + */ + protected $display_name = ''; + /** + * The action of the change. + * + * Generated from protobuf field string action = 11; + */ + protected $action = ''; + /** + * The affected resource type. + * + * Generated from protobuf field string type = 8; + */ + protected $type = ''; + /** + * The affected resource name of the change. + * + * Generated from protobuf field string resource = 3; + */ + protected $resource = ''; + /** + * The timestamp of the change. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; + */ + protected $create_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the changelog. + * Format: `projects//locations//agents//changelogs/`. + * @type string $user_email + * Email address of the authenticated user. + * @type string $display_name + * The affected resource display name of the change. + * @type string $action + * The action of the change. + * @type string $type + * The affected resource type. + * @type string $resource + * The affected resource name of the change. + * @type \Google\Protobuf\Timestamp $create_time + * The timestamp of the change. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Changelog::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the changelog. + * Format: `projects//locations//agents//changelogs/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the changelog. + * Format: `projects//locations//agents//changelogs/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Email address of the authenticated user. + * + * Generated from protobuf field string user_email = 2; + * @return string + */ + public function getUserEmail() + { + return $this->user_email; + } + + /** + * Email address of the authenticated user. + * + * Generated from protobuf field string user_email = 2; + * @param string $var + * @return $this + */ + public function setUserEmail($var) + { + GPBUtil::checkString($var, True); + $this->user_email = $var; + + return $this; + } + + /** + * The affected resource display name of the change. + * + * Generated from protobuf field string display_name = 7; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The affected resource display name of the change. + * + * Generated from protobuf field string display_name = 7; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The action of the change. + * + * Generated from protobuf field string action = 11; + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * The action of the change. + * + * Generated from protobuf field string action = 11; + * @param string $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkString($var, True); + $this->action = $var; + + return $this; + } + + /** + * The affected resource type. + * + * Generated from protobuf field string type = 8; + * @return string + */ + public function getType() + { + return $this->type; + } + + /** + * The affected resource type. + * + * Generated from protobuf field string type = 8; + * @param string $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkString($var, True); + $this->type = $var; + + return $this; + } + + /** + * The affected resource name of the change. + * + * Generated from protobuf field string resource = 3; + * @return string + */ + public function getResource() + { + return $this->resource; + } + + /** + * The affected resource name of the change. + * + * Generated from protobuf field string resource = 3; + * @param string $var + * @return $this + */ + public function setResource($var) + { + GPBUtil::checkString($var, True); + $this->resource = $var; + + return $this; + } + + /** + * The timestamp of the change. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * The timestamp of the change. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ChangelogsClient.php b/DialogflowCx/src/V3/ChangelogsClient.php new file mode 100644 index 000000000000..e765ced9aeeb --- /dev/null +++ b/DialogflowCx/src/V3/ChangelogsClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.CloudConversationDebuggingInfo + */ +class CloudConversationDebuggingInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Number of input audio data chunks in streaming requests. + * + * Generated from protobuf field int32 audio_data_chunks = 1; + */ + protected $audio_data_chunks = 0; + /** + * Time offset of the end of speech utterance relative to the + * beginning of the first audio chunk. + * + * Generated from protobuf field .google.protobuf.Duration result_end_time_offset = 2; + */ + protected $result_end_time_offset = null; + /** + * Duration of first audio chunk. + * + * Generated from protobuf field .google.protobuf.Duration first_audio_duration = 3; + */ + protected $first_audio_duration = null; + /** + * Whether client used single utterance mode. + * + * Generated from protobuf field bool single_utterance = 5; + */ + protected $single_utterance = false; + /** + * Time offsets of the speech partial results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration speech_partial_results_end_times = 6; + */ + private $speech_partial_results_end_times; + /** + * Time offsets of the speech final results (is_final=true) relative to the + * beginning of the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration speech_final_results_end_times = 7; + */ + private $speech_final_results_end_times; + /** + * Total number of partial responses. + * + * Generated from protobuf field int32 partial_responses = 8; + */ + protected $partial_responses = 0; + /** + * Time offset of Speaker ID stream close time relative to the Speech stream + * close time in milliseconds. Only meaningful for conversations involving + * passive verification. + * + * Generated from protobuf field int32 speaker_id_passive_latency_ms_offset = 9; + */ + protected $speaker_id_passive_latency_ms_offset = 0; + /** + * Whether a barge-in event is triggered in this request. + * + * Generated from protobuf field bool bargein_event_triggered = 10; + */ + protected $bargein_event_triggered = false; + /** + * Whether speech uses single utterance mode. + * + * Generated from protobuf field bool speech_single_utterance = 11; + */ + protected $speech_single_utterance = false; + /** + * Time offsets of the DTMF partial results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration dtmf_partial_results_times = 12; + */ + private $dtmf_partial_results_times; + /** + * Time offsets of the DTMF final results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration dtmf_final_results_times = 13; + */ + private $dtmf_final_results_times; + /** + * Time offset of the end-of-single-utterance signal relative to the + * beginning of the stream. + * + * Generated from protobuf field .google.protobuf.Duration single_utterance_end_time_offset = 14; + */ + protected $single_utterance_end_time_offset = null; + /** + * No speech timeout settings for the stream. + * + * Generated from protobuf field .google.protobuf.Duration no_speech_timeout = 15; + */ + protected $no_speech_timeout = null; + /** + * Speech endpointing timeout settings for the stream. + * + * Generated from protobuf field .google.protobuf.Duration endpointing_timeout = 19; + */ + protected $endpointing_timeout = null; + /** + * Whether the streaming terminates with an injected text query. + * + * Generated from protobuf field bool is_input_text = 16; + */ + protected $is_input_text = false; + /** + * Client half close time in terms of input audio duration. + * + * Generated from protobuf field .google.protobuf.Duration client_half_close_time_offset = 17; + */ + protected $client_half_close_time_offset = null; + /** + * Client half close time in terms of API streaming duration. + * + * Generated from protobuf field .google.protobuf.Duration client_half_close_streaming_time_offset = 18; + */ + protected $client_half_close_streaming_time_offset = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $audio_data_chunks + * Number of input audio data chunks in streaming requests. + * @type \Google\Protobuf\Duration $result_end_time_offset + * Time offset of the end of speech utterance relative to the + * beginning of the first audio chunk. + * @type \Google\Protobuf\Duration $first_audio_duration + * Duration of first audio chunk. + * @type bool $single_utterance + * Whether client used single utterance mode. + * @type array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $speech_partial_results_end_times + * Time offsets of the speech partial results relative to the beginning of + * the stream. + * @type array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $speech_final_results_end_times + * Time offsets of the speech final results (is_final=true) relative to the + * beginning of the stream. + * @type int $partial_responses + * Total number of partial responses. + * @type int $speaker_id_passive_latency_ms_offset + * Time offset of Speaker ID stream close time relative to the Speech stream + * close time in milliseconds. Only meaningful for conversations involving + * passive verification. + * @type bool $bargein_event_triggered + * Whether a barge-in event is triggered in this request. + * @type bool $speech_single_utterance + * Whether speech uses single utterance mode. + * @type array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $dtmf_partial_results_times + * Time offsets of the DTMF partial results relative to the beginning of + * the stream. + * @type array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $dtmf_final_results_times + * Time offsets of the DTMF final results relative to the beginning of + * the stream. + * @type \Google\Protobuf\Duration $single_utterance_end_time_offset + * Time offset of the end-of-single-utterance signal relative to the + * beginning of the stream. + * @type \Google\Protobuf\Duration $no_speech_timeout + * No speech timeout settings for the stream. + * @type \Google\Protobuf\Duration $endpointing_timeout + * Speech endpointing timeout settings for the stream. + * @type bool $is_input_text + * Whether the streaming terminates with an injected text query. + * @type \Google\Protobuf\Duration $client_half_close_time_offset + * Client half close time in terms of input audio duration. + * @type \Google\Protobuf\Duration $client_half_close_streaming_time_offset + * Client half close time in terms of API streaming duration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Number of input audio data chunks in streaming requests. + * + * Generated from protobuf field int32 audio_data_chunks = 1; + * @return int + */ + public function getAudioDataChunks() + { + return $this->audio_data_chunks; + } + + /** + * Number of input audio data chunks in streaming requests. + * + * Generated from protobuf field int32 audio_data_chunks = 1; + * @param int $var + * @return $this + */ + public function setAudioDataChunks($var) + { + GPBUtil::checkInt32($var); + $this->audio_data_chunks = $var; + + return $this; + } + + /** + * Time offset of the end of speech utterance relative to the + * beginning of the first audio chunk. + * + * Generated from protobuf field .google.protobuf.Duration result_end_time_offset = 2; + * @return \Google\Protobuf\Duration|null + */ + public function getResultEndTimeOffset() + { + return $this->result_end_time_offset; + } + + public function hasResultEndTimeOffset() + { + return isset($this->result_end_time_offset); + } + + public function clearResultEndTimeOffset() + { + unset($this->result_end_time_offset); + } + + /** + * Time offset of the end of speech utterance relative to the + * beginning of the first audio chunk. + * + * Generated from protobuf field .google.protobuf.Duration result_end_time_offset = 2; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setResultEndTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->result_end_time_offset = $var; + + return $this; + } + + /** + * Duration of first audio chunk. + * + * Generated from protobuf field .google.protobuf.Duration first_audio_duration = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getFirstAudioDuration() + { + return $this->first_audio_duration; + } + + public function hasFirstAudioDuration() + { + return isset($this->first_audio_duration); + } + + public function clearFirstAudioDuration() + { + unset($this->first_audio_duration); + } + + /** + * Duration of first audio chunk. + * + * Generated from protobuf field .google.protobuf.Duration first_audio_duration = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setFirstAudioDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->first_audio_duration = $var; + + return $this; + } + + /** + * Whether client used single utterance mode. + * + * Generated from protobuf field bool single_utterance = 5; + * @return bool + */ + public function getSingleUtterance() + { + return $this->single_utterance; + } + + /** + * Whether client used single utterance mode. + * + * Generated from protobuf field bool single_utterance = 5; + * @param bool $var + * @return $this + */ + public function setSingleUtterance($var) + { + GPBUtil::checkBool($var); + $this->single_utterance = $var; + + return $this; + } + + /** + * Time offsets of the speech partial results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration speech_partial_results_end_times = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpeechPartialResultsEndTimes() + { + return $this->speech_partial_results_end_times; + } + + /** + * Time offsets of the speech partial results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration speech_partial_results_end_times = 6; + * @param array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpeechPartialResultsEndTimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); + $this->speech_partial_results_end_times = $arr; + + return $this; + } + + /** + * Time offsets of the speech final results (is_final=true) relative to the + * beginning of the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration speech_final_results_end_times = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSpeechFinalResultsEndTimes() + { + return $this->speech_final_results_end_times; + } + + /** + * Time offsets of the speech final results (is_final=true) relative to the + * beginning of the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration speech_final_results_end_times = 7; + * @param array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSpeechFinalResultsEndTimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); + $this->speech_final_results_end_times = $arr; + + return $this; + } + + /** + * Total number of partial responses. + * + * Generated from protobuf field int32 partial_responses = 8; + * @return int + */ + public function getPartialResponses() + { + return $this->partial_responses; + } + + /** + * Total number of partial responses. + * + * Generated from protobuf field int32 partial_responses = 8; + * @param int $var + * @return $this + */ + public function setPartialResponses($var) + { + GPBUtil::checkInt32($var); + $this->partial_responses = $var; + + return $this; + } + + /** + * Time offset of Speaker ID stream close time relative to the Speech stream + * close time in milliseconds. Only meaningful for conversations involving + * passive verification. + * + * Generated from protobuf field int32 speaker_id_passive_latency_ms_offset = 9; + * @return int + */ + public function getSpeakerIdPassiveLatencyMsOffset() + { + return $this->speaker_id_passive_latency_ms_offset; + } + + /** + * Time offset of Speaker ID stream close time relative to the Speech stream + * close time in milliseconds. Only meaningful for conversations involving + * passive verification. + * + * Generated from protobuf field int32 speaker_id_passive_latency_ms_offset = 9; + * @param int $var + * @return $this + */ + public function setSpeakerIdPassiveLatencyMsOffset($var) + { + GPBUtil::checkInt32($var); + $this->speaker_id_passive_latency_ms_offset = $var; + + return $this; + } + + /** + * Whether a barge-in event is triggered in this request. + * + * Generated from protobuf field bool bargein_event_triggered = 10; + * @return bool + */ + public function getBargeinEventTriggered() + { + return $this->bargein_event_triggered; + } + + /** + * Whether a barge-in event is triggered in this request. + * + * Generated from protobuf field bool bargein_event_triggered = 10; + * @param bool $var + * @return $this + */ + public function setBargeinEventTriggered($var) + { + GPBUtil::checkBool($var); + $this->bargein_event_triggered = $var; + + return $this; + } + + /** + * Whether speech uses single utterance mode. + * + * Generated from protobuf field bool speech_single_utterance = 11; + * @return bool + */ + public function getSpeechSingleUtterance() + { + return $this->speech_single_utterance; + } + + /** + * Whether speech uses single utterance mode. + * + * Generated from protobuf field bool speech_single_utterance = 11; + * @param bool $var + * @return $this + */ + public function setSpeechSingleUtterance($var) + { + GPBUtil::checkBool($var); + $this->speech_single_utterance = $var; + + return $this; + } + + /** + * Time offsets of the DTMF partial results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration dtmf_partial_results_times = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDtmfPartialResultsTimes() + { + return $this->dtmf_partial_results_times; + } + + /** + * Time offsets of the DTMF partial results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration dtmf_partial_results_times = 12; + * @param array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDtmfPartialResultsTimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); + $this->dtmf_partial_results_times = $arr; + + return $this; + } + + /** + * Time offsets of the DTMF final results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration dtmf_final_results_times = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDtmfFinalResultsTimes() + { + return $this->dtmf_final_results_times; + } + + /** + * Time offsets of the DTMF final results relative to the beginning of + * the stream. + * + * Generated from protobuf field repeated .google.protobuf.Duration dtmf_final_results_times = 13; + * @param array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDtmfFinalResultsTimes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); + $this->dtmf_final_results_times = $arr; + + return $this; + } + + /** + * Time offset of the end-of-single-utterance signal relative to the + * beginning of the stream. + * + * Generated from protobuf field .google.protobuf.Duration single_utterance_end_time_offset = 14; + * @return \Google\Protobuf\Duration|null + */ + public function getSingleUtteranceEndTimeOffset() + { + return $this->single_utterance_end_time_offset; + } + + public function hasSingleUtteranceEndTimeOffset() + { + return isset($this->single_utterance_end_time_offset); + } + + public function clearSingleUtteranceEndTimeOffset() + { + unset($this->single_utterance_end_time_offset); + } + + /** + * Time offset of the end-of-single-utterance signal relative to the + * beginning of the stream. + * + * Generated from protobuf field .google.protobuf.Duration single_utterance_end_time_offset = 14; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setSingleUtteranceEndTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->single_utterance_end_time_offset = $var; + + return $this; + } + + /** + * No speech timeout settings for the stream. + * + * Generated from protobuf field .google.protobuf.Duration no_speech_timeout = 15; + * @return \Google\Protobuf\Duration|null + */ + public function getNoSpeechTimeout() + { + return $this->no_speech_timeout; + } + + public function hasNoSpeechTimeout() + { + return isset($this->no_speech_timeout); + } + + public function clearNoSpeechTimeout() + { + unset($this->no_speech_timeout); + } + + /** + * No speech timeout settings for the stream. + * + * Generated from protobuf field .google.protobuf.Duration no_speech_timeout = 15; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setNoSpeechTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->no_speech_timeout = $var; + + return $this; + } + + /** + * Speech endpointing timeout settings for the stream. + * + * Generated from protobuf field .google.protobuf.Duration endpointing_timeout = 19; + * @return \Google\Protobuf\Duration|null + */ + public function getEndpointingTimeout() + { + return $this->endpointing_timeout; + } + + public function hasEndpointingTimeout() + { + return isset($this->endpointing_timeout); + } + + public function clearEndpointingTimeout() + { + unset($this->endpointing_timeout); + } + + /** + * Speech endpointing timeout settings for the stream. + * + * Generated from protobuf field .google.protobuf.Duration endpointing_timeout = 19; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setEndpointingTimeout($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->endpointing_timeout = $var; + + return $this; + } + + /** + * Whether the streaming terminates with an injected text query. + * + * Generated from protobuf field bool is_input_text = 16; + * @return bool + */ + public function getIsInputText() + { + return $this->is_input_text; + } + + /** + * Whether the streaming terminates with an injected text query. + * + * Generated from protobuf field bool is_input_text = 16; + * @param bool $var + * @return $this + */ + public function setIsInputText($var) + { + GPBUtil::checkBool($var); + $this->is_input_text = $var; + + return $this; + } + + /** + * Client half close time in terms of input audio duration. + * + * Generated from protobuf field .google.protobuf.Duration client_half_close_time_offset = 17; + * @return \Google\Protobuf\Duration|null + */ + public function getClientHalfCloseTimeOffset() + { + return $this->client_half_close_time_offset; + } + + public function hasClientHalfCloseTimeOffset() + { + return isset($this->client_half_close_time_offset); + } + + public function clearClientHalfCloseTimeOffset() + { + unset($this->client_half_close_time_offset); + } + + /** + * Client half close time in terms of input audio duration. + * + * Generated from protobuf field .google.protobuf.Duration client_half_close_time_offset = 17; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setClientHalfCloseTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->client_half_close_time_offset = $var; + + return $this; + } + + /** + * Client half close time in terms of API streaming duration. + * + * Generated from protobuf field .google.protobuf.Duration client_half_close_streaming_time_offset = 18; + * @return \Google\Protobuf\Duration|null + */ + public function getClientHalfCloseStreamingTimeOffset() + { + return $this->client_half_close_streaming_time_offset; + } + + public function hasClientHalfCloseStreamingTimeOffset() + { + return isset($this->client_half_close_streaming_time_offset); + } + + public function clearClientHalfCloseStreamingTimeOffset() + { + unset($this->client_half_close_streaming_time_offset); + } + + /** + * Client half close time in terms of API streaming duration. + * + * Generated from protobuf field .google.protobuf.Duration client_half_close_streaming_time_offset = 18; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setClientHalfCloseStreamingTimeOffset($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->client_half_close_streaming_time_offset = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CompareVersionsRequest.php b/DialogflowCx/src/V3/CompareVersionsRequest.php new file mode 100644 index 000000000000..ff7103a9c48c --- /dev/null +++ b/DialogflowCx/src/V3/CompareVersionsRequest.php @@ -0,0 +1,180 @@ +google.cloud.dialogflow.cx.v3.CompareVersionsRequest + */ +class CompareVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of the base flow version to compare with the target version. + * Use version ID `0` to indicate the draft version of the specified flow. + * Format: `projects//locations//agents/ + * /flows//versions/`. + * + * Generated from protobuf field string base_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $base_version = ''; + /** + * Required. Name of the target flow version to compare with the + * base version. Use version ID `0` to indicate the draft version of the + * specified flow. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string target_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $target_version = ''; + /** + * The language to compare the flow versions for. + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) are + * supported. Note: languages must be enabled in the agent before they can be + * used. + * + * Generated from protobuf field string language_code = 3; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $base_version + * Required. Name of the base flow version to compare with the target version. + * Use version ID `0` to indicate the draft version of the specified flow. + * Format: `projects//locations//agents/ + * /flows//versions/`. + * @type string $target_version + * Required. Name of the target flow version to compare with the + * base version. Use version ID `0` to indicate the draft version of the + * specified flow. Format: `projects//locations//agents//flows//versions/`. + * @type string $language_code + * The language to compare the flow versions for. + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) are + * supported. Note: languages must be enabled in the agent before they can be + * used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of the base flow version to compare with the target version. + * Use version ID `0` to indicate the draft version of the specified flow. + * Format: `projects//locations//agents/ + * /flows//versions/`. + * + * Generated from protobuf field string base_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getBaseVersion() + { + return $this->base_version; + } + + /** + * Required. Name of the base flow version to compare with the target version. + * Use version ID `0` to indicate the draft version of the specified flow. + * Format: `projects//locations//agents/ + * /flows//versions/`. + * + * Generated from protobuf field string base_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setBaseVersion($var) + { + GPBUtil::checkString($var, True); + $this->base_version = $var; + + return $this; + } + + /** + * Required. Name of the target flow version to compare with the + * base version. Use version ID `0` to indicate the draft version of the + * specified flow. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string target_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTargetVersion() + { + return $this->target_version; + } + + /** + * Required. Name of the target flow version to compare with the + * base version. Use version ID `0` to indicate the draft version of the + * specified flow. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string target_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetVersion($var) + { + GPBUtil::checkString($var, True); + $this->target_version = $var; + + return $this; + } + + /** + * The language to compare the flow versions for. + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) are + * supported. Note: languages must be enabled in the agent before they can be + * used. + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to compare the flow versions for. + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) are + * supported. Note: languages must be enabled in the agent before they can be + * used. + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CompareVersionsResponse.php b/DialogflowCx/src/V3/CompareVersionsResponse.php new file mode 100644 index 000000000000..c89808df0f95 --- /dev/null +++ b/DialogflowCx/src/V3/CompareVersionsResponse.php @@ -0,0 +1,146 @@ +google.cloud.dialogflow.cx.v3.CompareVersionsResponse + */ +class CompareVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * JSON representation of the base version content. + * + * Generated from protobuf field string base_version_content_json = 1; + */ + protected $base_version_content_json = ''; + /** + * JSON representation of the target version content. + * + * Generated from protobuf field string target_version_content_json = 2; + */ + protected $target_version_content_json = ''; + /** + * The timestamp when the two version compares. + * + * Generated from protobuf field .google.protobuf.Timestamp compare_time = 3; + */ + protected $compare_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $base_version_content_json + * JSON representation of the base version content. + * @type string $target_version_content_json + * JSON representation of the target version content. + * @type \Google\Protobuf\Timestamp $compare_time + * The timestamp when the two version compares. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * JSON representation of the base version content. + * + * Generated from protobuf field string base_version_content_json = 1; + * @return string + */ + public function getBaseVersionContentJson() + { + return $this->base_version_content_json; + } + + /** + * JSON representation of the base version content. + * + * Generated from protobuf field string base_version_content_json = 1; + * @param string $var + * @return $this + */ + public function setBaseVersionContentJson($var) + { + GPBUtil::checkString($var, True); + $this->base_version_content_json = $var; + + return $this; + } + + /** + * JSON representation of the target version content. + * + * Generated from protobuf field string target_version_content_json = 2; + * @return string + */ + public function getTargetVersionContentJson() + { + return $this->target_version_content_json; + } + + /** + * JSON representation of the target version content. + * + * Generated from protobuf field string target_version_content_json = 2; + * @param string $var + * @return $this + */ + public function setTargetVersionContentJson($var) + { + GPBUtil::checkString($var, True); + $this->target_version_content_json = $var; + + return $this; + } + + /** + * The timestamp when the two version compares. + * + * Generated from protobuf field .google.protobuf.Timestamp compare_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCompareTime() + { + return $this->compare_time; + } + + public function hasCompareTime() + { + return isset($this->compare_time); + } + + public function clearCompareTime() + { + unset($this->compare_time); + } + + /** + * The timestamp when the two version compares. + * + * Generated from protobuf field .google.protobuf.Timestamp compare_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCompareTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->compare_time = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ContinuousTestResult.php b/DialogflowCx/src/V3/ContinuousTestResult.php new file mode 100644 index 000000000000..086bd1526534 --- /dev/null +++ b/DialogflowCx/src/V3/ContinuousTestResult.php @@ -0,0 +1,195 @@ +google.cloud.dialogflow.cx.v3.ContinuousTestResult + */ +class ContinuousTestResult extends \Google\Protobuf\Internal\Message +{ + /** + * The resource name for the continuous test result. Format: + * `projects//locations//agents//environments//continuousTestResults/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The result of this continuous test run, i.e. whether all the tests in this + * continuous test run pass or not. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ContinuousTestResult.AggregatedTestResult result = 2; + */ + protected $result = 0; + /** + * A list of individual test case results names in this continuous test run. + * + * Generated from protobuf field repeated string test_case_results = 3 [(.google.api.resource_reference) = { + */ + private $test_case_results; + /** + * Time when the continuous testing run starts. + * + * Generated from protobuf field .google.protobuf.Timestamp run_time = 4; + */ + protected $run_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The resource name for the continuous test result. Format: + * `projects//locations//agents//environments//continuousTestResults/`. + * @type int $result + * The result of this continuous test run, i.e. whether all the tests in this + * continuous test run pass or not. + * @type array|\Google\Protobuf\Internal\RepeatedField $test_case_results + * A list of individual test case results names in this continuous test run. + * @type \Google\Protobuf\Timestamp $run_time + * Time when the continuous testing run starts. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * The resource name for the continuous test result. Format: + * `projects//locations//agents//environments//continuousTestResults/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The resource name for the continuous test result. Format: + * `projects//locations//agents//environments//continuousTestResults/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The result of this continuous test run, i.e. whether all the tests in this + * continuous test run pass or not. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ContinuousTestResult.AggregatedTestResult result = 2; + * @return int + */ + public function getResult() + { + return $this->result; + } + + /** + * The result of this continuous test run, i.e. whether all the tests in this + * continuous test run pass or not. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ContinuousTestResult.AggregatedTestResult result = 2; + * @param int $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ContinuousTestResult\AggregatedTestResult::class); + $this->result = $var; + + return $this; + } + + /** + * A list of individual test case results names in this continuous test run. + * + * Generated from protobuf field repeated string test_case_results = 3 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTestCaseResults() + { + return $this->test_case_results; + } + + /** + * A list of individual test case results names in this continuous test run. + * + * Generated from protobuf field repeated string test_case_results = 3 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTestCaseResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->test_case_results = $arr; + + return $this; + } + + /** + * Time when the continuous testing run starts. + * + * Generated from protobuf field .google.protobuf.Timestamp run_time = 4; + * @return \Google\Protobuf\Timestamp|null + */ + public function getRunTime() + { + return $this->run_time; + } + + public function hasRunTime() + { + return isset($this->run_time); + } + + public function clearRunTime() + { + unset($this->run_time); + } + + /** + * Time when the continuous testing run starts. + * + * Generated from protobuf field .google.protobuf.Timestamp run_time = 4; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setRunTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->run_time = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ContinuousTestResult/AggregatedTestResult.php b/DialogflowCx/src/V3/ContinuousTestResult/AggregatedTestResult.php new file mode 100644 index 000000000000..36c4f509fe68 --- /dev/null +++ b/DialogflowCx/src/V3/ContinuousTestResult/AggregatedTestResult.php @@ -0,0 +1,62 @@ +google.cloud.dialogflow.cx.v3.ContinuousTestResult.AggregatedTestResult + */ +class AggregatedTestResult +{ + /** + * Not specified. Should never be used. + * + * Generated from protobuf enum AGGREGATED_TEST_RESULT_UNSPECIFIED = 0; + */ + const AGGREGATED_TEST_RESULT_UNSPECIFIED = 0; + /** + * All the tests passed. + * + * Generated from protobuf enum PASSED = 1; + */ + const PASSED = 1; + /** + * At least one test did not pass. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + + private static $valueToName = [ + self::AGGREGATED_TEST_RESULT_UNSPECIFIED => 'AGGREGATED_TEST_RESULT_UNSPECIFIED', + self::PASSED => 'PASSED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ConversationTurn.php b/DialogflowCx/src/V3/ConversationTurn.php new file mode 100644 index 000000000000..0ded7a6566c3 --- /dev/null +++ b/DialogflowCx/src/V3/ConversationTurn.php @@ -0,0 +1,122 @@ +google.cloud.dialogflow.cx.v3.ConversationTurn + */ +class ConversationTurn extends \Google\Protobuf\Internal\Message +{ + /** + * The user input. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ConversationTurn.UserInput user_input = 1; + */ + protected $user_input = null; + /** + * The virtual agent output. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ConversationTurn.VirtualAgentOutput virtual_agent_output = 2; + */ + protected $virtual_agent_output = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\ConversationTurn\UserInput $user_input + * The user input. + * @type \Google\Cloud\Dialogflow\Cx\V3\ConversationTurn\VirtualAgentOutput $virtual_agent_output + * The virtual agent output. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The user input. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ConversationTurn.UserInput user_input = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\ConversationTurn\UserInput|null + */ + public function getUserInput() + { + return $this->user_input; + } + + public function hasUserInput() + { + return isset($this->user_input); + } + + public function clearUserInput() + { + unset($this->user_input); + } + + /** + * The user input. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ConversationTurn.UserInput user_input = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\ConversationTurn\UserInput $var + * @return $this + */ + public function setUserInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ConversationTurn\UserInput::class); + $this->user_input = $var; + + return $this; + } + + /** + * The virtual agent output. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ConversationTurn.VirtualAgentOutput virtual_agent_output = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\ConversationTurn\VirtualAgentOutput|null + */ + public function getVirtualAgentOutput() + { + return $this->virtual_agent_output; + } + + public function hasVirtualAgentOutput() + { + return isset($this->virtual_agent_output); + } + + public function clearVirtualAgentOutput() + { + unset($this->virtual_agent_output); + } + + /** + * The virtual agent output. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ConversationTurn.VirtualAgentOutput virtual_agent_output = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\ConversationTurn\VirtualAgentOutput $var + * @return $this + */ + public function setVirtualAgentOutput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ConversationTurn\VirtualAgentOutput::class); + $this->virtual_agent_output = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ConversationTurn/UserInput.php b/DialogflowCx/src/V3/ConversationTurn/UserInput.php new file mode 100644 index 000000000000..5dfc22b9c681 --- /dev/null +++ b/DialogflowCx/src/V3/ConversationTurn/UserInput.php @@ -0,0 +1,210 @@ +google.cloud.dialogflow.cx.v3.ConversationTurn.UserInput + */ +class UserInput extends \Google\Protobuf\Internal\Message +{ + /** + * Supports [text input][google.cloud.dialogflow.cx.v3.QueryInput.text], + * [event input][google.cloud.dialogflow.cx.v3.QueryInput.event], [dtmf + * input][google.cloud.dialogflow.cx.v3.QueryInput.dtmf] in the test case. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput input = 5; + */ + protected $input = null; + /** + * Parameters that need to be injected into the conversation during intent + * detection. + * + * Generated from protobuf field .google.protobuf.Struct injected_parameters = 2; + */ + protected $injected_parameters = null; + /** + * If webhooks should be allowed to trigger in response to the user + * utterance. Often if parameters are injected, webhooks should not be + * enabled. + * + * Generated from protobuf field bool is_webhook_enabled = 3; + */ + protected $is_webhook_enabled = false; + /** + * Whether sentiment analysis is enabled. + * + * Generated from protobuf field bool enable_sentiment_analysis = 7; + */ + protected $enable_sentiment_analysis = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\QueryInput $input + * Supports [text input][google.cloud.dialogflow.cx.v3.QueryInput.text], + * [event input][google.cloud.dialogflow.cx.v3.QueryInput.event], [dtmf + * input][google.cloud.dialogflow.cx.v3.QueryInput.dtmf] in the test case. + * @type \Google\Protobuf\Struct $injected_parameters + * Parameters that need to be injected into the conversation during intent + * detection. + * @type bool $is_webhook_enabled + * If webhooks should be allowed to trigger in response to the user + * utterance. Often if parameters are injected, webhooks should not be + * enabled. + * @type bool $enable_sentiment_analysis + * Whether sentiment analysis is enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Supports [text input][google.cloud.dialogflow.cx.v3.QueryInput.text], + * [event input][google.cloud.dialogflow.cx.v3.QueryInput.event], [dtmf + * input][google.cloud.dialogflow.cx.v3.QueryInput.dtmf] in the test case. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput input = 5; + * @return \Google\Cloud\Dialogflow\Cx\V3\QueryInput|null + */ + public function getInput() + { + return $this->input; + } + + public function hasInput() + { + return isset($this->input); + } + + public function clearInput() + { + unset($this->input); + } + + /** + * Supports [text input][google.cloud.dialogflow.cx.v3.QueryInput.text], + * [event input][google.cloud.dialogflow.cx.v3.QueryInput.event], [dtmf + * input][google.cloud.dialogflow.cx.v3.QueryInput.dtmf] in the test case. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput input = 5; + * @param \Google\Cloud\Dialogflow\Cx\V3\QueryInput $var + * @return $this + */ + public function setInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\QueryInput::class); + $this->input = $var; + + return $this; + } + + /** + * Parameters that need to be injected into the conversation during intent + * detection. + * + * Generated from protobuf field .google.protobuf.Struct injected_parameters = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getInjectedParameters() + { + return $this->injected_parameters; + } + + public function hasInjectedParameters() + { + return isset($this->injected_parameters); + } + + public function clearInjectedParameters() + { + unset($this->injected_parameters); + } + + /** + * Parameters that need to be injected into the conversation during intent + * detection. + * + * Generated from protobuf field .google.protobuf.Struct injected_parameters = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setInjectedParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->injected_parameters = $var; + + return $this; + } + + /** + * If webhooks should be allowed to trigger in response to the user + * utterance. Often if parameters are injected, webhooks should not be + * enabled. + * + * Generated from protobuf field bool is_webhook_enabled = 3; + * @return bool + */ + public function getIsWebhookEnabled() + { + return $this->is_webhook_enabled; + } + + /** + * If webhooks should be allowed to trigger in response to the user + * utterance. Often if parameters are injected, webhooks should not be + * enabled. + * + * Generated from protobuf field bool is_webhook_enabled = 3; + * @param bool $var + * @return $this + */ + public function setIsWebhookEnabled($var) + { + GPBUtil::checkBool($var); + $this->is_webhook_enabled = $var; + + return $this; + } + + /** + * Whether sentiment analysis is enabled. + * + * Generated from protobuf field bool enable_sentiment_analysis = 7; + * @return bool + */ + public function getEnableSentimentAnalysis() + { + return $this->enable_sentiment_analysis; + } + + /** + * Whether sentiment analysis is enabled. + * + * Generated from protobuf field bool enable_sentiment_analysis = 7; + * @param bool $var + * @return $this + */ + public function setEnableSentimentAnalysis($var) + { + GPBUtil::checkBool($var); + $this->enable_sentiment_analysis = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ConversationTurn/VirtualAgentOutput.php b/DialogflowCx/src/V3/ConversationTurn/VirtualAgentOutput.php new file mode 100644 index 000000000000..fd0087ab4709 --- /dev/null +++ b/DialogflowCx/src/V3/ConversationTurn/VirtualAgentOutput.php @@ -0,0 +1,354 @@ +google.cloud.dialogflow.cx.v3.ConversationTurn.VirtualAgentOutput + */ +class VirtualAgentOutput extends \Google\Protobuf\Internal\Message +{ + /** + * The session parameters available to the bot at this point. + * + * Generated from protobuf field .google.protobuf.Struct session_parameters = 4; + */ + protected $session_parameters = null; + /** + * Output only. If this is part of a [result conversation + * turn][TestCaseResult.conversation_turns], the list of differences + * between the original run and the replay for this output, if any. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestRunDifference differences = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $differences; + /** + * Required. Input only. The diagnostic + * [info][Session.DetectIntentResponse.QueryResult.diagnostic_info] + * output for the turn. Required to calculate the testing coverage. + * + * Generated from protobuf field .google.protobuf.Struct diagnostic_info = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + */ + protected $diagnostic_info = null; + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that triggered the + * response. Only name and displayName will be set. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent triggered_intent = 7; + */ + protected $triggered_intent = null; + /** + * The [Page][google.cloud.dialogflow.cx.v3.Page] on which the utterance was + * spoken. Only name and displayName will be set. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 8; + */ + protected $current_page = null; + /** + * The [text][google.cloud.dialogflow.cx.v3.ResponseMessage.Text] responses + * from the agent for the turn. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage.Text text_responses = 9; + */ + private $text_responses; + /** + * Response error from the agent in the test result. If set, other output + * is empty. + * + * Generated from protobuf field .google.rpc.Status status = 10; + */ + protected $status = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $session_parameters + * The session parameters available to the bot at this point. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TestRunDifference>|\Google\Protobuf\Internal\RepeatedField $differences + * Output only. If this is part of a [result conversation + * turn][TestCaseResult.conversation_turns], the list of differences + * between the original run and the replay for this output, if any. + * @type \Google\Protobuf\Struct $diagnostic_info + * Required. Input only. The diagnostic + * [info][Session.DetectIntentResponse.QueryResult.diagnostic_info] + * output for the turn. Required to calculate the testing coverage. + * @type \Google\Cloud\Dialogflow\Cx\V3\Intent $triggered_intent + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that triggered the + * response. Only name and displayName will be set. + * @type \Google\Cloud\Dialogflow\Cx\V3\Page $current_page + * The [Page][google.cloud.dialogflow.cx.v3.Page] on which the utterance was + * spoken. Only name and displayName will be set. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\Text>|\Google\Protobuf\Internal\RepeatedField $text_responses + * The [text][google.cloud.dialogflow.cx.v3.ResponseMessage.Text] responses + * from the agent for the turn. + * @type \Google\Rpc\Status $status + * Response error from the agent in the test result. If set, other output + * is empty. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The session parameters available to the bot at this point. + * + * Generated from protobuf field .google.protobuf.Struct session_parameters = 4; + * @return \Google\Protobuf\Struct|null + */ + public function getSessionParameters() + { + return $this->session_parameters; + } + + public function hasSessionParameters() + { + return isset($this->session_parameters); + } + + public function clearSessionParameters() + { + unset($this->session_parameters); + } + + /** + * The session parameters available to the bot at this point. + * + * Generated from protobuf field .google.protobuf.Struct session_parameters = 4; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setSessionParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->session_parameters = $var; + + return $this; + } + + /** + * Output only. If this is part of a [result conversation + * turn][TestCaseResult.conversation_turns], the list of differences + * between the original run and the replay for this output, if any. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestRunDifference differences = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDifferences() + { + return $this->differences; + } + + /** + * Output only. If this is part of a [result conversation + * turn][TestCaseResult.conversation_turns], the list of differences + * between the original run and the replay for this output, if any. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestRunDifference differences = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TestRunDifference>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDifferences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TestRunDifference::class); + $this->differences = $arr; + + return $this; + } + + /** + * Required. Input only. The diagnostic + * [info][Session.DetectIntentResponse.QueryResult.diagnostic_info] + * output for the turn. Required to calculate the testing coverage. + * + * Generated from protobuf field .google.protobuf.Struct diagnostic_info = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + * @return \Google\Protobuf\Struct|null + */ + public function getDiagnosticInfo() + { + return $this->diagnostic_info; + } + + public function hasDiagnosticInfo() + { + return isset($this->diagnostic_info); + } + + public function clearDiagnosticInfo() + { + unset($this->diagnostic_info); + } + + /** + * Required. Input only. The diagnostic + * [info][Session.DetectIntentResponse.QueryResult.diagnostic_info] + * output for the turn. Required to calculate the testing coverage. + * + * Generated from protobuf field .google.protobuf.Struct diagnostic_info = 6 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = INPUT_ONLY]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setDiagnosticInfo($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->diagnostic_info = $var; + + return $this; + } + + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that triggered the + * response. Only name and displayName will be set. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent triggered_intent = 7; + * @return \Google\Cloud\Dialogflow\Cx\V3\Intent|null + */ + public function getTriggeredIntent() + { + return $this->triggered_intent; + } + + public function hasTriggeredIntent() + { + return isset($this->triggered_intent); + } + + public function clearTriggeredIntent() + { + unset($this->triggered_intent); + } + + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that triggered the + * response. Only name and displayName will be set. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent triggered_intent = 7; + * @param \Google\Cloud\Dialogflow\Cx\V3\Intent $var + * @return $this + */ + public function setTriggeredIntent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Intent::class); + $this->triggered_intent = $var; + + return $this; + } + + /** + * The [Page][google.cloud.dialogflow.cx.v3.Page] on which the utterance was + * spoken. Only name and displayName will be set. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 8; + * @return \Google\Cloud\Dialogflow\Cx\V3\Page|null + */ + public function getCurrentPage() + { + return $this->current_page; + } + + public function hasCurrentPage() + { + return isset($this->current_page); + } + + public function clearCurrentPage() + { + unset($this->current_page); + } + + /** + * The [Page][google.cloud.dialogflow.cx.v3.Page] on which the utterance was + * spoken. Only name and displayName will be set. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 8; + * @param \Google\Cloud\Dialogflow\Cx\V3\Page $var + * @return $this + */ + public function setCurrentPage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Page::class); + $this->current_page = $var; + + return $this; + } + + /** + * The [text][google.cloud.dialogflow.cx.v3.ResponseMessage.Text] responses + * from the agent for the turn. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage.Text text_responses = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTextResponses() + { + return $this->text_responses; + } + + /** + * The [text][google.cloud.dialogflow.cx.v3.ResponseMessage.Text] responses + * from the agent for the turn. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage.Text text_responses = 9; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\Text>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTextResponses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\Text::class); + $this->text_responses = $arr; + + return $this; + } + + /** + * Response error from the agent in the test result. If set, other output + * is empty. + * + * Generated from protobuf field .google.rpc.Status status = 10; + * @return \Google\Rpc\Status|null + */ + public function getStatus() + { + return $this->status; + } + + public function hasStatus() + { + return isset($this->status); + } + + public function clearStatus() + { + unset($this->status); + } + + /** + * Response error from the agent in the test result. If set, other output + * is empty. + * + * Generated from protobuf field .google.rpc.Status status = 10; + * @param \Google\Rpc\Status $var + * @return $this + */ + public function setStatus($var) + { + GPBUtil::checkMessage($var, \Google\Rpc\Status::class); + $this->status = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/CreateAgentRequest.php b/DialogflowCx/src/V3/CreateAgentRequest.php new file mode 100644 index 000000000000..a1c16ee0edb7 --- /dev/null +++ b/DialogflowCx/src/V3/CreateAgentRequest.php @@ -0,0 +1,116 @@ +google.cloud.dialogflow.cx.v3.CreateAgentRequest + */ +class CreateAgentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location to create a agent for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The agent to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Agent agent = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $agent = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location to create a agent for. + * Format: `projects//locations/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Agent $agent + * Required. The agent to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location to create a agent for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The location to create a agent for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The agent to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Agent agent = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Agent|null + */ + public function getAgent() + { + return $this->agent; + } + + public function hasAgent() + { + return isset($this->agent); + } + + public function clearAgent() + { + unset($this->agent); + } + + /** + * Required. The agent to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Agent agent = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Agent $var + * @return $this + */ + public function setAgent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Agent::class); + $this->agent = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateEntityTypeRequest.php b/DialogflowCx/src/V3/CreateEntityTypeRequest.php new file mode 100644 index 000000000000..5a4351fad6db --- /dev/null +++ b/DialogflowCx/src/V3/CreateEntityTypeRequest.php @@ -0,0 +1,182 @@ +google.cloud.dialogflow.cx.v3.CreateEntityTypeRequest + */ +class CreateEntityTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to create a entity type for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The entity type to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType entity_type = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $entity_type = null; + /** + * The language of the following fields in `entity_type`: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to create a entity type for. + * Format: `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\EntityType $entity_type + * Required. The entity type to create. + * @type string $language_code + * The language of the following fields in `entity_type`: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\EntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to create a entity type for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to create a entity type for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The entity type to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType entity_type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\EntityType|null + */ + public function getEntityType() + { + return $this->entity_type; + } + + public function hasEntityType() + { + return isset($this->entity_type); + } + + public function clearEntityType() + { + unset($this->entity_type); + } + + /** + * Required. The entity type to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType entity_type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\EntityType $var + * @return $this + */ + public function setEntityType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\EntityType::class); + $this->entity_type = $var; + + return $this; + } + + /** + * The language of the following fields in `entity_type`: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language of the following fields in `entity_type`: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateEnvironmentRequest.php b/DialogflowCx/src/V3/CreateEnvironmentRequest.php new file mode 100644 index 000000000000..61930b27a0f0 --- /dev/null +++ b/DialogflowCx/src/V3/CreateEnvironmentRequest.php @@ -0,0 +1,120 @@ +google.cloud.dialogflow.cx.v3.CreateEnvironmentRequest + */ +class CreateEnvironmentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The environment to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment environment = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $environment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Environment $environment + * Required. The environment to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The environment to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment environment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Environment|null + */ + public function getEnvironment() + { + return $this->environment; + } + + public function hasEnvironment() + { + return isset($this->environment); + } + + public function clearEnvironment() + { + unset($this->environment); + } + + /** + * Required. The environment to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment environment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Environment $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Environment::class); + $this->environment = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateExperimentRequest.php b/DialogflowCx/src/V3/CreateExperimentRequest.php new file mode 100644 index 000000000000..14d2dd16108c --- /dev/null +++ b/DialogflowCx/src/V3/CreateExperimentRequest.php @@ -0,0 +1,124 @@ +google.cloud.dialogflow.cx.v3.CreateExperimentRequest + */ +class CreateExperimentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The experiment to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment experiment = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $experiment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents//environments/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Experiment $experiment + * Required. The experiment to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The experiment to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment experiment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment|null + */ + public function getExperiment() + { + return $this->experiment; + } + + public function hasExperiment() + { + return isset($this->experiment); + } + + public function clearExperiment() + { + unset($this->experiment); + } + + /** + * Required. The experiment to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment experiment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Experiment $var + * @return $this + */ + public function setExperiment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Experiment::class); + $this->experiment = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateFlowRequest.php b/DialogflowCx/src/V3/CreateFlowRequest.php new file mode 100644 index 000000000000..f6055b014a9e --- /dev/null +++ b/DialogflowCx/src/V3/CreateFlowRequest.php @@ -0,0 +1,186 @@ +google.cloud.dialogflow.cx.v3.CreateFlowRequest + */ +class CreateFlowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to create a flow for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The flow to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Flow flow = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $flow = null; + /** + * The language of the following fields in `flow`: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to create a flow for. + * Format: `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Flow $flow + * Required. The flow to create. + * @type string $language_code + * The language of the following fields in `flow`: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to create a flow for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to create a flow for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The flow to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Flow flow = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Flow|null + */ + public function getFlow() + { + return $this->flow; + } + + public function hasFlow() + { + return isset($this->flow); + } + + public function clearFlow() + { + unset($this->flow); + } + + /** + * Required. The flow to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Flow flow = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Flow $var + * @return $this + */ + public function setFlow($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Flow::class); + $this->flow = $var; + + return $this; + } + + /** + * The language of the following fields in `flow`: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language of the following fields in `flow`: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateIntentRequest.php b/DialogflowCx/src/V3/CreateIntentRequest.php new file mode 100644 index 000000000000..0c07af9e311a --- /dev/null +++ b/DialogflowCx/src/V3/CreateIntentRequest.php @@ -0,0 +1,174 @@ +google.cloud.dialogflow.cx.v3.CreateIntentRequest + */ +class CreateIntentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to create an intent for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The intent to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $intent = null; + /** + * The language of the following fields in `intent`: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to create an intent for. + * Format: `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Intent $intent + * Required. The intent to create. + * @type string $language_code + * The language of the following fields in `intent`: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to create an intent for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to create an intent for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The intent to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Intent|null + */ + public function getIntent() + { + return $this->intent; + } + + public function hasIntent() + { + return isset($this->intent); + } + + public function clearIntent() + { + unset($this->intent); + } + + /** + * Required. The intent to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Intent $var + * @return $this + */ + public function setIntent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Intent::class); + $this->intent = $var; + + return $this; + } + + /** + * The language of the following fields in `intent`: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language of the following fields in `intent`: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreatePageRequest.php b/DialogflowCx/src/V3/CreatePageRequest.php new file mode 100644 index 000000000000..d3ff27427c39 --- /dev/null +++ b/DialogflowCx/src/V3/CreatePageRequest.php @@ -0,0 +1,222 @@ +google.cloud.dialogflow.cx.v3.CreatePageRequest + */ +class CreatePageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The flow to create a page for. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The page to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page page = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $page = null; + /** + * The language of the following fields in `page`: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The flow to create a page for. + * Format: `projects//locations//agents//flows/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Page $page + * Required. The page to create. + * @type string $language_code + * The language of the following fields in `page`: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Required. The flow to create a page for. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The flow to create a page for. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The page to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page page = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Page|null + */ + public function getPage() + { + return $this->page; + } + + public function hasPage() + { + return isset($this->page); + } + + public function clearPage() + { + unset($this->page); + } + + /** + * Required. The page to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page page = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Page $var + * @return $this + */ + public function setPage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Page::class); + $this->page = $var; + + return $this; + } + + /** + * The language of the following fields in `page`: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language of the following fields in `page`: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateSecuritySettingsRequest.php b/DialogflowCx/src/V3/CreateSecuritySettingsRequest.php new file mode 100644 index 000000000000..e12d78240fad --- /dev/null +++ b/DialogflowCx/src/V3/CreateSecuritySettingsRequest.php @@ -0,0 +1,119 @@ +google.cloud.dialogflow.cx.v3.CreateSecuritySettingsRequest + */ +class CreateSecuritySettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location to create an + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The security settings to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SecuritySettings security_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $security_settings = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location to create an + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. + * Format: `projects//locations/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\SecuritySettings $security_settings + * Required. The security settings to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SecuritySettings::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location to create an + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The location to create an + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The security settings to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SecuritySettings security_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\SecuritySettings|null + */ + public function getSecuritySettings() + { + return $this->security_settings; + } + + public function hasSecuritySettings() + { + return isset($this->security_settings); + } + + public function clearSecuritySettings() + { + unset($this->security_settings); + } + + /** + * Required. The security settings to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SecuritySettings security_settings = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\SecuritySettings $var + * @return $this + */ + public function setSecuritySettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SecuritySettings::class); + $this->security_settings = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateSessionEntityTypeRequest.php b/DialogflowCx/src/V3/CreateSessionEntityTypeRequest.php new file mode 100644 index 000000000000..8ef5a57e6131 --- /dev/null +++ b/DialogflowCx/src/V3/CreateSessionEntityTypeRequest.php @@ -0,0 +1,132 @@ +google.cloud.dialogflow.cx.v3.CreateSessionEntityTypeRequest + */ +class CreateSessionEntityTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session to create a session entity type for. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The session entity type to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_type = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $session_entity_type = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The session to create a session entity type for. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @type \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType $session_entity_type + * Required. The session entity type to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session to create a session entity type for. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The session to create a session entity type for. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The session entity type to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType|null + */ + public function getSessionEntityType() + { + return $this->session_entity_type; + } + + public function hasSessionEntityType() + { + return isset($this->session_entity_type); + } + + public function clearSessionEntityType() + { + unset($this->session_entity_type); + } + + /** + * Required. The session entity type to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_type = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType $var + * @return $this + */ + public function setSessionEntityType($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType::class); + $this->session_entity_type = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateTestCaseRequest.php b/DialogflowCx/src/V3/CreateTestCaseRequest.php new file mode 100644 index 000000000000..538a6cf128ab --- /dev/null +++ b/DialogflowCx/src/V3/CreateTestCaseRequest.php @@ -0,0 +1,116 @@ +google.cloud.dialogflow.cx.v3.CreateTestCaseRequest + */ +class CreateTestCaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to create the test case for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The test case to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TestCase test_case = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $test_case = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to create the test case for. + * Format: `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\TestCase $test_case + * Required. The test case to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to create the test case for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to create the test case for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The test case to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TestCase test_case = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\TestCase|null + */ + public function getTestCase() + { + return $this->test_case; + } + + public function hasTestCase() + { + return isset($this->test_case); + } + + public function clearTestCase() + { + unset($this->test_case); + } + + /** + * Required. The test case to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TestCase test_case = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\TestCase $var + * @return $this + */ + public function setTestCase($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TestCase::class); + $this->test_case = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateTransitionRouteGroupRequest.php b/DialogflowCx/src/V3/CreateTransitionRouteGroupRequest.php new file mode 100644 index 000000000000..93bb1b1ff772 --- /dev/null +++ b/DialogflowCx/src/V3/CreateTransitionRouteGroupRequest.php @@ -0,0 +1,198 @@ +google.cloud.dialogflow.cx.v3.CreateTransitionRouteGroupRequest + */ +class CreateTransitionRouteGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The flow to create an + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * for. Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/` + * for agent-level groups. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The transition route group to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TransitionRouteGroup transition_route_group = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $transition_route_group = null; + /** + * The language of the following fields in `TransitionRouteGroup`: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The flow to create an + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * for. Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/` + * for agent-level groups. + * @type \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup $transition_route_group + * Required. The transition route group to create. + * @type string $language_code + * The language of the following fields in `TransitionRouteGroup`: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The flow to create an + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * for. Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/` + * for agent-level groups. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The flow to create an + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * for. Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/` + * for agent-level groups. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The transition route group to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TransitionRouteGroup transition_route_group = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup|null + */ + public function getTransitionRouteGroup() + { + return $this->transition_route_group; + } + + public function hasTransitionRouteGroup() + { + return isset($this->transition_route_group); + } + + public function clearTransitionRouteGroup() + { + unset($this->transition_route_group); + } + + /** + * Required. The transition route group to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TransitionRouteGroup transition_route_group = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup $var + * @return $this + */ + public function setTransitionRouteGroup($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup::class); + $this->transition_route_group = $var; + + return $this; + } + + /** + * The language of the following fields in `TransitionRouteGroup`: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language of the following fields in `TransitionRouteGroup`: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 3; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateVersionOperationMetadata.php b/DialogflowCx/src/V3/CreateVersionOperationMetadata.php new file mode 100644 index 000000000000..06278aed37b5 --- /dev/null +++ b/DialogflowCx/src/V3/CreateVersionOperationMetadata.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata + */ +class CreateVersionOperationMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the created version. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string version = 1 [(.google.api.resource_reference) = { + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Name of the created version. + * Format: `projects//locations//agents//flows//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * Name of the created version. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string version = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Name of the created version. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string version = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateVersionRequest.php b/DialogflowCx/src/V3/CreateVersionRequest.php new file mode 100644 index 000000000000..8498d1665598 --- /dev/null +++ b/DialogflowCx/src/V3/CreateVersionRequest.php @@ -0,0 +1,124 @@ +google.cloud.dialogflow.cx.v3.CreateVersionRequest + */ +class CreateVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an + * [Version][google.cloud.dialogflow.cx.v3.Version] for. Format: + * `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Version version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $version = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an + * [Version][google.cloud.dialogflow.cx.v3.Version] for. Format: + * `projects//locations//agents//flows/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Version $version + * Required. The version to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an + * [Version][google.cloud.dialogflow.cx.v3.Version] for. Format: + * `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an + * [Version][google.cloud.dialogflow.cx.v3.Version] for. Format: + * `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Version version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Version|null + */ + public function getVersion() + { + return $this->version; + } + + public function hasVersion() + { + return isset($this->version); + } + + public function clearVersion() + { + unset($this->version); + } + + /** + * Required. The version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Version version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Version $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Version::class); + $this->version = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateWebhookRequest.php b/DialogflowCx/src/V3/CreateWebhookRequest.php new file mode 100644 index 000000000000..5672e1590cff --- /dev/null +++ b/DialogflowCx/src/V3/CreateWebhookRequest.php @@ -0,0 +1,116 @@ +google.cloud.dialogflow.cx.v3.CreateWebhookRequest + */ +class CreateWebhookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to create a webhook for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The webhook to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Webhook webhook = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $webhook = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to create a webhook for. + * Format: `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Webhook $webhook + * Required. The webhook to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to create a webhook for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to create a webhook for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The webhook to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Webhook webhook = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Webhook|null + */ + public function getWebhook() + { + return $this->webhook; + } + + public function hasWebhook() + { + return isset($this->webhook); + } + + public function clearWebhook() + { + unset($this->webhook); + } + + /** + * Required. The webhook to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Webhook webhook = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Webhook $var + * @return $this + */ + public function setWebhook($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Webhook::class); + $this->webhook = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DataStoreConnection.php b/DialogflowCx/src/V3/DataStoreConnection.php new file mode 100644 index 000000000000..5afbee998d93 --- /dev/null +++ b/DialogflowCx/src/V3/DataStoreConnection.php @@ -0,0 +1,114 @@ +google.cloud.dialogflow.cx.v3.DataStoreConnection + */ +class DataStoreConnection extends \Google\Protobuf\Internal\Message +{ + /** + * The type of the connected data store. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DataStoreType data_store_type = 1; + */ + protected $data_store_type = 0; + /** + * The full name of the referenced data store. + * Formats: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + * `projects/{project}/locations/{location}/dataStores/{data_store}` + * + * Generated from protobuf field string data_store = 2; + */ + protected $data_store = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $data_store_type + * The type of the connected data store. + * @type string $data_store + * The full name of the referenced data store. + * Formats: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + * `projects/{project}/locations/{location}/dataStores/{data_store}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\DataStoreConnection::initOnce(); + parent::__construct($data); + } + + /** + * The type of the connected data store. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DataStoreType data_store_type = 1; + * @return int + */ + public function getDataStoreType() + { + return $this->data_store_type; + } + + /** + * The type of the connected data store. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DataStoreType data_store_type = 1; + * @param int $var + * @return $this + */ + public function setDataStoreType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\DataStoreType::class); + $this->data_store_type = $var; + + return $this; + } + + /** + * The full name of the referenced data store. + * Formats: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + * `projects/{project}/locations/{location}/dataStores/{data_store}` + * + * Generated from protobuf field string data_store = 2; + * @return string + */ + public function getDataStore() + { + return $this->data_store; + } + + /** + * The full name of the referenced data store. + * Formats: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}` + * `projects/{project}/locations/{location}/dataStores/{data_store}` + * + * Generated from protobuf field string data_store = 2; + * @param string $var + * @return $this + */ + public function setDataStore($var) + { + GPBUtil::checkString($var, True); + $this->data_store = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DataStoreType.php b/DialogflowCx/src/V3/DataStoreType.php new file mode 100644 index 000000000000..1821768ce42b --- /dev/null +++ b/DialogflowCx/src/V3/DataStoreType.php @@ -0,0 +1,70 @@ +google.cloud.dialogflow.cx.v3.DataStoreType + */ +class DataStoreType +{ + /** + * Not specified. This value indicates that the data store type is not + * specified, so it will not be used during search. + * + * Generated from protobuf enum DATA_STORE_TYPE_UNSPECIFIED = 0; + */ + const DATA_STORE_TYPE_UNSPECIFIED = 0; + /** + * A data store that contains public web content. + * + * Generated from protobuf enum PUBLIC_WEB = 1; + */ + const PUBLIC_WEB = 1; + /** + * A data store that contains unstructured private data. + * + * Generated from protobuf enum UNSTRUCTURED = 2; + */ + const UNSTRUCTURED = 2; + /** + * A data store that contains structured data (for example FAQ). + * + * Generated from protobuf enum STRUCTURED = 3; + */ + const STRUCTURED = 3; + + private static $valueToName = [ + self::DATA_STORE_TYPE_UNSPECIFIED => 'DATA_STORE_TYPE_UNSPECIFIED', + self::PUBLIC_WEB => 'PUBLIC_WEB', + self::UNSTRUCTURED => 'UNSTRUCTURED', + self::STRUCTURED => 'STRUCTURED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DialogflowCx/src/V3/DeleteAgentRequest.php b/DialogflowCx/src/V3/DeleteAgentRequest.php new file mode 100644 index 000000000000..d13f53c8bd81 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteAgentRequest.php @@ -0,0 +1,72 @@ +google.cloud.dialogflow.cx.v3.DeleteAgentRequest + */ +class DeleteAgentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the agent to delete. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the agent to delete. + * Format: `projects//locations//agents/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the agent to delete. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the agent to delete. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteEntityTypeRequest.php b/DialogflowCx/src/V3/DeleteEntityTypeRequest.php new file mode 100644 index 000000000000..c149c11be8b7 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteEntityTypeRequest.php @@ -0,0 +1,150 @@ +google.cloud.dialogflow.cx.v3.DeleteEntityTypeRequest + */ +class DeleteEntityTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the entity type to delete. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * This field has no effect for entity type not being used. + * For entity types that are used by intents or pages: + * * If `force` is set to false, an error will be returned with message + * indicating the referencing resources. + * * If `force` is set to true, Dialogflow will remove the entity type, as + * well as any references to the entity type (i.e. Page + * [parameter][google.cloud.dialogflow.cx.v3.Form.Parameter] of the entity + * type will be changed to + * '@sys.any' and intent + * [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] of the + * entity type will be removed). + * + * Generated from protobuf field bool force = 2; + */ + protected $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the entity type to delete. + * Format: `projects//locations//agents//entityTypes/`. + * @type bool $force + * This field has no effect for entity type not being used. + * For entity types that are used by intents or pages: + * * If `force` is set to false, an error will be returned with message + * indicating the referencing resources. + * * If `force` is set to true, Dialogflow will remove the entity type, as + * well as any references to the entity type (i.e. Page + * [parameter][google.cloud.dialogflow.cx.v3.Form.Parameter] of the entity + * type will be changed to + * '@sys.any' and intent + * [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] of the + * entity type will be removed). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\EntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the entity type to delete. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the entity type to delete. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * This field has no effect for entity type not being used. + * For entity types that are used by intents or pages: + * * If `force` is set to false, an error will be returned with message + * indicating the referencing resources. + * * If `force` is set to true, Dialogflow will remove the entity type, as + * well as any references to the entity type (i.e. Page + * [parameter][google.cloud.dialogflow.cx.v3.Form.Parameter] of the entity + * type will be changed to + * '@sys.any' and intent + * [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] of the + * entity type will be removed). + * + * Generated from protobuf field bool force = 2; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * This field has no effect for entity type not being used. + * For entity types that are used by intents or pages: + * * If `force` is set to false, an error will be returned with message + * indicating the referencing resources. + * * If `force` is set to true, Dialogflow will remove the entity type, as + * well as any references to the entity type (i.e. Page + * [parameter][google.cloud.dialogflow.cx.v3.Form.Parameter] of the entity + * type will be changed to + * '@sys.any' and intent + * [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] of the + * entity type will be removed). + * + * Generated from protobuf field bool force = 2; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteEnvironmentRequest.php b/DialogflowCx/src/V3/DeleteEnvironmentRequest.php new file mode 100644 index 000000000000..47bbb5c83aa7 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteEnvironmentRequest.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.DeleteEnvironmentRequest + */ +class DeleteEnvironmentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteExperimentRequest.php b/DialogflowCx/src/V3/DeleteExperimentRequest.php new file mode 100644 index 000000000000..1e46e010e975 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteExperimentRequest.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.DeleteExperimentRequest + */ +class DeleteExperimentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments//experiments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments//experiments/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments//experiments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments//experiments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteFlowRequest.php b/DialogflowCx/src/V3/DeleteFlowRequest.php new file mode 100644 index 000000000000..6ce38982ee88 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteFlowRequest.php @@ -0,0 +1,142 @@ +google.cloud.dialogflow.cx.v3.DeleteFlowRequest + */ +class DeleteFlowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the flow to delete. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * This field has no effect for flows with no incoming transitions. + * For flows with incoming transitions: + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the flow, as well as + * any transitions to the flow (i.e. [Target + * flow][EventHandler.target_flow] in event handlers or [Target + * flow][TransitionRoute.target_flow] in transition routes that point to + * this flow will be cleared). + * + * Generated from protobuf field bool force = 2; + */ + protected $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the flow to delete. + * Format: `projects//locations//agents//flows/`. + * @type bool $force + * This field has no effect for flows with no incoming transitions. + * For flows with incoming transitions: + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the flow, as well as + * any transitions to the flow (i.e. [Target + * flow][EventHandler.target_flow] in event handlers or [Target + * flow][TransitionRoute.target_flow] in transition routes that point to + * this flow will be cleared). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the flow to delete. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the flow to delete. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * This field has no effect for flows with no incoming transitions. + * For flows with incoming transitions: + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the flow, as well as + * any transitions to the flow (i.e. [Target + * flow][EventHandler.target_flow] in event handlers or [Target + * flow][TransitionRoute.target_flow] in transition routes that point to + * this flow will be cleared). + * + * Generated from protobuf field bool force = 2; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * This field has no effect for flows with no incoming transitions. + * For flows with incoming transitions: + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the flow, as well as + * any transitions to the flow (i.e. [Target + * flow][EventHandler.target_flow] in event handlers or [Target + * flow][TransitionRoute.target_flow] in transition routes that point to + * this flow will be cleared). + * + * Generated from protobuf field bool force = 2; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteIntentRequest.php b/DialogflowCx/src/V3/DeleteIntentRequest.php new file mode 100644 index 000000000000..1bb15005f590 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteIntentRequest.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.DeleteIntentRequest + */ +class DeleteIntentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the intent to delete. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the intent to delete. + * Format: `projects//locations//agents//intents/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the intent to delete. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the intent to delete. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeletePageRequest.php b/DialogflowCx/src/V3/DeletePageRequest.php new file mode 100644 index 000000000000..cecbb7c1e989 --- /dev/null +++ b/DialogflowCx/src/V3/DeletePageRequest.php @@ -0,0 +1,142 @@ +google.cloud.dialogflow.cx.v3.DeletePageRequest + */ +class DeletePageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the page to delete. + * Format: `projects//locations//agents//Flows//pages/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * This field has no effect for pages with no incoming transitions. + * For pages with incoming transitions: + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the page, as well as + * any transitions to the page (i.e. [Target + * page][EventHandler.target_page] in event handlers or [Target + * page][TransitionRoute.target_page] in transition routes that point to + * this page will be cleared). + * + * Generated from protobuf field bool force = 2; + */ + protected $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the page to delete. + * Format: `projects//locations//agents//Flows//pages/`. + * @type bool $force + * This field has no effect for pages with no incoming transitions. + * For pages with incoming transitions: + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the page, as well as + * any transitions to the page (i.e. [Target + * page][EventHandler.target_page] in event handlers or [Target + * page][TransitionRoute.target_page] in transition routes that point to + * this page will be cleared). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the page to delete. + * Format: `projects//locations//agents//Flows//pages/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the page to delete. + * Format: `projects//locations//agents//Flows//pages/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * This field has no effect for pages with no incoming transitions. + * For pages with incoming transitions: + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the page, as well as + * any transitions to the page (i.e. [Target + * page][EventHandler.target_page] in event handlers or [Target + * page][TransitionRoute.target_page] in transition routes that point to + * this page will be cleared). + * + * Generated from protobuf field bool force = 2; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * This field has no effect for pages with no incoming transitions. + * For pages with incoming transitions: + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the page, as well as + * any transitions to the page (i.e. [Target + * page][EventHandler.target_page] in event handlers or [Target + * page][TransitionRoute.target_page] in transition routes that point to + * this page will be cleared). + * + * Generated from protobuf field bool force = 2; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteSecuritySettingsRequest.php b/DialogflowCx/src/V3/DeleteSecuritySettingsRequest.php new file mode 100644 index 000000000000..4a3a10911622 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteSecuritySettingsRequest.php @@ -0,0 +1,79 @@ +google.cloud.dialogflow.cx.v3.DeleteSecuritySettingsRequest + */ +class DeleteSecuritySettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to + * delete. Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to + * delete. Format: `projects//locations//securitySettings/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SecuritySettings::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to + * delete. Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to + * delete. Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteSessionEntityTypeRequest.php b/DialogflowCx/src/V3/DeleteSessionEntityTypeRequest.php new file mode 100644 index 000000000000..4cfa73e74853 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteSessionEntityTypeRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.DeleteSessionEntityTypeRequest + */ +class DeleteSessionEntityTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the session entity type to delete. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the session entity type to delete. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the session entity type to delete. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the session entity type to delete. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteTransitionRouteGroupRequest.php b/DialogflowCx/src/V3/DeleteTransitionRouteGroupRequest.php new file mode 100644 index 000000000000..611d4f800359 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteTransitionRouteGroupRequest.php @@ -0,0 +1,142 @@ +google.cloud.dialogflow.cx.v3.DeleteTransitionRouteGroupRequest + */ +class DeleteTransitionRouteGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * to delete. Format: `projects//locations//agents//flows//transitionRouteGroups/` or `projects//locations//agents//transitionRouteGroups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * This field has no effect for transition route group that no page is using. + * If the transition route group is referenced by any page: + * * If `force` is set to false, an error will be returned with message + * indicating pages that reference the transition route group. + * * If `force` is set to true, Dialogflow will remove the transition route + * group, as well as any reference to it. + * + * Generated from protobuf field bool force = 2; + */ + protected $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * to delete. Format: `projects//locations//agents//flows//transitionRouteGroups/` or `projects//locations//agents//transitionRouteGroups/`. + * @type bool $force + * This field has no effect for transition route group that no page is using. + * If the transition route group is referenced by any page: + * * If `force` is set to false, an error will be returned with message + * indicating pages that reference the transition route group. + * * If `force` is set to true, Dialogflow will remove the transition route + * group, as well as any reference to it. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * to delete. Format: `projects//locations//agents//flows//transitionRouteGroups/` or `projects//locations//agents//transitionRouteGroups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * to delete. Format: `projects//locations//agents//flows//transitionRouteGroups/` or `projects//locations//agents//transitionRouteGroups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * This field has no effect for transition route group that no page is using. + * If the transition route group is referenced by any page: + * * If `force` is set to false, an error will be returned with message + * indicating pages that reference the transition route group. + * * If `force` is set to true, Dialogflow will remove the transition route + * group, as well as any reference to it. + * + * Generated from protobuf field bool force = 2; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * This field has no effect for transition route group that no page is using. + * If the transition route group is referenced by any page: + * * If `force` is set to false, an error will be returned with message + * indicating pages that reference the transition route group. + * * If `force` is set to true, Dialogflow will remove the transition route + * group, as well as any reference to it. + * + * Generated from protobuf field bool force = 2; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteVersionRequest.php b/DialogflowCx/src/V3/DeleteVersionRequest.php new file mode 100644 index 000000000000..64730cc67445 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteVersionRequest.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.DeleteVersionRequest + */ +class DeleteVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] + * to delete. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] + * to delete. Format: `projects//locations//agents//flows//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] + * to delete. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] + * to delete. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteWebhookRequest.php b/DialogflowCx/src/V3/DeleteWebhookRequest.php new file mode 100644 index 000000000000..9a5eaf264e25 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteWebhookRequest.php @@ -0,0 +1,142 @@ +google.cloud.dialogflow.cx.v3.DeleteWebhookRequest + */ +class DeleteWebhookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the webhook to delete. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * This field has no effect for webhook not being used. + * For webhooks that are used by pages/flows/transition route groups: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the webhook, as well + * as any references to the webhook (i.e. + * [Webhook][google.cloud.dialogflow.cx.v3.Fulfillment.webhook] and + * [tag][google.cloud.dialogflow.cx.v3.Fulfillment.tag]in fulfillments that + * point to this webhook will be removed). + * + * Generated from protobuf field bool force = 2; + */ + protected $force = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the webhook to delete. + * Format: `projects//locations//agents//webhooks/`. + * @type bool $force + * This field has no effect for webhook not being used. + * For webhooks that are used by pages/flows/transition route groups: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the webhook, as well + * as any references to the webhook (i.e. + * [Webhook][google.cloud.dialogflow.cx.v3.Fulfillment.webhook] and + * [tag][google.cloud.dialogflow.cx.v3.Fulfillment.tag]in fulfillments that + * point to this webhook will be removed). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the webhook to delete. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the webhook to delete. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * This field has no effect for webhook not being used. + * For webhooks that are used by pages/flows/transition route groups: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the webhook, as well + * as any references to the webhook (i.e. + * [Webhook][google.cloud.dialogflow.cx.v3.Fulfillment.webhook] and + * [tag][google.cloud.dialogflow.cx.v3.Fulfillment.tag]in fulfillments that + * point to this webhook will be removed). + * + * Generated from protobuf field bool force = 2; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * This field has no effect for webhook not being used. + * For webhooks that are used by pages/flows/transition route groups: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the webhook, as well + * as any references to the webhook (i.e. + * [Webhook][google.cloud.dialogflow.cx.v3.Fulfillment.webhook] and + * [tag][google.cloud.dialogflow.cx.v3.Fulfillment.tag]in fulfillments that + * point to this webhook will be removed). + * + * Generated from protobuf field bool force = 2; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeployFlowMetadata.php b/DialogflowCx/src/V3/DeployFlowMetadata.php new file mode 100644 index 000000000000..4e17e1fa9810 --- /dev/null +++ b/DialogflowCx/src/V3/DeployFlowMetadata.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.DeployFlowMetadata + */ +class DeployFlowMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Errors of running deployment tests. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError test_errors = 1; + */ + private $test_errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TestError>|\Google\Protobuf\Internal\RepeatedField $test_errors + * Errors of running deployment tests. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Errors of running deployment tests. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError test_errors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTestErrors() + { + return $this->test_errors; + } + + /** + * Errors of running deployment tests. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError test_errors = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TestError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTestErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TestError::class); + $this->test_errors = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeployFlowRequest.php b/DialogflowCx/src/V3/DeployFlowRequest.php new file mode 100644 index 000000000000..f7828bee1212 --- /dev/null +++ b/DialogflowCx/src/V3/DeployFlowRequest.php @@ -0,0 +1,118 @@ +google.cloud.dialogflow.cx.v3.DeployFlowRequest + */ +class DeployFlowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The environment to deploy the flow to. + * Format: `projects//locations//agents// + * environments/`. + * + * Generated from protobuf field string environment = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $environment = ''; + /** + * Required. The flow version to deploy. + * Format: `projects//locations//agents// + * flows//versions/`. + * + * Generated from protobuf field string flow_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $flow_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $environment + * Required. The environment to deploy the flow to. + * Format: `projects//locations//agents// + * environments/`. + * @type string $flow_version + * Required. The flow version to deploy. + * Format: `projects//locations//agents// + * flows//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The environment to deploy the flow to. + * Format: `projects//locations//agents// + * environments/`. + * + * Generated from protobuf field string environment = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Required. The environment to deploy the flow to. + * Format: `projects//locations//agents// + * environments/`. + * + * Generated from protobuf field string environment = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkString($var, True); + $this->environment = $var; + + return $this; + } + + /** + * Required. The flow version to deploy. + * Format: `projects//locations//agents// + * flows//versions/`. + * + * Generated from protobuf field string flow_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getFlowVersion() + { + return $this->flow_version; + } + + /** + * Required. The flow version to deploy. + * Format: `projects//locations//agents// + * flows//versions/`. + * + * Generated from protobuf field string flow_version = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setFlowVersion($var) + { + GPBUtil::checkString($var, True); + $this->flow_version = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeployFlowResponse.php b/DialogflowCx/src/V3/DeployFlowResponse.php new file mode 100644 index 000000000000..e49e4d591003 --- /dev/null +++ b/DialogflowCx/src/V3/DeployFlowResponse.php @@ -0,0 +1,124 @@ +google.cloud.dialogflow.cx.v3.DeployFlowResponse + */ +class DeployFlowResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The updated environment where the flow is deployed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment environment = 1; + */ + protected $environment = null; + /** + * The name of the flow version + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents// + * environments//deployments/`. + * + * Generated from protobuf field string deployment = 2; + */ + protected $deployment = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Environment $environment + * The updated environment where the flow is deployed. + * @type string $deployment + * The name of the flow version + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents// + * environments//deployments/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * The updated environment where the flow is deployed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment environment = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\Environment|null + */ + public function getEnvironment() + { + return $this->environment; + } + + public function hasEnvironment() + { + return isset($this->environment); + } + + public function clearEnvironment() + { + unset($this->environment); + } + + /** + * The updated environment where the flow is deployed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment environment = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\Environment $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Environment::class); + $this->environment = $var; + + return $this; + } + + /** + * The name of the flow version + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents// + * environments//deployments/`. + * + * Generated from protobuf field string deployment = 2; + * @return string + */ + public function getDeployment() + { + return $this->deployment; + } + + /** + * The name of the flow version + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents// + * environments//deployments/`. + * + * Generated from protobuf field string deployment = 2; + * @param string $var + * @return $this + */ + public function setDeployment($var) + { + GPBUtil::checkString($var, True); + $this->deployment = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Deployment.php b/DialogflowCx/src/V3/Deployment.php new file mode 100644 index 000000000000..0aaf5de05157 --- /dev/null +++ b/DialogflowCx/src/V3/Deployment.php @@ -0,0 +1,286 @@ +google.cloud.dialogflow.cx.v3.Deployment + */ +class Deployment extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the deployment. + * Format: projects//locations//agents//environments//deployments/. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * The name of the flow version for this deployment. + * Format: projects//locations//agents//flows//versions/. + * + * Generated from protobuf field string flow_version = 2 [(.google.api.resource_reference) = { + */ + protected $flow_version = ''; + /** + * The current state of the deployment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Deployment.State state = 3; + */ + protected $state = 0; + /** + * Result of the deployment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Deployment.Result result = 4; + */ + protected $result = null; + /** + * Start time of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5; + */ + protected $start_time = null; + /** + * End time of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the deployment. + * Format: projects//locations//agents//environments//deployments/. + * @type string $flow_version + * The name of the flow version for this deployment. + * Format: projects//locations//agents//flows//versions/. + * @type int $state + * The current state of the deployment. + * @type \Google\Cloud\Dialogflow\Cx\V3\Deployment\Result $result + * Result of the deployment. + * @type \Google\Protobuf\Timestamp $start_time + * Start time of this deployment. + * @type \Google\Protobuf\Timestamp $end_time + * End time of this deployment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Deployment::initOnce(); + parent::__construct($data); + } + + /** + * The name of the deployment. + * Format: projects//locations//agents//environments//deployments/. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the deployment. + * Format: projects//locations//agents//environments//deployments/. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The name of the flow version for this deployment. + * Format: projects//locations//agents//flows//versions/. + * + * Generated from protobuf field string flow_version = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getFlowVersion() + { + return $this->flow_version; + } + + /** + * The name of the flow version for this deployment. + * Format: projects//locations//agents//flows//versions/. + * + * Generated from protobuf field string flow_version = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setFlowVersion($var) + { + GPBUtil::checkString($var, True); + $this->flow_version = $var; + + return $this; + } + + /** + * The current state of the deployment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Deployment.State state = 3; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the deployment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Deployment.State state = 3; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Deployment\State::class); + $this->state = $var; + + return $this; + } + + /** + * Result of the deployment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Deployment.Result result = 4; + * @return \Google\Cloud\Dialogflow\Cx\V3\Deployment\Result|null + */ + public function getResult() + { + return $this->result; + } + + public function hasResult() + { + return isset($this->result); + } + + public function clearResult() + { + unset($this->result); + } + + /** + * Result of the deployment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Deployment.Result result = 4; + * @param \Google\Cloud\Dialogflow\Cx\V3\Deployment\Result $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Deployment\Result::class); + $this->result = $var; + + return $this; + } + + /** + * Start time of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start time of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * End time of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * End time of this deployment. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Deployment/Result.php b/DialogflowCx/src/V3/Deployment/Result.php new file mode 100644 index 000000000000..42dcc0925bff --- /dev/null +++ b/DialogflowCx/src/V3/Deployment/Result.php @@ -0,0 +1,118 @@ +google.cloud.dialogflow.cx.v3.Deployment.Result + */ +class Result extends \Google\Protobuf\Internal\Message +{ + /** + * Results of test cases running before the deployment. + * Format: `projects//locations//agents//testCases//results/`. + * + * Generated from protobuf field repeated string deployment_test_results = 1 [(.google.api.resource_reference) = { + */ + private $deployment_test_results; + /** + * The name of the experiment triggered by this deployment. + * Format: projects//locations//agents//environments//experiments/. + * + * Generated from protobuf field string experiment = 2 [(.google.api.resource_reference) = { + */ + protected $experiment = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $deployment_test_results + * Results of test cases running before the deployment. + * Format: `projects//locations//agents//testCases//results/`. + * @type string $experiment + * The name of the experiment triggered by this deployment. + * Format: projects//locations//agents//environments//experiments/. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Deployment::initOnce(); + parent::__construct($data); + } + + /** + * Results of test cases running before the deployment. + * Format: `projects//locations//agents//testCases//results/`. + * + * Generated from protobuf field repeated string deployment_test_results = 1 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeploymentTestResults() + { + return $this->deployment_test_results; + } + + /** + * Results of test cases running before the deployment. + * Format: `projects//locations//agents//testCases//results/`. + * + * Generated from protobuf field repeated string deployment_test_results = 1 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeploymentTestResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->deployment_test_results = $arr; + + return $this; + } + + /** + * The name of the experiment triggered by this deployment. + * Format: projects//locations//agents//environments//experiments/. + * + * Generated from protobuf field string experiment = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getExperiment() + { + return $this->experiment; + } + + /** + * The name of the experiment triggered by this deployment. + * Format: projects//locations//agents//environments//experiments/. + * + * Generated from protobuf field string experiment = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setExperiment($var) + { + GPBUtil::checkString($var, True); + $this->experiment = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Deployment/State.php b/DialogflowCx/src/V3/Deployment/State.php new file mode 100644 index 000000000000..2ddbde1bd637 --- /dev/null +++ b/DialogflowCx/src/V3/Deployment/State.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.Deployment.State + */ +class State +{ + /** + * State unspecified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The deployment is running. + * + * Generated from protobuf enum RUNNING = 1; + */ + const RUNNING = 1; + /** + * The deployment succeeded. + * + * Generated from protobuf enum SUCCEEDED = 2; + */ + const SUCCEEDED = 2; + /** + * The deployment failed. + * + * Generated from protobuf enum FAILED = 3; + */ + const FAILED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::RUNNING => 'RUNNING', + self::SUCCEEDED => 'SUCCEEDED', + self::FAILED => 'FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/DeploymentsClient.php b/DialogflowCx/src/V3/DeploymentsClient.php new file mode 100644 index 000000000000..0af1b1212cf7 --- /dev/null +++ b/DialogflowCx/src/V3/DeploymentsClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.DetectIntentRequest + */ +class DetectIntentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * The parameters of this query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryParameters query_params = 2; + */ + protected $query_params = null; + /** + * Required. The input specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput query_input = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query_input = null; + /** + * Instructs the speech synthesizer how to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 4; + */ + protected $output_audio_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). + * @type \Google\Cloud\Dialogflow\Cx\V3\QueryParameters $query_params + * The parameters of this query. + * @type \Google\Cloud\Dialogflow\Cx\V3\QueryInput $query_input + * Required. The input specification. + * @type \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $output_audio_config + * Instructs the speech synthesizer how to generate the output audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * The parameters of this query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryParameters query_params = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\QueryParameters|null + */ + public function getQueryParams() + { + return $this->query_params; + } + + public function hasQueryParams() + { + return isset($this->query_params); + } + + public function clearQueryParams() + { + unset($this->query_params); + } + + /** + * The parameters of this query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryParameters query_params = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\QueryParameters $var + * @return $this + */ + public function setQueryParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\QueryParameters::class); + $this->query_params = $var; + + return $this; + } + + /** + * Required. The input specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput query_input = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\QueryInput|null + */ + public function getQueryInput() + { + return $this->query_input; + } + + public function hasQueryInput() + { + return isset($this->query_input); + } + + public function clearQueryInput() + { + unset($this->query_input); + } + + /** + * Required. The input specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput query_input = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\QueryInput $var + * @return $this + */ + public function setQueryInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\QueryInput::class); + $this->query_input = $var; + + return $this; + } + + /** + * Instructs the speech synthesizer how to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 4; + * @return \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig|null + */ + public function getOutputAudioConfig() + { + return $this->output_audio_config; + } + + public function hasOutputAudioConfig() + { + return isset($this->output_audio_config); + } + + public function clearOutputAudioConfig() + { + unset($this->output_audio_config); + } + + /** + * Instructs the speech synthesizer how to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 4; + * @param \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $var + * @return $this + */ + public function setOutputAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig::class); + $this->output_audio_config = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DetectIntentResponse.php b/DialogflowCx/src/V3/DetectIntentResponse.php new file mode 100644 index 000000000000..fc0fb78e21c2 --- /dev/null +++ b/DialogflowCx/src/V3/DetectIntentResponse.php @@ -0,0 +1,305 @@ +google.cloud.dialogflow.cx.v3.DetectIntentResponse + */ +class DetectIntentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The unique identifier of the response. It can be used to + * locate a response in the training example set or for reporting issues. + * + * Generated from protobuf field string response_id = 1; + */ + protected $response_id = ''; + /** + * The result of the conversational query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryResult query_result = 2; + */ + protected $query_result = null; + /** + * 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.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_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. + * + * Generated from protobuf field bytes output_audio = 4; + */ + protected $output_audio = ''; + /** + * The config used by the speech synthesizer to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 5; + */ + protected $output_audio_config = null; + /** + * Response type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponse.ResponseType response_type = 6; + */ + protected $response_type = 0; + /** + * Indicates whether the partial response can be cancelled when a later + * response arrives. e.g. if the agent specified some music as partial + * response, it can be cancelled. + * + * Generated from protobuf field bool allow_cancellation = 7; + */ + protected $allow_cancellation = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $response_id + * Output only. The unique identifier of the response. It can be used to + * locate a response in the training example set or for reporting issues. + * @type \Google\Cloud\Dialogflow\Cx\V3\QueryResult $query_result + * The result of the conversational query. + * @type string $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.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_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. + * @type \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $output_audio_config + * The config used by the speech synthesizer to generate the output audio. + * @type int $response_type + * Response type. + * @type bool $allow_cancellation + * Indicates whether the partial response can be cancelled when a later + * response arrives. e.g. if the agent specified some music as partial + * response, it can be cancelled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The unique identifier of the response. It can be used to + * locate a response in the training example set or for reporting issues. + * + * Generated from protobuf field string response_id = 1; + * @return string + */ + public function getResponseId() + { + return $this->response_id; + } + + /** + * Output only. The unique identifier of the response. It can be used to + * locate a response in the training example set or for reporting issues. + * + * Generated from protobuf field string response_id = 1; + * @param string $var + * @return $this + */ + public function setResponseId($var) + { + GPBUtil::checkString($var, True); + $this->response_id = $var; + + return $this; + } + + /** + * The result of the conversational query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryResult query_result = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\QueryResult|null + */ + public function getQueryResult() + { + return $this->query_result; + } + + public function hasQueryResult() + { + return isset($this->query_result); + } + + public function clearQueryResult() + { + unset($this->query_result); + } + + /** + * The result of the conversational query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryResult query_result = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\QueryResult $var + * @return $this + */ + public function setQueryResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\QueryResult::class); + $this->query_result = $var; + + return $this; + } + + /** + * 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.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_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. + * + * Generated from protobuf field bytes output_audio = 4; + * @return string + */ + public function getOutputAudio() + { + return $this->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.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_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. + * + * Generated from protobuf field bytes output_audio = 4; + * @param string $var + * @return $this + */ + public function setOutputAudio($var) + { + GPBUtil::checkString($var, False); + $this->output_audio = $var; + + return $this; + } + + /** + * The config used by the speech synthesizer to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 5; + * @return \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig|null + */ + public function getOutputAudioConfig() + { + return $this->output_audio_config; + } + + public function hasOutputAudioConfig() + { + return isset($this->output_audio_config); + } + + public function clearOutputAudioConfig() + { + unset($this->output_audio_config); + } + + /** + * The config used by the speech synthesizer to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 5; + * @param \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $var + * @return $this + */ + public function setOutputAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig::class); + $this->output_audio_config = $var; + + return $this; + } + + /** + * Response type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponse.ResponseType response_type = 6; + * @return int + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * Response type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponse.ResponseType response_type = 6; + * @param int $var + * @return $this + */ + public function setResponseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\DetectIntentResponse\ResponseType::class); + $this->response_type = $var; + + return $this; + } + + /** + * Indicates whether the partial response can be cancelled when a later + * response arrives. e.g. if the agent specified some music as partial + * response, it can be cancelled. + * + * Generated from protobuf field bool allow_cancellation = 7; + * @return bool + */ + public function getAllowCancellation() + { + return $this->allow_cancellation; + } + + /** + * Indicates whether the partial response can be cancelled when a later + * response arrives. e.g. if the agent specified some music as partial + * response, it can be cancelled. + * + * Generated from protobuf field bool allow_cancellation = 7; + * @param bool $var + * @return $this + */ + public function setAllowCancellation($var) + { + GPBUtil::checkBool($var); + $this->allow_cancellation = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DetectIntentResponse/ResponseType.php b/DialogflowCx/src/V3/DetectIntentResponse/ResponseType.php new file mode 100644 index 000000000000..644e35ce5906 --- /dev/null +++ b/DialogflowCx/src/V3/DetectIntentResponse/ResponseType.php @@ -0,0 +1,68 @@ +google.cloud.dialogflow.cx.v3.DetectIntentResponse.ResponseType + */ +class ResponseType +{ + /** + * Not specified. This should never happen. + * + * Generated from protobuf enum RESPONSE_TYPE_UNSPECIFIED = 0; + */ + const RESPONSE_TYPE_UNSPECIFIED = 0; + /** + * Partial response. e.g. Aggregated responses in a Fulfillment that enables + * `return_partial_response` can be returned as partial response. + * WARNING: partial response is not eligible for barge-in. + * + * Generated from protobuf enum PARTIAL = 1; + */ + const PARTIAL = 1; + /** + * Final response. + * + * Generated from protobuf enum FINAL = 2; + */ + const PBFINAL = 2; + + private static $valueToName = [ + self::RESPONSE_TYPE_UNSPECIFIED => 'RESPONSE_TYPE_UNSPECIFIED', + self::PARTIAL => 'PARTIAL', + self::PBFINAL => 'FINAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/DtmfInput.php b/DialogflowCx/src/V3/DtmfInput.php new file mode 100644 index 000000000000..654ce0c03572 --- /dev/null +++ b/DialogflowCx/src/V3/DtmfInput.php @@ -0,0 +1,101 @@ +google.cloud.dialogflow.cx.v3.DtmfInput + */ +class DtmfInput extends \Google\Protobuf\Internal\Message +{ + /** + * The dtmf digits. + * + * Generated from protobuf field string digits = 1; + */ + protected $digits = ''; + /** + * The finish digit (if any). + * + * Generated from protobuf field string finish_digit = 2; + */ + protected $finish_digit = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $digits + * The dtmf digits. + * @type string $finish_digit + * The finish digit (if any). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * The dtmf digits. + * + * Generated from protobuf field string digits = 1; + * @return string + */ + public function getDigits() + { + return $this->digits; + } + + /** + * The dtmf digits. + * + * Generated from protobuf field string digits = 1; + * @param string $var + * @return $this + */ + public function setDigits($var) + { + GPBUtil::checkString($var, True); + $this->digits = $var; + + return $this; + } + + /** + * The finish digit (if any). + * + * Generated from protobuf field string finish_digit = 2; + * @return string + */ + public function getFinishDigit() + { + return $this->finish_digit; + } + + /** + * The finish digit (if any). + * + * Generated from protobuf field string finish_digit = 2; + * @param string $var + * @return $this + */ + public function setFinishDigit($var) + { + GPBUtil::checkString($var, True); + $this->finish_digit = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/EntityType.php b/DialogflowCx/src/V3/EntityType.php new file mode 100644 index 000000000000..f99d1e426b82 --- /dev/null +++ b/DialogflowCx/src/V3/EntityType.php @@ -0,0 +1,371 @@ +google.cloud.dialogflow.cx.v3.EntityType + */ +class EntityType extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the entity type. + * Required for + * [EntityTypes.UpdateEntityType][google.cloud.dialogflow.cx.v3.EntityTypes.UpdateEntityType]. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the entity type, unique within the + * agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Required. Indicates the kind of entity type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType.Kind kind = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $kind = 0; + /** + * Indicates whether the entity type can be automatically expanded. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType.AutoExpansionMode auto_expansion_mode = 4; + */ + protected $auto_expansion_mode = 0; + /** + * The collection of entity entries associated with the entity type. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType.Entity entities = 5; + */ + private $entities; + /** + * Collection of exceptional words and phrases that shouldn't be matched. + * For example, if you have a size entity type with entry `giant`(an + * adjective), you might consider adding `giants`(a noun) as an exclusion. + * If the kind of entity type is `KIND_MAP`, then the phrases specified by + * entities and excluded phrases should be mutually exclusive. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType.ExcludedPhrase excluded_phrases = 6; + */ + private $excluded_phrases; + /** + * Enables fuzzy entity extraction during classification. + * + * Generated from protobuf field bool enable_fuzzy_extraction = 7; + */ + protected $enable_fuzzy_extraction = false; + /** + * Indicates whether parameters of the entity type should be redacted in log. + * If redaction is enabled, page parameters and intent parameters referring to + * the entity type will be replaced by parameter name when logging. + * + * Generated from protobuf field bool redact = 9; + */ + protected $redact = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the entity type. + * Required for + * [EntityTypes.UpdateEntityType][google.cloud.dialogflow.cx.v3.EntityTypes.UpdateEntityType]. + * Format: `projects//locations//agents//entityTypes/`. + * @type string $display_name + * Required. The human-readable name of the entity type, unique within the + * agent. + * @type int $kind + * Required. Indicates the kind of entity type. + * @type int $auto_expansion_mode + * Indicates whether the entity type can be automatically expanded. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\EntityType\Entity>|\Google\Protobuf\Internal\RepeatedField $entities + * The collection of entity entries associated with the entity type. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\EntityType\ExcludedPhrase>|\Google\Protobuf\Internal\RepeatedField $excluded_phrases + * Collection of exceptional words and phrases that shouldn't be matched. + * For example, if you have a size entity type with entry `giant`(an + * adjective), you might consider adding `giants`(a noun) as an exclusion. + * If the kind of entity type is `KIND_MAP`, then the phrases specified by + * entities and excluded phrases should be mutually exclusive. + * @type bool $enable_fuzzy_extraction + * Enables fuzzy entity extraction during classification. + * @type bool $redact + * Indicates whether parameters of the entity type should be redacted in log. + * If redaction is enabled, page parameters and intent parameters referring to + * the entity type will be replaced by parameter name when logging. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\EntityType::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the entity type. + * Required for + * [EntityTypes.UpdateEntityType][google.cloud.dialogflow.cx.v3.EntityTypes.UpdateEntityType]. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the entity type. + * Required for + * [EntityTypes.UpdateEntityType][google.cloud.dialogflow.cx.v3.EntityTypes.UpdateEntityType]. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the entity type, unique within the + * agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the entity type, unique within the + * agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. Indicates the kind of entity type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType.Kind kind = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getKind() + { + return $this->kind; + } + + /** + * Required. Indicates the kind of entity type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType.Kind kind = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setKind($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\EntityType\Kind::class); + $this->kind = $var; + + return $this; + } + + /** + * Indicates whether the entity type can be automatically expanded. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType.AutoExpansionMode auto_expansion_mode = 4; + * @return int + */ + public function getAutoExpansionMode() + { + return $this->auto_expansion_mode; + } + + /** + * Indicates whether the entity type can be automatically expanded. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EntityType.AutoExpansionMode auto_expansion_mode = 4; + * @param int $var + * @return $this + */ + public function setAutoExpansionMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\EntityType\AutoExpansionMode::class); + $this->auto_expansion_mode = $var; + + return $this; + } + + /** + * The collection of entity entries associated with the entity type. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType.Entity entities = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntities() + { + return $this->entities; + } + + /** + * The collection of entity entries associated with the entity type. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType.Entity entities = 5; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\EntityType\Entity>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntities($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\EntityType\Entity::class); + $this->entities = $arr; + + return $this; + } + + /** + * Collection of exceptional words and phrases that shouldn't be matched. + * For example, if you have a size entity type with entry `giant`(an + * adjective), you might consider adding `giants`(a noun) as an exclusion. + * If the kind of entity type is `KIND_MAP`, then the phrases specified by + * entities and excluded phrases should be mutually exclusive. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType.ExcludedPhrase excluded_phrases = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExcludedPhrases() + { + return $this->excluded_phrases; + } + + /** + * Collection of exceptional words and phrases that shouldn't be matched. + * For example, if you have a size entity type with entry `giant`(an + * adjective), you might consider adding `giants`(a noun) as an exclusion. + * If the kind of entity type is `KIND_MAP`, then the phrases specified by + * entities and excluded phrases should be mutually exclusive. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType.ExcludedPhrase excluded_phrases = 6; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\EntityType\ExcludedPhrase>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExcludedPhrases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\EntityType\ExcludedPhrase::class); + $this->excluded_phrases = $arr; + + return $this; + } + + /** + * Enables fuzzy entity extraction during classification. + * + * Generated from protobuf field bool enable_fuzzy_extraction = 7; + * @return bool + */ + public function getEnableFuzzyExtraction() + { + return $this->enable_fuzzy_extraction; + } + + /** + * Enables fuzzy entity extraction during classification. + * + * Generated from protobuf field bool enable_fuzzy_extraction = 7; + * @param bool $var + * @return $this + */ + public function setEnableFuzzyExtraction($var) + { + GPBUtil::checkBool($var); + $this->enable_fuzzy_extraction = $var; + + return $this; + } + + /** + * Indicates whether parameters of the entity type should be redacted in log. + * If redaction is enabled, page parameters and intent parameters referring to + * the entity type will be replaced by parameter name when logging. + * + * Generated from protobuf field bool redact = 9; + * @return bool + */ + public function getRedact() + { + return $this->redact; + } + + /** + * Indicates whether parameters of the entity type should be redacted in log. + * If redaction is enabled, page parameters and intent parameters referring to + * the entity type will be replaced by parameter name when logging. + * + * Generated from protobuf field bool redact = 9; + * @param bool $var + * @return $this + */ + public function setRedact($var) + { + GPBUtil::checkBool($var); + $this->redact = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/EntityType/AutoExpansionMode.php b/DialogflowCx/src/V3/EntityType/AutoExpansionMode.php new file mode 100644 index 000000000000..2774938d219c --- /dev/null +++ b/DialogflowCx/src/V3/EntityType/AutoExpansionMode.php @@ -0,0 +1,58 @@ +google.cloud.dialogflow.cx.v3.EntityType.AutoExpansionMode + */ +class AutoExpansionMode +{ + /** + * Auto expansion disabled for the entity. + * + * Generated from protobuf enum AUTO_EXPANSION_MODE_UNSPECIFIED = 0; + */ + const AUTO_EXPANSION_MODE_UNSPECIFIED = 0; + /** + * Allows an agent to recognize values that have not been explicitly + * listed in the entity. + * + * Generated from protobuf enum AUTO_EXPANSION_MODE_DEFAULT = 1; + */ + const AUTO_EXPANSION_MODE_DEFAULT = 1; + + private static $valueToName = [ + self::AUTO_EXPANSION_MODE_UNSPECIFIED => 'AUTO_EXPANSION_MODE_UNSPECIFIED', + self::AUTO_EXPANSION_MODE_DEFAULT => 'AUTO_EXPANSION_MODE_DEFAULT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/EntityType/Entity.php b/DialogflowCx/src/V3/EntityType/Entity.php new file mode 100644 index 000000000000..6d1c6ae6270c --- /dev/null +++ b/DialogflowCx/src/V3/EntityType/Entity.php @@ -0,0 +1,146 @@ +google.cloud.dialogflow.cx.v3.EntityType.Entity + */ +class Entity extends \Google\Protobuf\Internal\Message +{ + /** + * 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 canonical 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). + * + * Generated from protobuf field string value = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $value = ''; + /** + * 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`. + * + * Generated from protobuf field repeated string synonyms = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $synonyms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $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 canonical 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). + * @type array|\Google\Protobuf\Internal\RepeatedField $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`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\EntityType::initOnce(); + parent::__construct($data); + } + + /** + * 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 canonical 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). + * + * Generated from protobuf field string value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getValue() + { + return $this->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 canonical 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). + * + * Generated from protobuf field string value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * 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`. + * + * Generated from protobuf field repeated string synonyms = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSynonyms() + { + return $this->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`. + * + * Generated from protobuf field repeated string synonyms = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSynonyms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->synonyms = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/EntityType/ExcludedPhrase.php b/DialogflowCx/src/V3/EntityType/ExcludedPhrase.php new file mode 100644 index 000000000000..c4018b5b9952 --- /dev/null +++ b/DialogflowCx/src/V3/EntityType/ExcludedPhrase.php @@ -0,0 +1,68 @@ +google.cloud.dialogflow.cx.v3.EntityType.ExcludedPhrase + */ +class ExcludedPhrase extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The word or phrase to be excluded. + * + * Generated from protobuf field string value = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $value = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $value + * Required. The word or phrase to be excluded. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\EntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The word or phrase to be excluded. + * + * Generated from protobuf field string value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * Required. The word or phrase to be excluded. + * + * Generated from protobuf field string value = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/EntityType/Kind.php b/DialogflowCx/src/V3/EntityType/Kind.php new file mode 100644 index 000000000000..8f7111995bc9 --- /dev/null +++ b/DialogflowCx/src/V3/EntityType/Kind.php @@ -0,0 +1,73 @@ +google.cloud.dialogflow.cx.v3.EntityType.Kind + */ +class Kind +{ + /** + * Not specified. This value should be never used. + * + * Generated from protobuf enum KIND_UNSPECIFIED = 0; + */ + const KIND_UNSPECIFIED = 0; + /** + * Map entity types allow mapping of a group of synonyms to a canonical + * value. + * + * Generated from protobuf enum KIND_MAP = 1; + */ + const KIND_MAP = 1; + /** + * List entity types contain a set of entries that do not map to canonical + * values. However, list entity types can contain references to other entity + * types (with or without aliases). + * + * Generated from protobuf enum KIND_LIST = 2; + */ + const KIND_LIST = 2; + /** + * Regexp entity types allow to specify regular expressions in entries + * values. + * + * Generated from protobuf enum KIND_REGEXP = 3; + */ + const KIND_REGEXP = 3; + + private static $valueToName = [ + self::KIND_UNSPECIFIED => 'KIND_UNSPECIFIED', + self::KIND_MAP => 'KIND_MAP', + self::KIND_LIST => 'KIND_LIST', + self::KIND_REGEXP => 'KIND_REGEXP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/EntityTypesClient.php b/DialogflowCx/src/V3/EntityTypesClient.php new file mode 100644 index 000000000000..47f507db136d --- /dev/null +++ b/DialogflowCx/src/V3/EntityTypesClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.Environment + */ +class Environment extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the environment. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the environment (unique in an agent). + * Limit of 64 characters. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * The human-readable description of the environment. The maximum length is + * 500 characters. If exceeded, the request is rejected. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * A list of configurations for flow versions. You should include version + * configs for all flows that are reachable from [`Start + * Flow`][Agent.start_flow] in the agent. Otherwise, an error will be + * returned. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment.VersionConfig version_configs = 6; + */ + private $version_configs; + /** + * Output only. Update time of this environment. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * The test cases config for continuous tests of this environment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig test_cases_config = 7; + */ + protected $test_cases_config = null; + /** + * The webhook configuration for this environment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment.WebhookConfig webhook_config = 10; + */ + protected $webhook_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the environment. + * Format: `projects//locations//agents//environments/`. + * @type string $display_name + * Required. The human-readable name of the environment (unique in an agent). + * Limit of 64 characters. + * @type string $description + * The human-readable description of the environment. The maximum length is + * 500 characters. If exceeded, the request is rejected. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Environment\VersionConfig>|\Google\Protobuf\Internal\RepeatedField $version_configs + * A list of configurations for flow versions. You should include version + * configs for all flows that are reachable from [`Start + * Flow`][Agent.start_flow] in the agent. Otherwise, an error will be + * returned. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Update time of this environment. + * @type \Google\Cloud\Dialogflow\Cx\V3\Environment\TestCasesConfig $test_cases_config + * The test cases config for continuous tests of this environment. + * @type \Google\Cloud\Dialogflow\Cx\V3\Environment\WebhookConfig $webhook_config + * The webhook configuration for this environment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * The name of the environment. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the environment. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the environment (unique in an agent). + * Limit of 64 characters. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the environment (unique in an agent). + * Limit of 64 characters. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The human-readable description of the environment. The maximum length is + * 500 characters. If exceeded, the request is rejected. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The human-readable description of the environment. The maximum length is + * 500 characters. If exceeded, the request is rejected. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * A list of configurations for flow versions. You should include version + * configs for all flows that are reachable from [`Start + * Flow`][Agent.start_flow] in the agent. Otherwise, an error will be + * returned. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment.VersionConfig version_configs = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersionConfigs() + { + return $this->version_configs; + } + + /** + * A list of configurations for flow versions. You should include version + * configs for all flows that are reachable from [`Start + * Flow`][Agent.start_flow] in the agent. Otherwise, an error will be + * returned. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment.VersionConfig version_configs = 6; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Environment\VersionConfig>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersionConfigs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Environment\VersionConfig::class); + $this->version_configs = $arr; + + return $this; + } + + /** + * Output only. Update time of this environment. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Update time of this environment. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * The test cases config for continuous tests of this environment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig test_cases_config = 7; + * @return \Google\Cloud\Dialogflow\Cx\V3\Environment\TestCasesConfig|null + */ + public function getTestCasesConfig() + { + return $this->test_cases_config; + } + + public function hasTestCasesConfig() + { + return isset($this->test_cases_config); + } + + public function clearTestCasesConfig() + { + unset($this->test_cases_config); + } + + /** + * The test cases config for continuous tests of this environment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig test_cases_config = 7; + * @param \Google\Cloud\Dialogflow\Cx\V3\Environment\TestCasesConfig $var + * @return $this + */ + public function setTestCasesConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Environment\TestCasesConfig::class); + $this->test_cases_config = $var; + + return $this; + } + + /** + * The webhook configuration for this environment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment.WebhookConfig webhook_config = 10; + * @return \Google\Cloud\Dialogflow\Cx\V3\Environment\WebhookConfig|null + */ + public function getWebhookConfig() + { + return $this->webhook_config; + } + + public function hasWebhookConfig() + { + return isset($this->webhook_config); + } + + public function clearWebhookConfig() + { + unset($this->webhook_config); + } + + /** + * The webhook configuration for this environment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Environment.WebhookConfig webhook_config = 10; + * @param \Google\Cloud\Dialogflow\Cx\V3\Environment\WebhookConfig $var + * @return $this + */ + public function setWebhookConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Environment\WebhookConfig::class); + $this->webhook_config = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Environment/TestCasesConfig.php b/DialogflowCx/src/V3/Environment/TestCasesConfig.php new file mode 100644 index 000000000000..035ef87264c8 --- /dev/null +++ b/DialogflowCx/src/V3/Environment/TestCasesConfig.php @@ -0,0 +1,160 @@ +google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig + */ +class TestCasesConfig extends \Google\Protobuf\Internal\Message +{ + /** + * A list of test case names to run. They should be under the same agent. + * Format of each test case name: `projects//locations/ + * /agents//testCases/` + * + * Generated from protobuf field repeated string test_cases = 1 [(.google.api.resource_reference) = { + */ + private $test_cases; + /** + * Whether to run test cases in + * [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases] + * periodically. Default false. If set to true, run once a day. + * + * Generated from protobuf field bool enable_continuous_run = 2; + */ + protected $enable_continuous_run = false; + /** + * Whether to run test cases in + * [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases] + * before deploying a flow version to the environment. Default false. + * + * Generated from protobuf field bool enable_predeployment_run = 3; + */ + protected $enable_predeployment_run = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $test_cases + * A list of test case names to run. They should be under the same agent. + * Format of each test case name: `projects//locations/ + * /agents//testCases/` + * @type bool $enable_continuous_run + * Whether to run test cases in + * [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases] + * periodically. Default false. If set to true, run once a day. + * @type bool $enable_predeployment_run + * Whether to run test cases in + * [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases] + * before deploying a flow version to the environment. Default false. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * A list of test case names to run. They should be under the same agent. + * Format of each test case name: `projects//locations/ + * /agents//testCases/` + * + * Generated from protobuf field repeated string test_cases = 1 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTestCases() + { + return $this->test_cases; + } + + /** + * A list of test case names to run. They should be under the same agent. + * Format of each test case name: `projects//locations/ + * /agents//testCases/` + * + * Generated from protobuf field repeated string test_cases = 1 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTestCases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->test_cases = $arr; + + return $this; + } + + /** + * Whether to run test cases in + * [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases] + * periodically. Default false. If set to true, run once a day. + * + * Generated from protobuf field bool enable_continuous_run = 2; + * @return bool + */ + public function getEnableContinuousRun() + { + return $this->enable_continuous_run; + } + + /** + * Whether to run test cases in + * [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases] + * periodically. Default false. If set to true, run once a day. + * + * Generated from protobuf field bool enable_continuous_run = 2; + * @param bool $var + * @return $this + */ + public function setEnableContinuousRun($var) + { + GPBUtil::checkBool($var); + $this->enable_continuous_run = $var; + + return $this; + } + + /** + * Whether to run test cases in + * [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases] + * before deploying a flow version to the environment. Default false. + * + * Generated from protobuf field bool enable_predeployment_run = 3; + * @return bool + */ + public function getEnablePredeploymentRun() + { + return $this->enable_predeployment_run; + } + + /** + * Whether to run test cases in + * [TestCasesConfig.test_cases][google.cloud.dialogflow.cx.v3.Environment.TestCasesConfig.test_cases] + * before deploying a flow version to the environment. Default false. + * + * Generated from protobuf field bool enable_predeployment_run = 3; + * @param bool $var + * @return $this + */ + public function setEnablePredeploymentRun($var) + { + GPBUtil::checkBool($var); + $this->enable_predeployment_run = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Environment/VersionConfig.php b/DialogflowCx/src/V3/Environment/VersionConfig.php new file mode 100644 index 000000000000..b0627d616560 --- /dev/null +++ b/DialogflowCx/src/V3/Environment/VersionConfig.php @@ -0,0 +1,72 @@ +google.cloud.dialogflow.cx.v3.Environment.VersionConfig + */ +class VersionConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format: projects//locations//agents//flows//versions/. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * Required. Format: projects//locations//agents//flows//versions/. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format: projects//locations//agents//flows//versions/. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * Required. Format: projects//locations//agents//flows//versions/. + * + * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Environment/WebhookConfig.php b/DialogflowCx/src/V3/Environment/WebhookConfig.php new file mode 100644 index 000000000000..a2b6f0937104 --- /dev/null +++ b/DialogflowCx/src/V3/Environment/WebhookConfig.php @@ -0,0 +1,84 @@ +google.cloud.dialogflow.cx.v3.Environment.WebhookConfig + */ +class WebhookConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The list of webhooks to override for the agent environment. The webhook + * must exist in the agent. You can override fields in + * [`generic_web_service`][google.cloud.dialogflow.cx.v3.Webhook.generic_web_service] + * and + * [`service_directory`][google.cloud.dialogflow.cx.v3.Webhook.service_directory]. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Webhook webhook_overrides = 1; + */ + private $webhook_overrides; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Webhook>|\Google\Protobuf\Internal\RepeatedField $webhook_overrides + * The list of webhooks to override for the agent environment. The webhook + * must exist in the agent. You can override fields in + * [`generic_web_service`][google.cloud.dialogflow.cx.v3.Webhook.generic_web_service] + * and + * [`service_directory`][google.cloud.dialogflow.cx.v3.Webhook.service_directory]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * The list of webhooks to override for the agent environment. The webhook + * must exist in the agent. You can override fields in + * [`generic_web_service`][google.cloud.dialogflow.cx.v3.Webhook.generic_web_service] + * and + * [`service_directory`][google.cloud.dialogflow.cx.v3.Webhook.service_directory]. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Webhook webhook_overrides = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWebhookOverrides() + { + return $this->webhook_overrides; + } + + /** + * The list of webhooks to override for the agent environment. The webhook + * must exist in the agent. You can override fields in + * [`generic_web_service`][google.cloud.dialogflow.cx.v3.Webhook.generic_web_service] + * and + * [`service_directory`][google.cloud.dialogflow.cx.v3.Webhook.service_directory]. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Webhook webhook_overrides = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Webhook>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWebhookOverrides($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Webhook::class); + $this->webhook_overrides = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/EnvironmentsClient.php b/DialogflowCx/src/V3/EnvironmentsClient.php new file mode 100644 index 000000000000..883c788e7e2d --- /dev/null +++ b/DialogflowCx/src/V3/EnvironmentsClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.EventHandler + */ +class EventHandler extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The unique identifier of this event handler. + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Required. The name of the event to handle. + * + * Generated from protobuf field string event = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $event = ''; + /** + * The fulfillment to call when the event occurs. + * Handling webhook errors with a fulfillment enabled with webhook could + * cause infinite loop. It is invalid to specify such fulfillment for a + * handler handling webhooks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment trigger_fulfillment = 5; + */ + protected $trigger_fulfillment = null; + protected $target; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. The unique identifier of this event handler. + * @type string $event + * Required. The name of the event to handle. + * @type \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $trigger_fulfillment + * The fulfillment to call when the event occurs. + * Handling webhook errors with a fulfillment enabled with webhook could + * cause infinite loop. It is invalid to specify such fulfillment for a + * handler handling webhooks. + * @type string $target_page + * The target page to transition to. + * Format: `projects//locations//agents//flows//pages/`. + * @type string $target_flow + * The target flow to transition to. + * Format: `projects//locations//agents//flows/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The unique identifier of this event handler. + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. The unique identifier of this event handler. + * + * Generated from protobuf field string name = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The name of the event to handle. + * + * Generated from protobuf field string event = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEvent() + { + return $this->event; + } + + /** + * Required. The name of the event to handle. + * + * Generated from protobuf field string event = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEvent($var) + { + GPBUtil::checkString($var, True); + $this->event = $var; + + return $this; + } + + /** + * The fulfillment to call when the event occurs. + * Handling webhook errors with a fulfillment enabled with webhook could + * cause infinite loop. It is invalid to specify such fulfillment for a + * handler handling webhooks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment trigger_fulfillment = 5; + * @return \Google\Cloud\Dialogflow\Cx\V3\Fulfillment|null + */ + public function getTriggerFulfillment() + { + return $this->trigger_fulfillment; + } + + public function hasTriggerFulfillment() + { + return isset($this->trigger_fulfillment); + } + + public function clearTriggerFulfillment() + { + unset($this->trigger_fulfillment); + } + + /** + * The fulfillment to call when the event occurs. + * Handling webhook errors with a fulfillment enabled with webhook could + * cause infinite loop. It is invalid to specify such fulfillment for a + * handler handling webhooks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment trigger_fulfillment = 5; + * @param \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $var + * @return $this + */ + public function setTriggerFulfillment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment::class); + $this->trigger_fulfillment = $var; + + return $this; + } + + /** + * The target page to transition to. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string target_page = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getTargetPage() + { + return $this->readOneof(2); + } + + public function hasTargetPage() + { + return $this->hasOneof(2); + } + + /** + * The target page to transition to. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string target_page = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetPage($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The target flow to transition to. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string target_flow = 3 [(.google.api.resource_reference) = { + * @return string + */ + public function getTargetFlow() + { + return $this->readOneof(3); + } + + public function hasTargetFlow() + { + return $this->hasOneof(3); + } + + /** + * The target flow to transition to. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string target_flow = 3 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetFlow($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getTarget() + { + return $this->whichOneof("target"); + } + +} + diff --git a/DialogflowCx/src/V3/EventInput.php b/DialogflowCx/src/V3/EventInput.php new file mode 100644 index 000000000000..235626b202bd --- /dev/null +++ b/DialogflowCx/src/V3/EventInput.php @@ -0,0 +1,67 @@ +google.cloud.dialogflow.cx.v3.EventInput + */ +class EventInput extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the event. + * + * Generated from protobuf field string event = 1; + */ + protected $event = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $event + * Name of the event. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Name of the event. + * + * Generated from protobuf field string event = 1; + * @return string + */ + public function getEvent() + { + return $this->event; + } + + /** + * Name of the event. + * + * Generated from protobuf field string event = 1; + * @param string $var + * @return $this + */ + public function setEvent($var) + { + GPBUtil::checkString($var, True); + $this->event = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Experiment.php b/DialogflowCx/src/V3/Experiment.php new file mode 100644 index 000000000000..9cb98c31f53c --- /dev/null +++ b/DialogflowCx/src/V3/Experiment.php @@ -0,0 +1,685 @@ +google.cloud.dialogflow.cx.v3.Experiment + */ +class Experiment extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the experiment. + * Format: projects//locations//agents//environments//experiments/.. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the experiment (unique in an + * environment). Limit of 64 characters. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * The human-readable description of the experiment. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * The current state of the experiment. + * Transition triggered by Experiments.StartExperiment: DRAFT->RUNNING. + * Transition triggered by Experiments.CancelExperiment: DRAFT->DONE or + * RUNNING->DONE. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.State state = 4; + */ + protected $state = 0; + /** + * The definition of the experiment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Definition definition = 5; + */ + protected $definition = null; + /** + * The configuration for auto rollout. If set, there should be exactly two + * variants in the experiment (control variant being the default version of + * the flow), the traffic allocation for the non-control variant will + * gradually increase to 100% when conditions are met, and eventually + * replace the control variant to become the default version of the flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RolloutConfig rollout_config = 14; + */ + protected $rollout_config = null; + /** + * State of the auto rollout process. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RolloutState rollout_state = 15; + */ + protected $rollout_state = null; + /** + * The reason why rollout has failed. Should only be set when state is + * ROLLOUT_FAILED. + * + * Generated from protobuf field string rollout_failure_reason = 16; + */ + protected $rollout_failure_reason = ''; + /** + * Inference result of the experiment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result result = 6; + */ + protected $result = null; + /** + * Creation time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + */ + protected $create_time = null; + /** + * Start time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + */ + protected $start_time = null; + /** + * End time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 9; + */ + protected $end_time = null; + /** + * Last update time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 10; + */ + protected $last_update_time = null; + /** + * Maximum number of days to run the experiment/rollout. If auto-rollout is + * not enabled, default value and maximum will be 30 days. If auto-rollout is + * enabled, default value and maximum will be 6 days. + * + * Generated from protobuf field .google.protobuf.Duration experiment_length = 11; + */ + protected $experiment_length = null; + /** + * The history of updates to the experiment variants. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.VariantsHistory variants_history = 12; + */ + private $variants_history; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The name of the experiment. + * Format: projects//locations//agents//environments//experiments/.. + * @type string $display_name + * Required. The human-readable name of the experiment (unique in an + * environment). Limit of 64 characters. + * @type string $description + * The human-readable description of the experiment. + * @type int $state + * The current state of the experiment. + * Transition triggered by Experiments.StartExperiment: DRAFT->RUNNING. + * Transition triggered by Experiments.CancelExperiment: DRAFT->DONE or + * RUNNING->DONE. + * @type \Google\Cloud\Dialogflow\Cx\V3\Experiment\Definition $definition + * The definition of the experiment. + * @type \Google\Cloud\Dialogflow\Cx\V3\RolloutConfig $rollout_config + * The configuration for auto rollout. If set, there should be exactly two + * variants in the experiment (control variant being the default version of + * the flow), the traffic allocation for the non-control variant will + * gradually increase to 100% when conditions are met, and eventually + * replace the control variant to become the default version of the flow. + * @type \Google\Cloud\Dialogflow\Cx\V3\RolloutState $rollout_state + * State of the auto rollout process. + * @type string $rollout_failure_reason + * The reason why rollout has failed. Should only be set when state is + * ROLLOUT_FAILED. + * @type \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result $result + * Inference result of the experiment. + * @type \Google\Protobuf\Timestamp $create_time + * Creation time of this experiment. + * @type \Google\Protobuf\Timestamp $start_time + * Start time of this experiment. + * @type \Google\Protobuf\Timestamp $end_time + * End time of this experiment. + * @type \Google\Protobuf\Timestamp $last_update_time + * Last update time of this experiment. + * @type \Google\Protobuf\Duration $experiment_length + * Maximum number of days to run the experiment/rollout. If auto-rollout is + * not enabled, default value and maximum will be 30 days. If auto-rollout is + * enabled, default value and maximum will be 6 days. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\VariantsHistory>|\Google\Protobuf\Internal\RepeatedField $variants_history + * The history of updates to the experiment variants. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * The name of the experiment. + * Format: projects//locations//agents//environments//experiments/.. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The name of the experiment. + * Format: projects//locations//agents//environments//experiments/.. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the experiment (unique in an + * environment). Limit of 64 characters. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the experiment (unique in an + * environment). Limit of 64 characters. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The human-readable description of the experiment. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The human-readable description of the experiment. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The current state of the experiment. + * Transition triggered by Experiments.StartExperiment: DRAFT->RUNNING. + * Transition triggered by Experiments.CancelExperiment: DRAFT->DONE or + * RUNNING->DONE. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.State state = 4; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The current state of the experiment. + * Transition triggered by Experiments.StartExperiment: DRAFT->RUNNING. + * Transition triggered by Experiments.CancelExperiment: DRAFT->DONE or + * RUNNING->DONE. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.State state = 4; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Experiment\State::class); + $this->state = $var; + + return $this; + } + + /** + * The definition of the experiment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Definition definition = 5; + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment\Definition|null + */ + public function getDefinition() + { + return $this->definition; + } + + public function hasDefinition() + { + return isset($this->definition); + } + + public function clearDefinition() + { + unset($this->definition); + } + + /** + * The definition of the experiment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Definition definition = 5; + * @param \Google\Cloud\Dialogflow\Cx\V3\Experiment\Definition $var + * @return $this + */ + public function setDefinition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Experiment\Definition::class); + $this->definition = $var; + + return $this; + } + + /** + * The configuration for auto rollout. If set, there should be exactly two + * variants in the experiment (control variant being the default version of + * the flow), the traffic allocation for the non-control variant will + * gradually increase to 100% when conditions are met, and eventually + * replace the control variant to become the default version of the flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RolloutConfig rollout_config = 14; + * @return \Google\Cloud\Dialogflow\Cx\V3\RolloutConfig|null + */ + public function getRolloutConfig() + { + return $this->rollout_config; + } + + public function hasRolloutConfig() + { + return isset($this->rollout_config); + } + + public function clearRolloutConfig() + { + unset($this->rollout_config); + } + + /** + * The configuration for auto rollout. If set, there should be exactly two + * variants in the experiment (control variant being the default version of + * the flow), the traffic allocation for the non-control variant will + * gradually increase to 100% when conditions are met, and eventually + * replace the control variant to become the default version of the flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RolloutConfig rollout_config = 14; + * @param \Google\Cloud\Dialogflow\Cx\V3\RolloutConfig $var + * @return $this + */ + public function setRolloutConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\RolloutConfig::class); + $this->rollout_config = $var; + + return $this; + } + + /** + * State of the auto rollout process. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RolloutState rollout_state = 15; + * @return \Google\Cloud\Dialogflow\Cx\V3\RolloutState|null + */ + public function getRolloutState() + { + return $this->rollout_state; + } + + public function hasRolloutState() + { + return isset($this->rollout_state); + } + + public function clearRolloutState() + { + unset($this->rollout_state); + } + + /** + * State of the auto rollout process. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RolloutState rollout_state = 15; + * @param \Google\Cloud\Dialogflow\Cx\V3\RolloutState $var + * @return $this + */ + public function setRolloutState($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\RolloutState::class); + $this->rollout_state = $var; + + return $this; + } + + /** + * The reason why rollout has failed. Should only be set when state is + * ROLLOUT_FAILED. + * + * Generated from protobuf field string rollout_failure_reason = 16; + * @return string + */ + public function getRolloutFailureReason() + { + return $this->rollout_failure_reason; + } + + /** + * The reason why rollout has failed. Should only be set when state is + * ROLLOUT_FAILED. + * + * Generated from protobuf field string rollout_failure_reason = 16; + * @param string $var + * @return $this + */ + public function setRolloutFailureReason($var) + { + GPBUtil::checkString($var, True); + $this->rollout_failure_reason = $var; + + return $this; + } + + /** + * Inference result of the experiment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result result = 6; + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result|null + */ + public function getResult() + { + return $this->result; + } + + public function hasResult() + { + return isset($this->result); + } + + public function clearResult() + { + unset($this->result); + } + + /** + * Inference result of the experiment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result result = 6; + * @param \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result::class); + $this->result = $var; + + return $this; + } + + /** + * Creation time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Creation time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 7; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Start time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 8; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * End time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 9; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * End time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 9; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + + /** + * Last update time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 10; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastUpdateTime() + { + return $this->last_update_time; + } + + public function hasLastUpdateTime() + { + return isset($this->last_update_time); + } + + public function clearLastUpdateTime() + { + unset($this->last_update_time); + } + + /** + * Last update time of this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 10; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_time = $var; + + return $this; + } + + /** + * Maximum number of days to run the experiment/rollout. If auto-rollout is + * not enabled, default value and maximum will be 30 days. If auto-rollout is + * enabled, default value and maximum will be 6 days. + * + * Generated from protobuf field .google.protobuf.Duration experiment_length = 11; + * @return \Google\Protobuf\Duration|null + */ + public function getExperimentLength() + { + return $this->experiment_length; + } + + public function hasExperimentLength() + { + return isset($this->experiment_length); + } + + public function clearExperimentLength() + { + unset($this->experiment_length); + } + + /** + * Maximum number of days to run the experiment/rollout. If auto-rollout is + * not enabled, default value and maximum will be 30 days. If auto-rollout is + * enabled, default value and maximum will be 6 days. + * + * Generated from protobuf field .google.protobuf.Duration experiment_length = 11; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setExperimentLength($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->experiment_length = $var; + + return $this; + } + + /** + * The history of updates to the experiment variants. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.VariantsHistory variants_history = 12; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVariantsHistory() + { + return $this->variants_history; + } + + /** + * The history of updates to the experiment variants. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.VariantsHistory variants_history = 12; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\VariantsHistory>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVariantsHistory($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\VariantsHistory::class); + $this->variants_history = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Experiment/Definition.php b/DialogflowCx/src/V3/Experiment/Definition.php new file mode 100644 index 000000000000..574dcdc17474 --- /dev/null +++ b/DialogflowCx/src/V3/Experiment/Definition.php @@ -0,0 +1,122 @@ +google.cloud.dialogflow.cx.v3.Experiment.Definition + */ +class Definition extends \Google\Protobuf\Internal\Message +{ + /** + * The condition defines which subset of sessions are selected for + * this experiment. If not specified, all sessions are eligible. E.g. + * "query_input.language_code=en" See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string condition = 1; + */ + protected $condition = ''; + protected $variants; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $condition + * The condition defines which subset of sessions are selected for + * this experiment. If not specified, all sessions are eligible. E.g. + * "query_input.language_code=en" See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * @type \Google\Cloud\Dialogflow\Cx\V3\VersionVariants $version_variants + * The flow versions as the variants of this experiment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * The condition defines which subset of sessions are selected for + * this experiment. If not specified, all sessions are eligible. E.g. + * "query_input.language_code=en" See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string condition = 1; + * @return string + */ + public function getCondition() + { + return $this->condition; + } + + /** + * The condition defines which subset of sessions are selected for + * this experiment. If not specified, all sessions are eligible. E.g. + * "query_input.language_code=en" See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string condition = 1; + * @param string $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkString($var, True); + $this->condition = $var; + + return $this; + } + + /** + * The flow versions as the variants of this experiment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.VersionVariants version_variants = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\VersionVariants|null + */ + public function getVersionVariants() + { + return $this->readOneof(2); + } + + public function hasVersionVariants() + { + return $this->hasOneof(2); + } + + /** + * The flow versions as the variants of this experiment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.VersionVariants version_variants = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\VersionVariants $var + * @return $this + */ + public function setVersionVariants($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\VersionVariants::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getVariants() + { + return $this->whichOneof("variants"); + } + +} + + diff --git a/DialogflowCx/src/V3/Experiment/Result.php b/DialogflowCx/src/V3/Experiment/Result.php new file mode 100644 index 000000000000..b3b03c9c6bb0 --- /dev/null +++ b/DialogflowCx/src/V3/Experiment/Result.php @@ -0,0 +1,117 @@ +google.cloud.dialogflow.cx.v3.Experiment.Result + */ +class Result extends \Google\Protobuf\Internal\Message +{ + /** + * Version variants and metrics. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment.Result.VersionMetrics version_metrics = 1; + */ + private $version_metrics; + /** + * The last time the experiment's stats data was updated. Will have default + * value if stats have never been computed for this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2; + */ + protected $last_update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\VersionMetrics>|\Google\Protobuf\Internal\RepeatedField $version_metrics + * Version variants and metrics. + * @type \Google\Protobuf\Timestamp $last_update_time + * The last time the experiment's stats data was updated. Will have default + * value if stats have never been computed for this experiment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * Version variants and metrics. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment.Result.VersionMetrics version_metrics = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersionMetrics() + { + return $this->version_metrics; + } + + /** + * Version variants and metrics. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment.Result.VersionMetrics version_metrics = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\VersionMetrics>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersionMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\VersionMetrics::class); + $this->version_metrics = $arr; + + return $this; + } + + /** + * The last time the experiment's stats data was updated. Will have default + * value if stats have never been computed for this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getLastUpdateTime() + { + return $this->last_update_time; + } + + public function hasLastUpdateTime() + { + return isset($this->last_update_time); + } + + public function clearLastUpdateTime() + { + unset($this->last_update_time); + } + + /** + * The last time the experiment's stats data was updated. Will have default + * value if stats have never been computed for this experiment. + * + * Generated from protobuf field .google.protobuf.Timestamp last_update_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setLastUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->last_update_time = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Experiment/Result/ConfidenceInterval.php b/DialogflowCx/src/V3/Experiment/Result/ConfidenceInterval.php new file mode 100644 index 000000000000..10531a787710 --- /dev/null +++ b/DialogflowCx/src/V3/Experiment/Result/ConfidenceInterval.php @@ -0,0 +1,179 @@ +google.cloud.dialogflow.cx.v3.Experiment.Result.ConfidenceInterval + */ +class ConfidenceInterval extends \Google\Protobuf\Internal\Message +{ + /** + * The confidence level used to construct the interval, i.e. there is X% + * chance that the true value is within this interval. + * + * Generated from protobuf field double confidence_level = 1; + */ + protected $confidence_level = 0.0; + /** + * The percent change between an experiment metric's value and the value + * for its control. + * + * Generated from protobuf field double ratio = 2; + */ + protected $ratio = 0.0; + /** + * Lower bound of the interval. + * + * Generated from protobuf field double lower_bound = 3; + */ + protected $lower_bound = 0.0; + /** + * Upper bound of the interval. + * + * Generated from protobuf field double upper_bound = 4; + */ + protected $upper_bound = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $confidence_level + * The confidence level used to construct the interval, i.e. there is X% + * chance that the true value is within this interval. + * @type float $ratio + * The percent change between an experiment metric's value and the value + * for its control. + * @type float $lower_bound + * Lower bound of the interval. + * @type float $upper_bound + * Upper bound of the interval. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * The confidence level used to construct the interval, i.e. there is X% + * chance that the true value is within this interval. + * + * Generated from protobuf field double confidence_level = 1; + * @return float + */ + public function getConfidenceLevel() + { + return $this->confidence_level; + } + + /** + * The confidence level used to construct the interval, i.e. there is X% + * chance that the true value is within this interval. + * + * Generated from protobuf field double confidence_level = 1; + * @param float $var + * @return $this + */ + public function setConfidenceLevel($var) + { + GPBUtil::checkDouble($var); + $this->confidence_level = $var; + + return $this; + } + + /** + * The percent change between an experiment metric's value and the value + * for its control. + * + * Generated from protobuf field double ratio = 2; + * @return float + */ + public function getRatio() + { + return $this->ratio; + } + + /** + * The percent change between an experiment metric's value and the value + * for its control. + * + * Generated from protobuf field double ratio = 2; + * @param float $var + * @return $this + */ + public function setRatio($var) + { + GPBUtil::checkDouble($var); + $this->ratio = $var; + + return $this; + } + + /** + * Lower bound of the interval. + * + * Generated from protobuf field double lower_bound = 3; + * @return float + */ + public function getLowerBound() + { + return $this->lower_bound; + } + + /** + * Lower bound of the interval. + * + * Generated from protobuf field double lower_bound = 3; + * @param float $var + * @return $this + */ + public function setLowerBound($var) + { + GPBUtil::checkDouble($var); + $this->lower_bound = $var; + + return $this; + } + + /** + * Upper bound of the interval. + * + * Generated from protobuf field double upper_bound = 4; + * @return float + */ + public function getUpperBound() + { + return $this->upper_bound; + } + + /** + * Upper bound of the interval. + * + * Generated from protobuf field double upper_bound = 4; + * @param float $var + * @return $this + */ + public function setUpperBound($var) + { + GPBUtil::checkDouble($var); + $this->upper_bound = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Experiment/Result/CountType.php b/DialogflowCx/src/V3/Experiment/Result/CountType.php new file mode 100644 index 000000000000..a5bdad7e2bdd --- /dev/null +++ b/DialogflowCx/src/V3/Experiment/Result/CountType.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.Experiment.Result.CountType + */ +class CountType +{ + /** + * Count type unspecified. + * + * Generated from protobuf enum COUNT_TYPE_UNSPECIFIED = 0; + */ + const COUNT_TYPE_UNSPECIFIED = 0; + /** + * Total number of occurrences of a 'NO_MATCH'. + * + * Generated from protobuf enum TOTAL_NO_MATCH_COUNT = 1; + */ + const TOTAL_NO_MATCH_COUNT = 1; + /** + * Total number of turn counts. + * + * Generated from protobuf enum TOTAL_TURN_COUNT = 2; + */ + const TOTAL_TURN_COUNT = 2; + /** + * Average turn count in a session. + * + * Generated from protobuf enum AVERAGE_TURN_COUNT = 3; + */ + const AVERAGE_TURN_COUNT = 3; + + private static $valueToName = [ + self::COUNT_TYPE_UNSPECIFIED => 'COUNT_TYPE_UNSPECIFIED', + self::TOTAL_NO_MATCH_COUNT => 'TOTAL_NO_MATCH_COUNT', + self::TOTAL_TURN_COUNT => 'TOTAL_TURN_COUNT', + self::AVERAGE_TURN_COUNT => 'AVERAGE_TURN_COUNT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/Experiment/Result/Metric.php b/DialogflowCx/src/V3/Experiment/Result/Metric.php new file mode 100644 index 000000000000..2b36955866ae --- /dev/null +++ b/DialogflowCx/src/V3/Experiment/Result/Metric.php @@ -0,0 +1,233 @@ +google.cloud.dialogflow.cx.v3.Experiment.Result.Metric + */ +class Metric extends \Google\Protobuf\Internal\Message +{ + /** + * Ratio-based metric type. Only one of type or count_type is specified in + * each Metric. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.MetricType type = 1; + */ + protected $type = 0; + /** + * Count-based metric type. Only one of type or count_type is specified in + * each Metric. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.CountType count_type = 5; + */ + protected $count_type = 0; + /** + * The probability that the treatment is better than all other treatments + * in the experiment + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.ConfidenceInterval confidence_interval = 3; + */ + protected $confidence_interval = null; + protected $value; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Ratio-based metric type. Only one of type or count_type is specified in + * each Metric. + * @type int $count_type + * Count-based metric type. Only one of type or count_type is specified in + * each Metric. + * @type float $ratio + * Ratio value of a metric. + * @type float $count + * Count value of a metric. + * @type \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\ConfidenceInterval $confidence_interval + * The probability that the treatment is better than all other treatments + * in the experiment + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * Ratio-based metric type. Only one of type or count_type is specified in + * each Metric. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.MetricType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Ratio-based metric type. Only one of type or count_type is specified in + * each Metric. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.MetricType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\MetricType::class); + $this->type = $var; + + return $this; + } + + /** + * Count-based metric type. Only one of type or count_type is specified in + * each Metric. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.CountType count_type = 5; + * @return int + */ + public function getCountType() + { + return $this->count_type; + } + + /** + * Count-based metric type. Only one of type or count_type is specified in + * each Metric. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.CountType count_type = 5; + * @param int $var + * @return $this + */ + public function setCountType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\CountType::class); + $this->count_type = $var; + + return $this; + } + + /** + * Ratio value of a metric. + * + * Generated from protobuf field double ratio = 2; + * @return float + */ + public function getRatio() + { + return $this->readOneof(2); + } + + public function hasRatio() + { + return $this->hasOneof(2); + } + + /** + * Ratio value of a metric. + * + * Generated from protobuf field double ratio = 2; + * @param float $var + * @return $this + */ + public function setRatio($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Count value of a metric. + * + * Generated from protobuf field double count = 4; + * @return float + */ + public function getCount() + { + return $this->readOneof(4); + } + + public function hasCount() + { + return $this->hasOneof(4); + } + + /** + * Count value of a metric. + * + * Generated from protobuf field double count = 4; + * @param float $var + * @return $this + */ + public function setCount($var) + { + GPBUtil::checkDouble($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The probability that the treatment is better than all other treatments + * in the experiment + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.ConfidenceInterval confidence_interval = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\ConfidenceInterval|null + */ + public function getConfidenceInterval() + { + return $this->confidence_interval; + } + + public function hasConfidenceInterval() + { + return isset($this->confidence_interval); + } + + public function clearConfidenceInterval() + { + unset($this->confidence_interval); + } + + /** + * The probability that the treatment is better than all other treatments + * in the experiment + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Experiment.Result.ConfidenceInterval confidence_interval = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\ConfidenceInterval $var + * @return $this + */ + public function setConfidenceInterval($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\ConfidenceInterval::class); + $this->confidence_interval = $var; + + return $this; + } + + /** + * @return string + */ + public function getValue() + { + return $this->whichOneof("value"); + } + +} + + diff --git a/DialogflowCx/src/V3/Experiment/Result/MetricType.php b/DialogflowCx/src/V3/Experiment/Result/MetricType.php new file mode 100644 index 000000000000..11767b5aa74f --- /dev/null +++ b/DialogflowCx/src/V3/Experiment/Result/MetricType.php @@ -0,0 +1,84 @@ +google.cloud.dialogflow.cx.v3.Experiment.Result.MetricType + */ +class MetricType +{ + /** + * Metric unspecified. + * + * Generated from protobuf enum METRIC_UNSPECIFIED = 0; + */ + const METRIC_UNSPECIFIED = 0; + /** + * Percentage of contained sessions without user calling back in 24 hours. + * + * Generated from protobuf enum CONTAINED_SESSION_NO_CALLBACK_RATE = 1; + */ + const CONTAINED_SESSION_NO_CALLBACK_RATE = 1; + /** + * Percentage of sessions that were handed to a human agent. + * + * Generated from protobuf enum LIVE_AGENT_HANDOFF_RATE = 2; + */ + const LIVE_AGENT_HANDOFF_RATE = 2; + /** + * Percentage of sessions with the same user calling back. + * + * Generated from protobuf enum CALLBACK_SESSION_RATE = 3; + */ + const CALLBACK_SESSION_RATE = 3; + /** + * Percentage of sessions where user hung up. + * + * Generated from protobuf enum ABANDONED_SESSION_RATE = 4; + */ + const ABANDONED_SESSION_RATE = 4; + /** + * Percentage of sessions reached Dialogflow 'END_PAGE' or + * 'END_SESSION'. + * + * Generated from protobuf enum SESSION_END_RATE = 5; + */ + const SESSION_END_RATE = 5; + + private static $valueToName = [ + self::METRIC_UNSPECIFIED => 'METRIC_UNSPECIFIED', + self::CONTAINED_SESSION_NO_CALLBACK_RATE => 'CONTAINED_SESSION_NO_CALLBACK_RATE', + self::LIVE_AGENT_HANDOFF_RATE => 'LIVE_AGENT_HANDOFF_RATE', + self::CALLBACK_SESSION_RATE => 'CALLBACK_SESSION_RATE', + self::ABANDONED_SESSION_RATE => 'ABANDONED_SESSION_RATE', + self::SESSION_END_RATE => 'SESSION_END_RATE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/Experiment/Result/VersionMetrics.php b/DialogflowCx/src/V3/Experiment/Result/VersionMetrics.php new file mode 100644 index 000000000000..8973c525fff9 --- /dev/null +++ b/DialogflowCx/src/V3/Experiment/Result/VersionMetrics.php @@ -0,0 +1,148 @@ +google.cloud.dialogflow.cx.v3.Experiment.Result.VersionMetrics + */ +class VersionMetrics extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the flow [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string version = 1 [(.google.api.resource_reference) = { + */ + protected $version = ''; + /** + * The metrics and corresponding confidence intervals in the inference + * result. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment.Result.Metric metrics = 2; + */ + private $metrics; + /** + * Number of sessions that were allocated to this version. + * + * Generated from protobuf field int32 session_count = 3; + */ + protected $session_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $version + * The name of the flow [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\Metric>|\Google\Protobuf\Internal\RepeatedField $metrics + * The metrics and corresponding confidence intervals in the inference + * result. + * @type int $session_count + * Number of sessions that were allocated to this version. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * The name of the flow [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string version = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The name of the flow [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string version = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * The metrics and corresponding confidence intervals in the inference + * result. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment.Result.Metric metrics = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMetrics() + { + return $this->metrics; + } + + /** + * The metrics and corresponding confidence intervals in the inference + * result. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment.Result.Metric metrics = 2; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\Metric>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMetrics($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Experiment\Result\Metric::class); + $this->metrics = $arr; + + return $this; + } + + /** + * Number of sessions that were allocated to this version. + * + * Generated from protobuf field int32 session_count = 3; + * @return int + */ + public function getSessionCount() + { + return $this->session_count; + } + + /** + * Number of sessions that were allocated to this version. + * + * Generated from protobuf field int32 session_count = 3; + * @param int $var + * @return $this + */ + public function setSessionCount($var) + { + GPBUtil::checkInt32($var); + $this->session_count = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Experiment/State.php b/DialogflowCx/src/V3/Experiment/State.php new file mode 100644 index 000000000000..0992677f1b2d --- /dev/null +++ b/DialogflowCx/src/V3/Experiment/State.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.Experiment.State + */ +class State +{ + /** + * State unspecified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The experiment is created but not started yet. + * + * Generated from protobuf enum DRAFT = 1; + */ + const DRAFT = 1; + /** + * The experiment is running. + * + * Generated from protobuf enum RUNNING = 2; + */ + const RUNNING = 2; + /** + * The experiment is done. + * + * Generated from protobuf enum DONE = 3; + */ + const DONE = 3; + /** + * The experiment with auto-rollout enabled has failed. + * + * Generated from protobuf enum ROLLOUT_FAILED = 4; + */ + const ROLLOUT_FAILED = 4; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::DRAFT => 'DRAFT', + self::RUNNING => 'RUNNING', + self::DONE => 'DONE', + self::ROLLOUT_FAILED => 'ROLLOUT_FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ExperimentsClient.php b/DialogflowCx/src/V3/ExperimentsClient.php new file mode 100644 index 000000000000..1446d430e526 --- /dev/null +++ b/DialogflowCx/src/V3/ExperimentsClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.ExportAgentRequest + */ +class ExportAgentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the agent to export. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the agent + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized agent is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string agent_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $agent_uri = ''; + /** + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportAgentRequest.DataFormat data_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $data_format = 0; + /** + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $environment = ''; + /** + * Optional. The Git branch to export the agent to. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportAgentRequest.GitDestination git_destination = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $git_destination = null; + /** + * Optional. Whether to include BigQuery Export setting. + * + * Generated from protobuf field bool include_bigquery_export_settings = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $include_bigquery_export_settings = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the agent to export. + * Format: `projects//locations//agents/`. + * @type string $agent_uri + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the agent + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized agent is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type int $data_format + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * @type string $environment + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\ExportAgentRequest\GitDestination $git_destination + * Optional. The Git branch to export the agent to. + * @type bool $include_bigquery_export_settings + * Optional. Whether to include BigQuery Export setting. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the agent to export. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the agent to export. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the agent + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized agent is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string agent_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAgentUri() + { + return $this->agent_uri; + } + + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the agent + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized agent is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string agent_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAgentUri($var) + { + GPBUtil::checkString($var, True); + $this->agent_uri = $var; + + return $this; + } + + /** + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportAgentRequest.DataFormat data_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDataFormat() + { + return $this->data_format; + } + + /** + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportAgentRequest.DataFormat data_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDataFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ExportAgentRequest\DataFormat::class); + $this->data_format = $var; + + return $this; + } + + /** + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkString($var, True); + $this->environment = $var; + + return $this; + } + + /** + * Optional. The Git branch to export the agent to. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportAgentRequest.GitDestination git_destination = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\ExportAgentRequest\GitDestination|null + */ + public function getGitDestination() + { + return $this->git_destination; + } + + public function hasGitDestination() + { + return isset($this->git_destination); + } + + public function clearGitDestination() + { + unset($this->git_destination); + } + + /** + * Optional. The Git branch to export the agent to. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportAgentRequest.GitDestination git_destination = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\ExportAgentRequest\GitDestination $var + * @return $this + */ + public function setGitDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ExportAgentRequest\GitDestination::class); + $this->git_destination = $var; + + return $this; + } + + /** + * Optional. Whether to include BigQuery Export setting. + * + * Generated from protobuf field bool include_bigquery_export_settings = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIncludeBigqueryExportSettings() + { + return $this->include_bigquery_export_settings; + } + + /** + * Optional. Whether to include BigQuery Export setting. + * + * Generated from protobuf field bool include_bigquery_export_settings = 7 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIncludeBigqueryExportSettings($var) + { + GPBUtil::checkBool($var); + $this->include_bigquery_export_settings = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ExportAgentRequest/DataFormat.php b/DialogflowCx/src/V3/ExportAgentRequest/DataFormat.php new file mode 100644 index 000000000000..0b50848efe57 --- /dev/null +++ b/DialogflowCx/src/V3/ExportAgentRequest/DataFormat.php @@ -0,0 +1,62 @@ +google.cloud.dialogflow.cx.v3.ExportAgentRequest.DataFormat + */ +class DataFormat +{ + /** + * Unspecified format. + * + * Generated from protobuf enum DATA_FORMAT_UNSPECIFIED = 0; + */ + const DATA_FORMAT_UNSPECIFIED = 0; + /** + * Agent content will be exported as raw bytes. + * + * Generated from protobuf enum BLOB = 1; + */ + const BLOB = 1; + /** + * Agent content will be exported in JSON Package format. + * + * Generated from protobuf enum JSON_PACKAGE = 4; + */ + const JSON_PACKAGE = 4; + + private static $valueToName = [ + self::DATA_FORMAT_UNSPECIFIED => 'DATA_FORMAT_UNSPECIFIED', + self::BLOB => 'BLOB', + self::JSON_PACKAGE => 'JSON_PACKAGE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ExportAgentRequest/GitDestination.php b/DialogflowCx/src/V3/ExportAgentRequest/GitDestination.php new file mode 100644 index 000000000000..948c41fbf935 --- /dev/null +++ b/DialogflowCx/src/V3/ExportAgentRequest/GitDestination.php @@ -0,0 +1,102 @@ +google.cloud.dialogflow.cx.v3.ExportAgentRequest.GitDestination + */ +class GitDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Tracking branch for the git push. + * + * Generated from protobuf field string tracking_branch = 1; + */ + protected $tracking_branch = ''; + /** + * Commit message for the git push. + * + * Generated from protobuf field string commit_message = 2; + */ + protected $commit_message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $tracking_branch + * Tracking branch for the git push. + * @type string $commit_message + * Commit message for the git push. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Tracking branch for the git push. + * + * Generated from protobuf field string tracking_branch = 1; + * @return string + */ + public function getTrackingBranch() + { + return $this->tracking_branch; + } + + /** + * Tracking branch for the git push. + * + * Generated from protobuf field string tracking_branch = 1; + * @param string $var + * @return $this + */ + public function setTrackingBranch($var) + { + GPBUtil::checkString($var, True); + $this->tracking_branch = $var; + + return $this; + } + + /** + * Commit message for the git push. + * + * Generated from protobuf field string commit_message = 2; + * @return string + */ + public function getCommitMessage() + { + return $this->commit_message; + } + + /** + * Commit message for the git push. + * + * Generated from protobuf field string commit_message = 2; + * @param string $var + * @return $this + */ + public function setCommitMessage($var) + { + GPBUtil::checkString($var, True); + $this->commit_message = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ExportAgentResponse.php b/DialogflowCx/src/V3/ExportAgentResponse.php new file mode 100644 index 000000000000..934b8c9d04d3 --- /dev/null +++ b/DialogflowCx/src/V3/ExportAgentResponse.php @@ -0,0 +1,160 @@ +google.cloud.dialogflow.cx.v3.ExportAgentResponse + */ +class ExportAgentResponse extends \Google\Protobuf\Internal\Message +{ + protected $agent; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $agent_uri + * The URI to a file containing the exported agent. This field is populated + * if `agent_uri` is specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * @type string $agent_content + * Uncompressed raw byte content for agent. This field is populated + * if none of `agent_uri` and `git_destination` are specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * @type string $commit_sha + * Commit SHA of the git push. This field is populated if + * `git_destination` is specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * The URI to a file containing the exported agent. This field is populated + * if `agent_uri` is specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * + * Generated from protobuf field string agent_uri = 1; + * @return string + */ + public function getAgentUri() + { + return $this->readOneof(1); + } + + public function hasAgentUri() + { + return $this->hasOneof(1); + } + + /** + * The URI to a file containing the exported agent. This field is populated + * if `agent_uri` is specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * + * Generated from protobuf field string agent_uri = 1; + * @param string $var + * @return $this + */ + public function setAgentUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Uncompressed raw byte content for agent. This field is populated + * if none of `agent_uri` and `git_destination` are specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * + * Generated from protobuf field bytes agent_content = 2; + * @return string + */ + public function getAgentContent() + { + return $this->readOneof(2); + } + + public function hasAgentContent() + { + return $this->hasOneof(2); + } + + /** + * Uncompressed raw byte content for agent. This field is populated + * if none of `agent_uri` and `git_destination` are specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * + * Generated from protobuf field bytes agent_content = 2; + * @param string $var + * @return $this + */ + public function setAgentContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Commit SHA of the git push. This field is populated if + * `git_destination` is specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * + * Generated from protobuf field string commit_sha = 3; + * @return string + */ + public function getCommitSha() + { + return $this->readOneof(3); + } + + public function hasCommitSha() + { + return $this->hasOneof(3); + } + + /** + * Commit SHA of the git push. This field is populated if + * `git_destination` is specified in + * [ExportAgentRequest][google.cloud.dialogflow.cx.v3.ExportAgentRequest]. + * + * Generated from protobuf field string commit_sha = 3; + * @param string $var + * @return $this + */ + public function setCommitSha($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getAgent() + { + return $this->whichOneof("agent"); + } + +} + diff --git a/DialogflowCx/src/V3/ExportFlowRequest.php b/DialogflowCx/src/V3/ExportFlowRequest.php new file mode 100644 index 000000000000..7078ba86db52 --- /dev/null +++ b/DialogflowCx/src/V3/ExportFlowRequest.php @@ -0,0 +1,176 @@ +google.cloud.dialogflow.cx.v3.ExportFlowRequest + */ +class ExportFlowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the flow to export. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the flow to. + * The format of this URI must be `gs:///`. If left + * unspecified, the serialized flow is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string flow_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $flow_uri = ''; + /** + * Optional. Whether to export flows referenced by the specified flow. + * + * Generated from protobuf field bool include_referenced_flows = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $include_referenced_flows = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the flow to export. + * Format: `projects//locations//agents//flows/`. + * @type string $flow_uri + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the flow to. + * The format of this URI must be `gs:///`. If left + * unspecified, the serialized flow is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type bool $include_referenced_flows + * Optional. Whether to export flows referenced by the specified flow. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the flow to export. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the flow to export. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the flow to. + * The format of this URI must be `gs:///`. If left + * unspecified, the serialized flow is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string flow_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFlowUri() + { + return $this->flow_uri; + } + + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the flow to. + * The format of this URI must be `gs:///`. If left + * unspecified, the serialized flow is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string flow_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFlowUri($var) + { + GPBUtil::checkString($var, True); + $this->flow_uri = $var; + + return $this; + } + + /** + * Optional. Whether to export flows referenced by the specified flow. + * + * Generated from protobuf field bool include_referenced_flows = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIncludeReferencedFlows() + { + return $this->include_referenced_flows; + } + + /** + * Optional. Whether to export flows referenced by the specified flow. + * + * Generated from protobuf field bool include_referenced_flows = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIncludeReferencedFlows($var) + { + GPBUtil::checkBool($var); + $this->include_referenced_flows = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ExportFlowResponse.php b/DialogflowCx/src/V3/ExportFlowResponse.php new file mode 100644 index 000000000000..c849cee8ef79 --- /dev/null +++ b/DialogflowCx/src/V3/ExportFlowResponse.php @@ -0,0 +1,115 @@ +google.cloud.dialogflow.cx.v3.ExportFlowResponse + */ +class ExportFlowResponse extends \Google\Protobuf\Internal\Message +{ + protected $flow; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $flow_uri + * The URI to a file containing the exported flow. This field is populated + * only if `flow_uri` is specified in + * [ExportFlowRequest][google.cloud.dialogflow.cx.v3.ExportFlowRequest]. + * @type string $flow_content + * Uncompressed raw byte content for flow. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * The URI to a file containing the exported flow. This field is populated + * only if `flow_uri` is specified in + * [ExportFlowRequest][google.cloud.dialogflow.cx.v3.ExportFlowRequest]. + * + * Generated from protobuf field string flow_uri = 1; + * @return string + */ + public function getFlowUri() + { + return $this->readOneof(1); + } + + public function hasFlowUri() + { + return $this->hasOneof(1); + } + + /** + * The URI to a file containing the exported flow. This field is populated + * only if `flow_uri` is specified in + * [ExportFlowRequest][google.cloud.dialogflow.cx.v3.ExportFlowRequest]. + * + * Generated from protobuf field string flow_uri = 1; + * @param string $var + * @return $this + */ + public function setFlowUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Uncompressed raw byte content for flow. + * + * Generated from protobuf field bytes flow_content = 2; + * @return string + */ + public function getFlowContent() + { + return $this->readOneof(2); + } + + public function hasFlowContent() + { + return $this->hasOneof(2); + } + + /** + * Uncompressed raw byte content for flow. + * + * Generated from protobuf field bytes flow_content = 2; + * @param string $var + * @return $this + */ + public function setFlowContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getFlow() + { + return $this->whichOneof("flow"); + } + +} + diff --git a/DialogflowCx/src/V3/ExportIntentsMetadata.php b/DialogflowCx/src/V3/ExportIntentsMetadata.php new file mode 100644 index 000000000000..af1c826764e4 --- /dev/null +++ b/DialogflowCx/src/V3/ExportIntentsMetadata.php @@ -0,0 +1,35 @@ +google.cloud.dialogflow.cx.v3.ExportIntentsMetadata + */ +class ExportIntentsMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + +} + diff --git a/DialogflowCx/src/V3/ExportIntentsRequest.php b/DialogflowCx/src/V3/ExportIntentsRequest.php new file mode 100644 index 000000000000..d73a911102a5 --- /dev/null +++ b/DialogflowCx/src/V3/ExportIntentsRequest.php @@ -0,0 +1,255 @@ +google.cloud.dialogflow.cx.v3.ExportIntentsRequest + */ +class ExportIntentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the parent agent to export intents. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The name of the intents to export. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field repeated string intents = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $intents; + /** + * Optional. The data format of the exported intents. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportIntentsRequest.DataFormat data_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $data_format = 0; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The name of the parent agent to export intents. + * Format: `projects//locations//agents/`. + * @type array|\Google\Protobuf\Internal\RepeatedField $intents + * Required. The name of the intents to export. + * Format: `projects//locations//agents//intents/`. + * @type string $intents_uri + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the + * intents to. The format of this URI must be + * `gs:///`. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type bool $intents_content_inline + * Optional. The option to return the serialized intents inline. + * @type int $data_format + * Optional. The data format of the exported intents. If not specified, `BLOB` + * is assumed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the parent agent to export intents. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The name of the parent agent to export intents. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The name of the intents to export. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field repeated string intents = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIntents() + { + return $this->intents; + } + + /** + * Required. The name of the intents to export. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field repeated string intents = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIntents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->intents = $arr; + + return $this; + } + + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the + * intents to. The format of this URI must be + * `gs:///`. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string intents_uri = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getIntentsUri() + { + return $this->readOneof(3); + } + + public function hasIntentsUri() + { + return $this->hasOneof(3); + } + + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the + * intents to. The format of this URI must be + * `gs:///`. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string intents_uri = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setIntentsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Optional. The option to return the serialized intents inline. + * + * Generated from protobuf field bool intents_content_inline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getIntentsContentInline() + { + return $this->readOneof(4); + } + + public function hasIntentsContentInline() + { + return $this->hasOneof(4); + } + + /** + * Optional. The option to return the serialized intents inline. + * + * Generated from protobuf field bool intents_content_inline = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setIntentsContentInline($var) + { + GPBUtil::checkBool($var); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Optional. The data format of the exported intents. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportIntentsRequest.DataFormat data_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDataFormat() + { + return $this->data_format; + } + + /** + * Optional. The data format of the exported intents. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportIntentsRequest.DataFormat data_format = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDataFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ExportIntentsRequest\DataFormat::class); + $this->data_format = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/DialogflowCx/src/V3/ExportIntentsRequest/DataFormat.php b/DialogflowCx/src/V3/ExportIntentsRequest/DataFormat.php new file mode 100644 index 000000000000..f55f5cfedeae --- /dev/null +++ b/DialogflowCx/src/V3/ExportIntentsRequest/DataFormat.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.ExportIntentsRequest.DataFormat + */ +class DataFormat +{ + /** + * Unspecified format. Treated as `BLOB`. + * + * Generated from protobuf enum DATA_FORMAT_UNSPECIFIED = 0; + */ + const DATA_FORMAT_UNSPECIFIED = 0; + /** + * Intents will be exported as raw bytes. + * + * Generated from protobuf enum BLOB = 1; + */ + const BLOB = 1; + /** + * Intents will be exported in JSON format. + * + * Generated from protobuf enum JSON = 2; + */ + const JSON = 2; + /** + * Intents will be exported in CSV format. + * + * Generated from protobuf enum CSV = 3; + */ + const CSV = 3; + + private static $valueToName = [ + self::DATA_FORMAT_UNSPECIFIED => 'DATA_FORMAT_UNSPECIFIED', + self::BLOB => 'BLOB', + self::JSON => 'JSON', + self::CSV => 'CSV', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ExportIntentsResponse.php b/DialogflowCx/src/V3/ExportIntentsResponse.php new file mode 100644 index 000000000000..6700f6cc1ba1 --- /dev/null +++ b/DialogflowCx/src/V3/ExportIntentsResponse.php @@ -0,0 +1,121 @@ +google.cloud.dialogflow.cx.v3.ExportIntentsResponse + */ +class ExportIntentsResponse extends \Google\Protobuf\Internal\Message +{ + protected $intents; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $intents_uri + * The URI to a file containing the exported intents. This field is + * populated only if `intents_uri` is specified in + * [ExportIntentsRequest][google.cloud.dialogflow.cx.v3.ExportIntentsRequest]. + * @type \Google\Cloud\Dialogflow\Cx\V3\InlineDestination $intents_content + * Uncompressed byte content for intents. This field is populated only if + * `intents_content_inline` is set to true in + * [ExportIntentsRequest][google.cloud.dialogflow.cx.v3.ExportIntentsRequest]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * The URI to a file containing the exported intents. This field is + * populated only if `intents_uri` is specified in + * [ExportIntentsRequest][google.cloud.dialogflow.cx.v3.ExportIntentsRequest]. + * + * Generated from protobuf field string intents_uri = 1; + * @return string + */ + public function getIntentsUri() + { + return $this->readOneof(1); + } + + public function hasIntentsUri() + { + return $this->hasOneof(1); + } + + /** + * The URI to a file containing the exported intents. This field is + * populated only if `intents_uri` is specified in + * [ExportIntentsRequest][google.cloud.dialogflow.cx.v3.ExportIntentsRequest]. + * + * Generated from protobuf field string intents_uri = 1; + * @param string $var + * @return $this + */ + public function setIntentsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Uncompressed byte content for intents. This field is populated only if + * `intents_content_inline` is set to true in + * [ExportIntentsRequest][google.cloud.dialogflow.cx.v3.ExportIntentsRequest]. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InlineDestination intents_content = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\InlineDestination|null + */ + public function getIntentsContent() + { + return $this->readOneof(2); + } + + public function hasIntentsContent() + { + return $this->hasOneof(2); + } + + /** + * Uncompressed byte content for intents. This field is populated only if + * `intents_content_inline` is set to true in + * [ExportIntentsRequest][google.cloud.dialogflow.cx.v3.ExportIntentsRequest]. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InlineDestination intents_content = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\InlineDestination $var + * @return $this + */ + public function setIntentsContent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\InlineDestination::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getIntents() + { + return $this->whichOneof("intents"); + } + +} + diff --git a/DialogflowCx/src/V3/ExportTestCasesMetadata.php b/DialogflowCx/src/V3/ExportTestCasesMetadata.php new file mode 100644 index 000000000000..b4c4d009858d --- /dev/null +++ b/DialogflowCx/src/V3/ExportTestCasesMetadata.php @@ -0,0 +1,35 @@ +google.cloud.dialogflow.cx.v3.ExportTestCasesMetadata + */ +class ExportTestCasesMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + +} + diff --git a/DialogflowCx/src/V3/ExportTestCasesRequest.php b/DialogflowCx/src/V3/ExportTestCasesRequest.php new file mode 100644 index 000000000000..4d94d37ffdd8 --- /dev/null +++ b/DialogflowCx/src/V3/ExportTestCasesRequest.php @@ -0,0 +1,234 @@ +google.cloud.dialogflow.cx.v3.ExportTestCasesRequest + */ +class ExportTestCasesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent where to export test cases from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The data format of the exported test cases. If not specified, `BLOB` is + * assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportTestCasesRequest.DataFormat data_format = 3; + */ + protected $data_format = 0; + /** + * The filter expression used to filter exported test cases, see + * [API Filtering](https://aip.dev/160). The expression is case insensitive + * and supports the following syntax: + * name = [OR name = ] ... + * For example: + * * "name = t1 OR name = t2" matches the test case with the exact resource + * name "t1" or "t2". + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent where to export test cases from. + * Format: `projects//locations//agents/`. + * @type string $gcs_uri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to + * export the test cases to. The format of this URI must be + * `gs:///`. If unspecified, the serialized test + * cases is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type int $data_format + * The data format of the exported test cases. If not specified, `BLOB` is + * assumed. + * @type string $filter + * The filter expression used to filter exported test cases, see + * [API Filtering](https://aip.dev/160). The expression is case insensitive + * and supports the following syntax: + * name = [OR name = ] ... + * For example: + * * "name = t1 OR name = t2" matches the test case with the exact resource + * name "t1" or "t2". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent where to export test cases from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent where to export test cases from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to + * export the test cases to. The format of this URI must be + * `gs:///`. If unspecified, the serialized test + * cases is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string gcs_uri = 2; + * @return string + */ + public function getGcsUri() + { + return $this->readOneof(2); + } + + public function hasGcsUri() + { + return $this->hasOneof(2); + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to + * export the test cases to. The format of this URI must be + * `gs:///`. If unspecified, the serialized test + * cases is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string gcs_uri = 2; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The data format of the exported test cases. If not specified, `BLOB` is + * assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportTestCasesRequest.DataFormat data_format = 3; + * @return int + */ + public function getDataFormat() + { + return $this->data_format; + } + + /** + * The data format of the exported test cases. If not specified, `BLOB` is + * assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportTestCasesRequest.DataFormat data_format = 3; + * @param int $var + * @return $this + */ + public function setDataFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ExportTestCasesRequest\DataFormat::class); + $this->data_format = $var; + + return $this; + } + + /** + * The filter expression used to filter exported test cases, see + * [API Filtering](https://aip.dev/160). The expression is case insensitive + * and supports the following syntax: + * name = [OR name = ] ... + * For example: + * * "name = t1 OR name = t2" matches the test case with the exact resource + * name "t1" or "t2". + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression used to filter exported test cases, see + * [API Filtering](https://aip.dev/160). The expression is case insensitive + * and supports the following syntax: + * name = [OR name = ] ... + * For example: + * * "name = t1 OR name = t2" matches the test case with the exact resource + * name "t1" or "t2". + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/DialogflowCx/src/V3/ExportTestCasesRequest/DataFormat.php b/DialogflowCx/src/V3/ExportTestCasesRequest/DataFormat.php new file mode 100644 index 000000000000..59b22043d005 --- /dev/null +++ b/DialogflowCx/src/V3/ExportTestCasesRequest/DataFormat.php @@ -0,0 +1,62 @@ +google.cloud.dialogflow.cx.v3.ExportTestCasesRequest.DataFormat + */ +class DataFormat +{ + /** + * Unspecified format. + * + * Generated from protobuf enum DATA_FORMAT_UNSPECIFIED = 0; + */ + const DATA_FORMAT_UNSPECIFIED = 0; + /** + * Raw bytes. + * + * Generated from protobuf enum BLOB = 1; + */ + const BLOB = 1; + /** + * JSON format. + * + * Generated from protobuf enum JSON = 2; + */ + const JSON = 2; + + private static $valueToName = [ + self::DATA_FORMAT_UNSPECIFIED => 'DATA_FORMAT_UNSPECIFIED', + self::BLOB => 'BLOB', + self::JSON => 'JSON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ExportTestCasesResponse.php b/DialogflowCx/src/V3/ExportTestCasesResponse.php new file mode 100644 index 000000000000..6247b21ef71f --- /dev/null +++ b/DialogflowCx/src/V3/ExportTestCasesResponse.php @@ -0,0 +1,115 @@ +google.cloud.dialogflow.cx.v3.ExportTestCasesResponse + */ +class ExportTestCasesResponse extends \Google\Protobuf\Internal\Message +{ + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $gcs_uri + * The URI to a file containing the exported test cases. This field is + * populated only if `gcs_uri` is specified in + * [ExportTestCasesRequest][google.cloud.dialogflow.cx.v3.ExportTestCasesRequest]. + * @type string $content + * Uncompressed raw byte content for test cases. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The URI to a file containing the exported test cases. This field is + * populated only if `gcs_uri` is specified in + * [ExportTestCasesRequest][google.cloud.dialogflow.cx.v3.ExportTestCasesRequest]. + * + * Generated from protobuf field string gcs_uri = 1; + * @return string + */ + public function getGcsUri() + { + return $this->readOneof(1); + } + + public function hasGcsUri() + { + return $this->hasOneof(1); + } + + /** + * The URI to a file containing the exported test cases. This field is + * populated only if `gcs_uri` is specified in + * [ExportTestCasesRequest][google.cloud.dialogflow.cx.v3.ExportTestCasesRequest]. + * + * Generated from protobuf field string gcs_uri = 1; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Uncompressed raw byte content for test cases. + * + * Generated from protobuf field bytes content = 2; + * @return string + */ + public function getContent() + { + return $this->readOneof(2); + } + + public function hasContent() + { + return $this->hasOneof(2); + } + + /** + * Uncompressed raw byte content for test cases. + * + * Generated from protobuf field bytes content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/DialogflowCx/src/V3/Flow.php b/DialogflowCx/src/V3/Flow.php new file mode 100644 index 000000000000..606337f75981 --- /dev/null +++ b/DialogflowCx/src/V3/Flow.php @@ -0,0 +1,520 @@ +google.cloud.dialogflow.cx.v3.Flow + */ +class Flow extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the flow. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the flow. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * The description of the flow. The maximum length is 500 characters. If + * exceeded, the request is rejected. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + /** + * A flow's transition routes serve two purposes: + * * They are responsible for matching the user's first utterances in the + * flow. + * * They are inherited by every page's [transition + * routes][Page.transition_routes] and can support use cases such as the user + * saying "help" or "can I talk to a human?", which can be handled in a common + * way regardless of the current page. Transition routes defined in the page + * have higher priority than those defined in the flow. + * TransitionRoutes are evalauted in the following order: + * * TransitionRoutes with intent specified. + * * TransitionRoutes with only condition specified. + * TransitionRoutes with intent specified are inherited by pages in the flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRoute transition_routes = 4; + */ + private $transition_routes; + /** + * A flow's event handlers serve two purposes: + * * They are responsible for handling events (e.g. no match, + * webhook errors) in the flow. + * * They are inherited by every page's [event + * handlers][Page.event_handlers], which can be used to handle common events + * regardless of the current page. Event handlers defined in the page + * have higher priority than those defined in the flow. + * Unlike + * [transition_routes][google.cloud.dialogflow.cx.v3.Flow.transition_routes], + * these handlers are evaluated on a first-match basis. The first one that + * matches the event get executed, with the rest being ignored. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler event_handlers = 10; + */ + private $event_handlers; + /** + * A flow's transition route group serve two purposes: + * * They are responsible for matching the user's first utterances in the + * flow. + * * They are inherited by every page's [transition + * route groups][Page.transition_route_groups]. Transition route groups + * defined in the page have higher priority than those defined in the flow. + * Format:`projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/` for agent-level + * groups. + * + * Generated from protobuf field repeated string transition_route_groups = 15 [(.google.api.resource_reference) = { + */ + private $transition_route_groups; + /** + * NLU related settings of the flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings nlu_settings = 11; + */ + protected $nlu_settings = null; + /** + * Hierarchical advanced settings for this flow. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 14; + */ + protected $advanced_settings = null; + /** + * Optional. Knowledge connector configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.KnowledgeConnectorSettings knowledge_connector_settings = 18 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $knowledge_connector_settings = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the flow. + * Format: `projects//locations//agents//flows/`. + * @type string $display_name + * Required. The human-readable name of the flow. + * @type string $description + * The description of the flow. The maximum length is 500 characters. If + * exceeded, the request is rejected. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TransitionRoute>|\Google\Protobuf\Internal\RepeatedField $transition_routes + * A flow's transition routes serve two purposes: + * * They are responsible for matching the user's first utterances in the + * flow. + * * They are inherited by every page's [transition + * routes][Page.transition_routes] and can support use cases such as the user + * saying "help" or "can I talk to a human?", which can be handled in a common + * way regardless of the current page. Transition routes defined in the page + * have higher priority than those defined in the flow. + * TransitionRoutes are evalauted in the following order: + * * TransitionRoutes with intent specified. + * * TransitionRoutes with only condition specified. + * TransitionRoutes with intent specified are inherited by pages in the flow. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\EventHandler>|\Google\Protobuf\Internal\RepeatedField $event_handlers + * A flow's event handlers serve two purposes: + * * They are responsible for handling events (e.g. no match, + * webhook errors) in the flow. + * * They are inherited by every page's [event + * handlers][Page.event_handlers], which can be used to handle common events + * regardless of the current page. Event handlers defined in the page + * have higher priority than those defined in the flow. + * Unlike + * [transition_routes][google.cloud.dialogflow.cx.v3.Flow.transition_routes], + * these handlers are evaluated on a first-match basis. The first one that + * matches the event get executed, with the rest being ignored. + * @type array|\Google\Protobuf\Internal\RepeatedField $transition_route_groups + * A flow's transition route group serve two purposes: + * * They are responsible for matching the user's first utterances in the + * flow. + * * They are inherited by every page's [transition + * route groups][Page.transition_route_groups]. Transition route groups + * defined in the page have higher priority than those defined in the flow. + * Format:`projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/` for agent-level + * groups. + * @type \Google\Cloud\Dialogflow\Cx\V3\NluSettings $nlu_settings + * NLU related settings of the flow. + * @type \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $advanced_settings + * Hierarchical advanced settings for this flow. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * @type \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings $knowledge_connector_settings + * Optional. Knowledge connector configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the flow. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the flow. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the flow. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the flow. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The description of the flow. The maximum length is 500 characters. If + * exceeded, the request is rejected. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the flow. The maximum length is 500 characters. If + * exceeded, the request is rejected. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * A flow's transition routes serve two purposes: + * * They are responsible for matching the user's first utterances in the + * flow. + * * They are inherited by every page's [transition + * routes][Page.transition_routes] and can support use cases such as the user + * saying "help" or "can I talk to a human?", which can be handled in a common + * way regardless of the current page. Transition routes defined in the page + * have higher priority than those defined in the flow. + * TransitionRoutes are evalauted in the following order: + * * TransitionRoutes with intent specified. + * * TransitionRoutes with only condition specified. + * TransitionRoutes with intent specified are inherited by pages in the flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRoute transition_routes = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitionRoutes() + { + return $this->transition_routes; + } + + /** + * A flow's transition routes serve two purposes: + * * They are responsible for matching the user's first utterances in the + * flow. + * * They are inherited by every page's [transition + * routes][Page.transition_routes] and can support use cases such as the user + * saying "help" or "can I talk to a human?", which can be handled in a common + * way regardless of the current page. Transition routes defined in the page + * have higher priority than those defined in the flow. + * TransitionRoutes are evalauted in the following order: + * * TransitionRoutes with intent specified. + * * TransitionRoutes with only condition specified. + * TransitionRoutes with intent specified are inherited by pages in the flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRoute transition_routes = 4; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TransitionRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitionRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TransitionRoute::class); + $this->transition_routes = $arr; + + return $this; + } + + /** + * A flow's event handlers serve two purposes: + * * They are responsible for handling events (e.g. no match, + * webhook errors) in the flow. + * * They are inherited by every page's [event + * handlers][Page.event_handlers], which can be used to handle common events + * regardless of the current page. Event handlers defined in the page + * have higher priority than those defined in the flow. + * Unlike + * [transition_routes][google.cloud.dialogflow.cx.v3.Flow.transition_routes], + * these handlers are evaluated on a first-match basis. The first one that + * matches the event get executed, with the rest being ignored. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler event_handlers = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEventHandlers() + { + return $this->event_handlers; + } + + /** + * A flow's event handlers serve two purposes: + * * They are responsible for handling events (e.g. no match, + * webhook errors) in the flow. + * * They are inherited by every page's [event + * handlers][Page.event_handlers], which can be used to handle common events + * regardless of the current page. Event handlers defined in the page + * have higher priority than those defined in the flow. + * Unlike + * [transition_routes][google.cloud.dialogflow.cx.v3.Flow.transition_routes], + * these handlers are evaluated on a first-match basis. The first one that + * matches the event get executed, with the rest being ignored. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler event_handlers = 10; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\EventHandler>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEventHandlers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\EventHandler::class); + $this->event_handlers = $arr; + + return $this; + } + + /** + * A flow's transition route group serve two purposes: + * * They are responsible for matching the user's first utterances in the + * flow. + * * They are inherited by every page's [transition + * route groups][Page.transition_route_groups]. Transition route groups + * defined in the page have higher priority than those defined in the flow. + * Format:`projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/` for agent-level + * groups. + * + * Generated from protobuf field repeated string transition_route_groups = 15 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitionRouteGroups() + { + return $this->transition_route_groups; + } + + /** + * A flow's transition route group serve two purposes: + * * They are responsible for matching the user's first utterances in the + * flow. + * * They are inherited by every page's [transition + * route groups][Page.transition_route_groups]. Transition route groups + * defined in the page have higher priority than those defined in the flow. + * Format:`projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/` for agent-level + * groups. + * + * Generated from protobuf field repeated string transition_route_groups = 15 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitionRouteGroups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->transition_route_groups = $arr; + + return $this; + } + + /** + * NLU related settings of the flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings nlu_settings = 11; + * @return \Google\Cloud\Dialogflow\Cx\V3\NluSettings|null + */ + public function getNluSettings() + { + return $this->nlu_settings; + } + + public function hasNluSettings() + { + return isset($this->nlu_settings); + } + + public function clearNluSettings() + { + unset($this->nlu_settings); + } + + /** + * NLU related settings of the flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings nlu_settings = 11; + * @param \Google\Cloud\Dialogflow\Cx\V3\NluSettings $var + * @return $this + */ + public function setNluSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\NluSettings::class); + $this->nlu_settings = $var; + + return $this; + } + + /** + * Hierarchical advanced settings for this flow. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 14; + * @return \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings|null + */ + public function getAdvancedSettings() + { + return $this->advanced_settings; + } + + public function hasAdvancedSettings() + { + return isset($this->advanced_settings); + } + + public function clearAdvancedSettings() + { + unset($this->advanced_settings); + } + + /** + * Hierarchical advanced settings for this flow. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 14; + * @param \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $var + * @return $this + */ + public function setAdvancedSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::class); + $this->advanced_settings = $var; + + return $this; + } + + /** + * Optional. Knowledge connector configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.KnowledgeConnectorSettings knowledge_connector_settings = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings|null + */ + public function getKnowledgeConnectorSettings() + { + return $this->knowledge_connector_settings; + } + + public function hasKnowledgeConnectorSettings() + { + return isset($this->knowledge_connector_settings); + } + + public function clearKnowledgeConnectorSettings() + { + unset($this->knowledge_connector_settings); + } + + /** + * Optional. Knowledge connector configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.KnowledgeConnectorSettings knowledge_connector_settings = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings $var + * @return $this + */ + public function setKnowledgeConnectorSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings::class); + $this->knowledge_connector_settings = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/FlowImportStrategy.php b/DialogflowCx/src/V3/FlowImportStrategy.php new file mode 100644 index 000000000000..8967acb7001e --- /dev/null +++ b/DialogflowCx/src/V3/FlowImportStrategy.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.FlowImportStrategy + */ +class FlowImportStrategy extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Import strategy for resource conflict resolution, applied + * globally throughout the flow. It will be applied for all display name + * conflicts in the imported content. If not specified, 'CREATE_NEW' is + * assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy global_import_strategy = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $global_import_strategy = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $global_import_strategy + * Optional. Import strategy for resource conflict resolution, applied + * globally throughout the flow. It will be applied for all display name + * conflicts in the imported content. If not specified, 'CREATE_NEW' is + * assumed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Import strategy for resource conflict resolution, applied + * globally throughout the flow. It will be applied for all display name + * conflicts in the imported content. If not specified, 'CREATE_NEW' is + * assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy global_import_strategy = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getGlobalImportStrategy() + { + return $this->global_import_strategy; + } + + /** + * Optional. Import strategy for resource conflict resolution, applied + * globally throughout the flow. It will be applied for all display name + * conflicts in the imported content. If not specified, 'CREATE_NEW' is + * assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy global_import_strategy = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setGlobalImportStrategy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ImportStrategy::class); + $this->global_import_strategy = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/FlowValidationResult.php b/DialogflowCx/src/V3/FlowValidationResult.php new file mode 100644 index 000000000000..e09b98e2d7c4 --- /dev/null +++ b/DialogflowCx/src/V3/FlowValidationResult.php @@ -0,0 +1,154 @@ +google.cloud.dialogflow.cx.v3.FlowValidationResult + */ +class FlowValidationResult extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the flow validation result. + * Format: `projects//locations//agents//flows//validationResult`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Contains all validation messages. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ValidationMessage validation_messages = 2; + */ + private $validation_messages; + /** + * Last time the flow was validated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the flow validation result. + * Format: `projects//locations//agents//flows//validationResult`. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ValidationMessage>|\Google\Protobuf\Internal\RepeatedField $validation_messages + * Contains all validation messages. + * @type \Google\Protobuf\Timestamp $update_time + * Last time the flow was validated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the flow validation result. + * Format: `projects//locations//agents//flows//validationResult`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the flow validation result. + * Format: `projects//locations//agents//flows//validationResult`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Contains all validation messages. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ValidationMessage validation_messages = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getValidationMessages() + { + return $this->validation_messages; + } + + /** + * Contains all validation messages. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ValidationMessage validation_messages = 2; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ValidationMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setValidationMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ValidationMessage::class); + $this->validation_messages = $arr; + + return $this; + } + + /** + * Last time the flow was validated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Last time the flow was validated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 3; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/FlowsClient.php b/DialogflowCx/src/V3/FlowsClient.php new file mode 100644 index 000000000000..c8a76592c8a8 --- /dev/null +++ b/DialogflowCx/src/V3/FlowsClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.Form + */ +class Form extends \Google\Protobuf\Internal\Message +{ + /** + * Parameters to collect from the user. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Form.Parameter parameters = 1; + */ + private $parameters; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Form\Parameter>|\Google\Protobuf\Internal\RepeatedField $parameters + * Parameters to collect from the user. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Parameters to collect from the user. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Form.Parameter parameters = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * Parameters to collect from the user. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Form.Parameter parameters = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Form\Parameter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Form\Parameter::class); + $this->parameters = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Form/Parameter.php b/DialogflowCx/src/V3/Form/Parameter.php new file mode 100644 index 000000000000..d327e14bf300 --- /dev/null +++ b/DialogflowCx/src/V3/Form/Parameter.php @@ -0,0 +1,396 @@ +google.cloud.dialogflow.cx.v3.Form.Parameter + */ +class Parameter extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The human-readable name of the parameter, unique within the + * form. + * + * Generated from protobuf field string display_name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Indicates whether the parameter is required. Optional parameters will not + * trigger prompts; however, they are filled if the user specifies them. + * Required parameters must be filled before form filling concludes. + * + * Generated from protobuf field bool required = 2; + */ + protected $required = false; + /** + * Required. The entity type of the parameter. + * Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + * `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + * `projects//locations//agents//entityTypes/` for developer entity types. + * + * Generated from protobuf field string entity_type = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $entity_type = ''; + /** + * Indicates whether the parameter represents a list of values. + * + * Generated from protobuf field bool is_list = 4; + */ + protected $is_list = false; + /** + * Required. Defines fill behavior for the parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Form.Parameter.FillBehavior fill_behavior = 7 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fill_behavior = null; + /** + * The default value of an optional parameter. If the parameter is required, + * the default value will be ignored. + * + * Generated from protobuf field .google.protobuf.Value default_value = 9; + */ + protected $default_value = null; + /** + * Indicates whether the parameter content should be redacted in log. If + * redaction is enabled, the parameter content will be replaced by parameter + * name during logging. + * Note: the parameter content is subject to redaction if either parameter + * level redaction or [entity type level + * redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. + * + * Generated from protobuf field bool redact = 11; + */ + protected $redact = false; + /** + * Hierarchical advanced settings for this parameter. The settings exposed + * at the lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 12; + */ + protected $advanced_settings = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * Required. The human-readable name of the parameter, unique within the + * form. + * @type bool $required + * Indicates whether the parameter is required. Optional parameters will not + * trigger prompts; however, they are filled if the user specifies them. + * Required parameters must be filled before form filling concludes. + * @type string $entity_type + * Required. The entity type of the parameter. + * Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + * `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + * `projects//locations//agents//entityTypes/` for developer entity types. + * @type bool $is_list + * Indicates whether the parameter represents a list of values. + * @type \Google\Cloud\Dialogflow\Cx\V3\Form\Parameter\FillBehavior $fill_behavior + * Required. Defines fill behavior for the parameter. + * @type \Google\Protobuf\Value $default_value + * The default value of an optional parameter. If the parameter is required, + * the default value will be ignored. + * @type bool $redact + * Indicates whether the parameter content should be redacted in log. If + * redaction is enabled, the parameter content will be replaced by parameter + * name during logging. + * Note: the parameter content is subject to redaction if either parameter + * level redaction or [entity type level + * redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. + * @type \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $advanced_settings + * Hierarchical advanced settings for this parameter. The settings exposed + * at the lower level overrides the settings exposed at the higher level. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Required. The human-readable name of the parameter, unique within the + * form. + * + * Generated from protobuf field string display_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the parameter, unique within the + * form. + * + * Generated from protobuf field string display_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Indicates whether the parameter is required. Optional parameters will not + * trigger prompts; however, they are filled if the user specifies them. + * Required parameters must be filled before form filling concludes. + * + * Generated from protobuf field bool required = 2; + * @return bool + */ + public function getRequired() + { + return $this->required; + } + + /** + * Indicates whether the parameter is required. Optional parameters will not + * trigger prompts; however, they are filled if the user specifies them. + * Required parameters must be filled before form filling concludes. + * + * Generated from protobuf field bool required = 2; + * @param bool $var + * @return $this + */ + public function setRequired($var) + { + GPBUtil::checkBool($var); + $this->required = $var; + + return $this; + } + + /** + * Required. The entity type of the parameter. + * Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + * `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + * `projects//locations//agents//entityTypes/` for developer entity types. + * + * Generated from protobuf field string entity_type = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getEntityType() + { + return $this->entity_type; + } + + /** + * Required. The entity type of the parameter. + * Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + * `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + * `projects//locations//agents//entityTypes/` for developer entity types. + * + * Generated from protobuf field string entity_type = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEntityType($var) + { + GPBUtil::checkString($var, True); + $this->entity_type = $var; + + return $this; + } + + /** + * Indicates whether the parameter represents a list of values. + * + * Generated from protobuf field bool is_list = 4; + * @return bool + */ + public function getIsList() + { + return $this->is_list; + } + + /** + * Indicates whether the parameter represents a list of values. + * + * Generated from protobuf field bool is_list = 4; + * @param bool $var + * @return $this + */ + public function setIsList($var) + { + GPBUtil::checkBool($var); + $this->is_list = $var; + + return $this; + } + + /** + * Required. Defines fill behavior for the parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Form.Parameter.FillBehavior fill_behavior = 7 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Form\Parameter\FillBehavior|null + */ + public function getFillBehavior() + { + return $this->fill_behavior; + } + + public function hasFillBehavior() + { + return isset($this->fill_behavior); + } + + public function clearFillBehavior() + { + unset($this->fill_behavior); + } + + /** + * Required. Defines fill behavior for the parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Form.Parameter.FillBehavior fill_behavior = 7 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Form\Parameter\FillBehavior $var + * @return $this + */ + public function setFillBehavior($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Form\Parameter\FillBehavior::class); + $this->fill_behavior = $var; + + return $this; + } + + /** + * The default value of an optional parameter. If the parameter is required, + * the default value will be ignored. + * + * Generated from protobuf field .google.protobuf.Value default_value = 9; + * @return \Google\Protobuf\Value|null + */ + public function getDefaultValue() + { + return $this->default_value; + } + + public function hasDefaultValue() + { + return isset($this->default_value); + } + + public function clearDefaultValue() + { + unset($this->default_value); + } + + /** + * The default value of an optional parameter. If the parameter is required, + * the default value will be ignored. + * + * Generated from protobuf field .google.protobuf.Value default_value = 9; + * @param \Google\Protobuf\Value $var + * @return $this + */ + public function setDefaultValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Value::class); + $this->default_value = $var; + + return $this; + } + + /** + * Indicates whether the parameter content should be redacted in log. If + * redaction is enabled, the parameter content will be replaced by parameter + * name during logging. + * Note: the parameter content is subject to redaction if either parameter + * level redaction or [entity type level + * redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. + * + * Generated from protobuf field bool redact = 11; + * @return bool + */ + public function getRedact() + { + return $this->redact; + } + + /** + * Indicates whether the parameter content should be redacted in log. If + * redaction is enabled, the parameter content will be replaced by parameter + * name during logging. + * Note: the parameter content is subject to redaction if either parameter + * level redaction or [entity type level + * redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. + * + * Generated from protobuf field bool redact = 11; + * @param bool $var + * @return $this + */ + public function setRedact($var) + { + GPBUtil::checkBool($var); + $this->redact = $var; + + return $this; + } + + /** + * Hierarchical advanced settings for this parameter. The settings exposed + * at the lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 12; + * @return \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings|null + */ + public function getAdvancedSettings() + { + return $this->advanced_settings; + } + + public function hasAdvancedSettings() + { + return isset($this->advanced_settings); + } + + public function clearAdvancedSettings() + { + unset($this->advanced_settings); + } + + /** + * Hierarchical advanced settings for this parameter. The settings exposed + * at the lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 12; + * @param \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $var + * @return $this + */ + public function setAdvancedSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::class); + $this->advanced_settings = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Form/Parameter/FillBehavior.php b/DialogflowCx/src/V3/Form/Parameter/FillBehavior.php new file mode 100644 index 000000000000..9518d70aaced --- /dev/null +++ b/DialogflowCx/src/V3/Form/Parameter/FillBehavior.php @@ -0,0 +1,220 @@ +google.cloud.dialogflow.cx.v3.Form.Parameter.FillBehavior + */ +class FillBehavior extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The fulfillment to provide the initial prompt that the agent + * can present to the user in order to fill the parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment initial_prompt_fulfillment = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $initial_prompt_fulfillment = null; + /** + * The handlers for parameter-level events, used to provide reprompt for + * the parameter or transition to a different page/flow. The supported + * events are: + * * `sys.no-match-`, where N can be from 1 to 6 + * * `sys.no-match-default` + * * `sys.no-input-`, where N can be from 1 to 6 + * * `sys.no-input-default` + * * `sys.invalid-parameter` + * `initial_prompt_fulfillment` provides the first prompt for the + * parameter. + * If the user's response does not fill the parameter, a + * no-match/no-input event will be triggered, and the fulfillment + * associated with the `sys.no-match-1`/`sys.no-input-1` handler (if + * defined) will be called to provide a prompt. The + * `sys.no-match-2`/`sys.no-input-2` handler (if defined) will respond to + * the next no-match/no-input event, and so on. + * A `sys.no-match-default` or `sys.no-input-default` handler will be used + * to handle all following no-match/no-input events after all numbered + * no-match/no-input handlers for the parameter are consumed. + * A `sys.invalid-parameter` handler can be defined to handle the case + * where the parameter values have been `invalidated` by webhook. For + * example, if the user's response fill the parameter, however the + * parameter was invalidated by webhook, the fulfillment associated with + * the `sys.invalid-parameter` handler (if defined) will be called to + * provide a prompt. + * If the event handler for the corresponding event can't be found on the + * parameter, `initial_prompt_fulfillment` will be re-prompted. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler reprompt_event_handlers = 5; + */ + private $reprompt_event_handlers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $initial_prompt_fulfillment + * Required. The fulfillment to provide the initial prompt that the agent + * can present to the user in order to fill the parameter. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\EventHandler>|\Google\Protobuf\Internal\RepeatedField $reprompt_event_handlers + * The handlers for parameter-level events, used to provide reprompt for + * the parameter or transition to a different page/flow. The supported + * events are: + * * `sys.no-match-`, where N can be from 1 to 6 + * * `sys.no-match-default` + * * `sys.no-input-`, where N can be from 1 to 6 + * * `sys.no-input-default` + * * `sys.invalid-parameter` + * `initial_prompt_fulfillment` provides the first prompt for the + * parameter. + * If the user's response does not fill the parameter, a + * no-match/no-input event will be triggered, and the fulfillment + * associated with the `sys.no-match-1`/`sys.no-input-1` handler (if + * defined) will be called to provide a prompt. The + * `sys.no-match-2`/`sys.no-input-2` handler (if defined) will respond to + * the next no-match/no-input event, and so on. + * A `sys.no-match-default` or `sys.no-input-default` handler will be used + * to handle all following no-match/no-input events after all numbered + * no-match/no-input handlers for the parameter are consumed. + * A `sys.invalid-parameter` handler can be defined to handle the case + * where the parameter values have been `invalidated` by webhook. For + * example, if the user's response fill the parameter, however the + * parameter was invalidated by webhook, the fulfillment associated with + * the `sys.invalid-parameter` handler (if defined) will be called to + * provide a prompt. + * If the event handler for the corresponding event can't be found on the + * parameter, `initial_prompt_fulfillment` will be re-prompted. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Required. The fulfillment to provide the initial prompt that the agent + * can present to the user in order to fill the parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment initial_prompt_fulfillment = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Fulfillment|null + */ + public function getInitialPromptFulfillment() + { + return $this->initial_prompt_fulfillment; + } + + public function hasInitialPromptFulfillment() + { + return isset($this->initial_prompt_fulfillment); + } + + public function clearInitialPromptFulfillment() + { + unset($this->initial_prompt_fulfillment); + } + + /** + * Required. The fulfillment to provide the initial prompt that the agent + * can present to the user in order to fill the parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment initial_prompt_fulfillment = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $var + * @return $this + */ + public function setInitialPromptFulfillment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment::class); + $this->initial_prompt_fulfillment = $var; + + return $this; + } + + /** + * The handlers for parameter-level events, used to provide reprompt for + * the parameter or transition to a different page/flow. The supported + * events are: + * * `sys.no-match-`, where N can be from 1 to 6 + * * `sys.no-match-default` + * * `sys.no-input-`, where N can be from 1 to 6 + * * `sys.no-input-default` + * * `sys.invalid-parameter` + * `initial_prompt_fulfillment` provides the first prompt for the + * parameter. + * If the user's response does not fill the parameter, a + * no-match/no-input event will be triggered, and the fulfillment + * associated with the `sys.no-match-1`/`sys.no-input-1` handler (if + * defined) will be called to provide a prompt. The + * `sys.no-match-2`/`sys.no-input-2` handler (if defined) will respond to + * the next no-match/no-input event, and so on. + * A `sys.no-match-default` or `sys.no-input-default` handler will be used + * to handle all following no-match/no-input events after all numbered + * no-match/no-input handlers for the parameter are consumed. + * A `sys.invalid-parameter` handler can be defined to handle the case + * where the parameter values have been `invalidated` by webhook. For + * example, if the user's response fill the parameter, however the + * parameter was invalidated by webhook, the fulfillment associated with + * the `sys.invalid-parameter` handler (if defined) will be called to + * provide a prompt. + * If the event handler for the corresponding event can't be found on the + * parameter, `initial_prompt_fulfillment` will be re-prompted. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler reprompt_event_handlers = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRepromptEventHandlers() + { + return $this->reprompt_event_handlers; + } + + /** + * The handlers for parameter-level events, used to provide reprompt for + * the parameter or transition to a different page/flow. The supported + * events are: + * * `sys.no-match-`, where N can be from 1 to 6 + * * `sys.no-match-default` + * * `sys.no-input-`, where N can be from 1 to 6 + * * `sys.no-input-default` + * * `sys.invalid-parameter` + * `initial_prompt_fulfillment` provides the first prompt for the + * parameter. + * If the user's response does not fill the parameter, a + * no-match/no-input event will be triggered, and the fulfillment + * associated with the `sys.no-match-1`/`sys.no-input-1` handler (if + * defined) will be called to provide a prompt. The + * `sys.no-match-2`/`sys.no-input-2` handler (if defined) will respond to + * the next no-match/no-input event, and so on. + * A `sys.no-match-default` or `sys.no-input-default` handler will be used + * to handle all following no-match/no-input events after all numbered + * no-match/no-input handlers for the parameter are consumed. + * A `sys.invalid-parameter` handler can be defined to handle the case + * where the parameter values have been `invalidated` by webhook. For + * example, if the user's response fill the parameter, however the + * parameter was invalidated by webhook, the fulfillment associated with + * the `sys.invalid-parameter` handler (if defined) will be called to + * provide a prompt. + * If the event handler for the corresponding event can't be found on the + * parameter, `initial_prompt_fulfillment` will be re-prompted. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler reprompt_event_handlers = 5; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\EventHandler>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRepromptEventHandlers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\EventHandler::class); + $this->reprompt_event_handlers = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/FulfillIntentRequest.php b/DialogflowCx/src/V3/FulfillIntentRequest.php new file mode 100644 index 000000000000..c6f30da68ac9 --- /dev/null +++ b/DialogflowCx/src/V3/FulfillIntentRequest.php @@ -0,0 +1,169 @@ +google.cloud.dialogflow.cx.v3.FulfillIntentRequest + */ +class FulfillIntentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Must be same as the corresponding MatchIntent request, otherwise the + * behavior is undefined. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.MatchIntentRequest match_intent_request = 1; + */ + protected $match_intent_request = null; + /** + * The matched intent/event to fulfill. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match match = 2; + */ + protected $match = null; + /** + * Instructs the speech synthesizer how to generate output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 3; + */ + protected $output_audio_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\MatchIntentRequest $match_intent_request + * Must be same as the corresponding MatchIntent request, otherwise the + * behavior is undefined. + * @type \Google\Cloud\Dialogflow\Cx\V3\PBMatch $match + * The matched intent/event to fulfill. + * @type \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $output_audio_config + * Instructs the speech synthesizer how to generate output audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Must be same as the corresponding MatchIntent request, otherwise the + * behavior is undefined. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.MatchIntentRequest match_intent_request = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\MatchIntentRequest|null + */ + public function getMatchIntentRequest() + { + return $this->match_intent_request; + } + + public function hasMatchIntentRequest() + { + return isset($this->match_intent_request); + } + + public function clearMatchIntentRequest() + { + unset($this->match_intent_request); + } + + /** + * Must be same as the corresponding MatchIntent request, otherwise the + * behavior is undefined. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.MatchIntentRequest match_intent_request = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\MatchIntentRequest $var + * @return $this + */ + public function setMatchIntentRequest($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\MatchIntentRequest::class); + $this->match_intent_request = $var; + + return $this; + } + + /** + * The matched intent/event to fulfill. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match match = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\PBMatch|null + */ + public function getMatch() + { + return $this->match; + } + + public function hasMatch() + { + return isset($this->match); + } + + public function clearMatch() + { + unset($this->match); + } + + /** + * The matched intent/event to fulfill. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match match = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\PBMatch $var + * @return $this + */ + public function setMatch($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PBMatch::class); + $this->match = $var; + + return $this; + } + + /** + * Instructs the speech synthesizer how to generate output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig|null + */ + public function getOutputAudioConfig() + { + return $this->output_audio_config; + } + + public function hasOutputAudioConfig() + { + return isset($this->output_audio_config); + } + + public function clearOutputAudioConfig() + { + unset($this->output_audio_config); + } + + /** + * Instructs the speech synthesizer how to generate output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $var + * @return $this + */ + public function setOutputAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig::class); + $this->output_audio_config = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/FulfillIntentResponse.php b/DialogflowCx/src/V3/FulfillIntentResponse.php new file mode 100644 index 000000000000..9840a9a3b515 --- /dev/null +++ b/DialogflowCx/src/V3/FulfillIntentResponse.php @@ -0,0 +1,229 @@ +google.cloud.dialogflow.cx.v3.FulfillIntentResponse + */ +class FulfillIntentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The unique identifier of the response. It can be used to + * locate a response in the training example set or for reporting issues. + * + * Generated from protobuf field string response_id = 1; + */ + protected $response_id = ''; + /** + * The result of the conversational query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryResult query_result = 2; + */ + protected $query_result = null; + /** + * 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.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_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. + * + * Generated from protobuf field bytes output_audio = 3; + */ + protected $output_audio = ''; + /** + * The config used by the speech synthesizer to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 4; + */ + protected $output_audio_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $response_id + * Output only. The unique identifier of the response. It can be used to + * locate a response in the training example set or for reporting issues. + * @type \Google\Cloud\Dialogflow\Cx\V3\QueryResult $query_result + * The result of the conversational query. + * @type string $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.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_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. + * @type \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $output_audio_config + * The config used by the speech synthesizer to generate the output audio. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The unique identifier of the response. It can be used to + * locate a response in the training example set or for reporting issues. + * + * Generated from protobuf field string response_id = 1; + * @return string + */ + public function getResponseId() + { + return $this->response_id; + } + + /** + * Output only. The unique identifier of the response. It can be used to + * locate a response in the training example set or for reporting issues. + * + * Generated from protobuf field string response_id = 1; + * @param string $var + * @return $this + */ + public function setResponseId($var) + { + GPBUtil::checkString($var, True); + $this->response_id = $var; + + return $this; + } + + /** + * The result of the conversational query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryResult query_result = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\QueryResult|null + */ + public function getQueryResult() + { + return $this->query_result; + } + + public function hasQueryResult() + { + return isset($this->query_result); + } + + public function clearQueryResult() + { + unset($this->query_result); + } + + /** + * The result of the conversational query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryResult query_result = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\QueryResult $var + * @return $this + */ + public function setQueryResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\QueryResult::class); + $this->query_result = $var; + + return $this; + } + + /** + * 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.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_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. + * + * Generated from protobuf field bytes output_audio = 3; + * @return string + */ + public function getOutputAudio() + { + return $this->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.response_messages`][google.cloud.dialogflow.cx.v3.QueryResult.response_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. + * + * Generated from protobuf field bytes output_audio = 3; + * @param string $var + * @return $this + */ + public function setOutputAudio($var) + { + GPBUtil::checkString($var, False); + $this->output_audio = $var; + + return $this; + } + + /** + * The config used by the speech synthesizer to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 4; + * @return \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig|null + */ + public function getOutputAudioConfig() + { + return $this->output_audio_config; + } + + public function hasOutputAudioConfig() + { + return isset($this->output_audio_config); + } + + public function clearOutputAudioConfig() + { + unset($this->output_audio_config); + } + + /** + * The config used by the speech synthesizer to generate the output audio. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 4; + * @param \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $var + * @return $this + */ + public function setOutputAudioConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig::class); + $this->output_audio_config = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Fulfillment.php b/DialogflowCx/src/V3/Fulfillment.php new file mode 100644 index 000000000000..a8232743076a --- /dev/null +++ b/DialogflowCx/src/V3/Fulfillment.php @@ -0,0 +1,411 @@ +google.cloud.dialogflow.cx.v3.Fulfillment + */ +class Fulfillment extends \Google\Protobuf\Internal\Message +{ + /** + * The list of rich message responses to present to the user. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage messages = 1; + */ + private $messages; + /** + * The webhook to call. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string webhook = 2 [(.google.api.resource_reference) = { + */ + protected $webhook = ''; + /** + * Whether Dialogflow should return currently queued fulfillment response + * messages in streaming APIs. If a webhook is specified, it happens before + * Dialogflow invokes webhook. + * Warning: + * 1) This flag only affects streaming API. Responses are still queued + * and returned once in non-streaming API. + * 2) The flag can be enabled in any fulfillment but only the first 3 partial + * responses will be returned. You may only want to apply it to fulfillments + * that have slow webhooks. + * + * Generated from protobuf field bool return_partial_responses = 8; + */ + protected $return_partial_responses = false; + /** + * The value of this field will be populated in the + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] + * `fulfillmentInfo.tag` field by Dialogflow when the associated webhook is + * called. + * The tag is typically used by the webhook service to identify which + * fulfillment is being called, but it could be used for other purposes. + * This field is required if `webhook` is specified. + * + * Generated from protobuf field string tag = 3; + */ + protected $tag = ''; + /** + * Set parameter values before executing the webhook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.SetParameterAction set_parameter_actions = 4; + */ + private $set_parameter_actions; + /** + * Conditional cases for this fulfillment. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases conditional_cases = 5; + */ + private $conditional_cases; + /** + * Hierarchical advanced settings for this fulfillment. The settings exposed + * at the lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 7; + */ + protected $advanced_settings = null; + /** + * If the flag is true, the agent will utilize LLM to generate a text + * response. If LLM generation fails, the defined + * [responses][google.cloud.dialogflow.cx.v3.Fulfillment.messages] in the + * fulfillment will be respected. This flag is only useful for fulfillments + * associated with no-match event handlers. + * + * Generated from protobuf field bool enable_generative_fallback = 12; + */ + protected $enable_generative_fallback = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage>|\Google\Protobuf\Internal\RepeatedField $messages + * The list of rich message responses to present to the user. + * @type string $webhook + * The webhook to call. + * Format: `projects//locations//agents//webhooks/`. + * @type bool $return_partial_responses + * Whether Dialogflow should return currently queued fulfillment response + * messages in streaming APIs. If a webhook is specified, it happens before + * Dialogflow invokes webhook. + * Warning: + * 1) This flag only affects streaming API. Responses are still queued + * and returned once in non-streaming API. + * 2) The flag can be enabled in any fulfillment but only the first 3 partial + * responses will be returned. You may only want to apply it to fulfillments + * that have slow webhooks. + * @type string $tag + * The value of this field will be populated in the + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] + * `fulfillmentInfo.tag` field by Dialogflow when the associated webhook is + * called. + * The tag is typically used by the webhook service to identify which + * fulfillment is being called, but it could be used for other purposes. + * This field is required if `webhook` is specified. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Fulfillment\SetParameterAction>|\Google\Protobuf\Internal\RepeatedField $set_parameter_actions + * Set parameter values before executing the webhook. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases>|\Google\Protobuf\Internal\RepeatedField $conditional_cases + * Conditional cases for this fulfillment. + * @type \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $advanced_settings + * Hierarchical advanced settings for this fulfillment. The settings exposed + * at the lower level overrides the settings exposed at the higher level. + * @type bool $enable_generative_fallback + * If the flag is true, the agent will utilize LLM to generate a text + * response. If LLM generation fails, the defined + * [responses][google.cloud.dialogflow.cx.v3.Fulfillment.messages] in the + * fulfillment will be respected. This flag is only useful for fulfillments + * associated with no-match event handlers. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Fulfillment::initOnce(); + parent::__construct($data); + } + + /** + * The list of rich message responses to present to the user. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage messages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMessages() + { + return $this->messages; + } + + /** + * The list of rich message responses to present to the user. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage messages = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::class); + $this->messages = $arr; + + return $this; + } + + /** + * The webhook to call. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string webhook = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getWebhook() + { + return $this->webhook; + } + + /** + * The webhook to call. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string webhook = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setWebhook($var) + { + GPBUtil::checkString($var, True); + $this->webhook = $var; + + return $this; + } + + /** + * Whether Dialogflow should return currently queued fulfillment response + * messages in streaming APIs. If a webhook is specified, it happens before + * Dialogflow invokes webhook. + * Warning: + * 1) This flag only affects streaming API. Responses are still queued + * and returned once in non-streaming API. + * 2) The flag can be enabled in any fulfillment but only the first 3 partial + * responses will be returned. You may only want to apply it to fulfillments + * that have slow webhooks. + * + * Generated from protobuf field bool return_partial_responses = 8; + * @return bool + */ + public function getReturnPartialResponses() + { + return $this->return_partial_responses; + } + + /** + * Whether Dialogflow should return currently queued fulfillment response + * messages in streaming APIs. If a webhook is specified, it happens before + * Dialogflow invokes webhook. + * Warning: + * 1) This flag only affects streaming API. Responses are still queued + * and returned once in non-streaming API. + * 2) The flag can be enabled in any fulfillment but only the first 3 partial + * responses will be returned. You may only want to apply it to fulfillments + * that have slow webhooks. + * + * Generated from protobuf field bool return_partial_responses = 8; + * @param bool $var + * @return $this + */ + public function setReturnPartialResponses($var) + { + GPBUtil::checkBool($var); + $this->return_partial_responses = $var; + + return $this; + } + + /** + * The value of this field will be populated in the + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] + * `fulfillmentInfo.tag` field by Dialogflow when the associated webhook is + * called. + * The tag is typically used by the webhook service to identify which + * fulfillment is being called, but it could be used for other purposes. + * This field is required if `webhook` is specified. + * + * Generated from protobuf field string tag = 3; + * @return string + */ + public function getTag() + { + return $this->tag; + } + + /** + * The value of this field will be populated in the + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] + * `fulfillmentInfo.tag` field by Dialogflow when the associated webhook is + * called. + * The tag is typically used by the webhook service to identify which + * fulfillment is being called, but it could be used for other purposes. + * This field is required if `webhook` is specified. + * + * Generated from protobuf field string tag = 3; + * @param string $var + * @return $this + */ + public function setTag($var) + { + GPBUtil::checkString($var, True); + $this->tag = $var; + + return $this; + } + + /** + * Set parameter values before executing the webhook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.SetParameterAction set_parameter_actions = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSetParameterActions() + { + return $this->set_parameter_actions; + } + + /** + * Set parameter values before executing the webhook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.SetParameterAction set_parameter_actions = 4; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Fulfillment\SetParameterAction>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSetParameterActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment\SetParameterAction::class); + $this->set_parameter_actions = $arr; + + return $this; + } + + /** + * Conditional cases for this fulfillment. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases conditional_cases = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConditionalCases() + { + return $this->conditional_cases; + } + + /** + * Conditional cases for this fulfillment. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases conditional_cases = 5; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConditionalCases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases::class); + $this->conditional_cases = $arr; + + return $this; + } + + /** + * Hierarchical advanced settings for this fulfillment. The settings exposed + * at the lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 7; + * @return \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings|null + */ + public function getAdvancedSettings() + { + return $this->advanced_settings; + } + + public function hasAdvancedSettings() + { + return isset($this->advanced_settings); + } + + public function clearAdvancedSettings() + { + unset($this->advanced_settings); + } + + /** + * Hierarchical advanced settings for this fulfillment. The settings exposed + * at the lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 7; + * @param \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $var + * @return $this + */ + public function setAdvancedSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::class); + $this->advanced_settings = $var; + + return $this; + } + + /** + * If the flag is true, the agent will utilize LLM to generate a text + * response. If LLM generation fails, the defined + * [responses][google.cloud.dialogflow.cx.v3.Fulfillment.messages] in the + * fulfillment will be respected. This flag is only useful for fulfillments + * associated with no-match event handlers. + * + * Generated from protobuf field bool enable_generative_fallback = 12; + * @return bool + */ + public function getEnableGenerativeFallback() + { + return $this->enable_generative_fallback; + } + + /** + * If the flag is true, the agent will utilize LLM to generate a text + * response. If LLM generation fails, the defined + * [responses][google.cloud.dialogflow.cx.v3.Fulfillment.messages] in the + * fulfillment will be respected. This flag is only useful for fulfillments + * associated with no-match event handlers. + * + * Generated from protobuf field bool enable_generative_fallback = 12; + * @param bool $var + * @return $this + */ + public function setEnableGenerativeFallback($var) + { + GPBUtil::checkBool($var); + $this->enable_generative_fallback = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Fulfillment/ConditionalCases.php b/DialogflowCx/src/V3/Fulfillment/ConditionalCases.php new file mode 100644 index 000000000000..7d2c448c3b0e --- /dev/null +++ b/DialogflowCx/src/V3/Fulfillment/ConditionalCases.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases + */ +class ConditionalCases extends \Google\Protobuf\Internal\Message +{ + /** + * A list of cascading if-else conditions. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases.Case cases = 1; + */ + private $cases; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases\PBCase>|\Google\Protobuf\Internal\RepeatedField $cases + * A list of cascading if-else conditions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Fulfillment::initOnce(); + parent::__construct($data); + } + + /** + * A list of cascading if-else conditions. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases.Case cases = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCases() + { + return $this->cases; + } + + /** + * A list of cascading if-else conditions. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases.Case cases = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases\PBCase>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases\PBCase::class); + $this->cases = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Fulfillment/ConditionalCases/PBCase.php b/DialogflowCx/src/V3/Fulfillment/ConditionalCases/PBCase.php new file mode 100644 index 000000000000..91ef1b2fb27a --- /dev/null +++ b/DialogflowCx/src/V3/Fulfillment/ConditionalCases/PBCase.php @@ -0,0 +1,123 @@ +google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases.Case + */ +class PBCase extends \Google\Protobuf\Internal\Message +{ + /** + * The condition to activate and select this case. Empty means the + * condition is always true. The condition is evaluated against [form + * parameters][Form.parameters] or [session + * parameters][SessionInfo.parameters]. + * See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string condition = 1; + */ + protected $condition = ''; + /** + * A list of case content. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases.Case.CaseContent case_content = 2; + */ + private $case_content; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $condition + * The condition to activate and select this case. Empty means the + * condition is always true. The condition is evaluated against [form + * parameters][Form.parameters] or [session + * parameters][SessionInfo.parameters]. + * See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases\PBCase\CaseContent>|\Google\Protobuf\Internal\RepeatedField $case_content + * A list of case content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Fulfillment::initOnce(); + parent::__construct($data); + } + + /** + * The condition to activate and select this case. Empty means the + * condition is always true. The condition is evaluated against [form + * parameters][Form.parameters] or [session + * parameters][SessionInfo.parameters]. + * See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string condition = 1; + * @return string + */ + public function getCondition() + { + return $this->condition; + } + + /** + * The condition to activate and select this case. Empty means the + * condition is always true. The condition is evaluated against [form + * parameters][Form.parameters] or [session + * parameters][SessionInfo.parameters]. + * See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string condition = 1; + * @param string $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkString($var, True); + $this->condition = $var; + + return $this; + } + + /** + * A list of case content. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases.Case.CaseContent case_content = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCaseContent() + { + return $this->case_content; + } + + /** + * A list of case content. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases.Case.CaseContent case_content = 2; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases\PBCase\CaseContent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCaseContent($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases\PBCase\CaseContent::class); + $this->case_content = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Fulfillment/ConditionalCases/PBCase/CaseContent.php b/DialogflowCx/src/V3/Fulfillment/ConditionalCases/PBCase/CaseContent.php new file mode 100644 index 000000000000..efd63df43cfc --- /dev/null +++ b/DialogflowCx/src/V3/Fulfillment/ConditionalCases/PBCase/CaseContent.php @@ -0,0 +1,109 @@ +google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases.Case.CaseContent + */ +class CaseContent extends \Google\Protobuf\Internal\Message +{ + protected $cases_or_message; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage $message + * Returned message. + * @type \Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases $additional_cases + * Additional cases to be evaluated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Fulfillment::initOnce(); + parent::__construct($data); + } + + /** + * Returned message. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage message = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage|null + */ + public function getMessage() + { + return $this->readOneof(1); + } + + public function hasMessage() + { + return $this->hasOneof(1); + } + + /** + * Returned message. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage message = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Additional cases to be evaluated. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases additional_cases = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases|null + */ + public function getAdditionalCases() + { + return $this->readOneof(2); + } + + public function hasAdditionalCases() + { + return $this->hasOneof(2); + } + + /** + * Additional cases to be evaluated. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment.ConditionalCases additional_cases = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases $var + * @return $this + */ + public function setAdditionalCases($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment\ConditionalCases::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getCasesOrMessage() + { + return $this->whichOneof("cases_or_message"); + } + +} + + diff --git a/DialogflowCx/src/V3/Fulfillment/SetParameterAction.php b/DialogflowCx/src/V3/Fulfillment/SetParameterAction.php new file mode 100644 index 000000000000..5b7370f85d5a --- /dev/null +++ b/DialogflowCx/src/V3/Fulfillment/SetParameterAction.php @@ -0,0 +1,112 @@ +google.cloud.dialogflow.cx.v3.Fulfillment.SetParameterAction + */ +class SetParameterAction extends \Google\Protobuf\Internal\Message +{ + /** + * Display name of the parameter. + * + * Generated from protobuf field string parameter = 1; + */ + protected $parameter = ''; + /** + * The new value of the parameter. A null value clears the parameter. + * + * Generated from protobuf field .google.protobuf.Value value = 2; + */ + protected $value = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parameter + * Display name of the parameter. + * @type \Google\Protobuf\Value $value + * The new value of the parameter. A null value clears the parameter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Fulfillment::initOnce(); + parent::__construct($data); + } + + /** + * Display name of the parameter. + * + * Generated from protobuf field string parameter = 1; + * @return string + */ + public function getParameter() + { + return $this->parameter; + } + + /** + * Display name of the parameter. + * + * Generated from protobuf field string parameter = 1; + * @param string $var + * @return $this + */ + public function setParameter($var) + { + GPBUtil::checkString($var, True); + $this->parameter = $var; + + return $this; + } + + /** + * The new value of the parameter. A null value clears the parameter. + * + * Generated from protobuf field .google.protobuf.Value value = 2; + * @return \Google\Protobuf\Value|null + */ + public function getValue() + { + return $this->value; + } + + public function hasValue() + { + return isset($this->value); + } + + public function clearValue() + { + unset($this->value); + } + + /** + * The new value of the parameter. A null value clears the parameter. + * + * Generated from protobuf field .google.protobuf.Value value = 2; + * @param \Google\Protobuf\Value $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Value::class); + $this->value = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Gapic/AgentsGapicClient.php b/DialogflowCx/src/V3/Gapic/AgentsGapicClient.php new file mode 100644 index 000000000000..3dccc09d2788 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/AgentsGapicClient.php @@ -0,0 +1,1275 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $agent = new Agent(); + * $response = $agentsClient->createAgent($formattedParent, $agent); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class AgentsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Agents'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $agentGenerativeSettingsNameTemplate; + + private static $agentValidationResultNameTemplate; + + private static $environmentNameTemplate; + + private static $flowNameTemplate; + + private static $locationNameTemplate; + + private static $securitySettingsNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/agents_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/agents_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/agents_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/agents_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getAgentGenerativeSettingsNameTemplate() + { + if (self::$agentGenerativeSettingsNameTemplate == null) { + self::$agentGenerativeSettingsNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/generativeSettings'); + } + + return self::$agentGenerativeSettingsNameTemplate; + } + + private static function getAgentValidationResultNameTemplate() + { + if (self::$agentValidationResultNameTemplate == null) { + self::$agentValidationResultNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/validationResult'); + } + + return self::$agentValidationResultNameTemplate; + } + + private static function getEnvironmentNameTemplate() + { + if (self::$environmentNameTemplate == null) { + self::$environmentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}'); + } + + return self::$environmentNameTemplate; + } + + private static function getFlowNameTemplate() + { + if (self::$flowNameTemplate == null) { + self::$flowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}'); + } + + return self::$flowNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getSecuritySettingsNameTemplate() + { + if (self::$securitySettingsNameTemplate == null) { + self::$securitySettingsNameTemplate = new PathTemplate('projects/{project}/locations/{location}/securitySettings/{security_settings}'); + } + + return self::$securitySettingsNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'agentGenerativeSettings' => self::getAgentGenerativeSettingsNameTemplate(), + 'agentValidationResult' => self::getAgentValidationResultNameTemplate(), + 'environment' => self::getEnvironmentNameTemplate(), + 'flow' => self::getFlowNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'securitySettings' => self::getSecuritySettingsNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * agent_generative_settings resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent_generative_settings resource. + */ + public static function agentGenerativeSettingsName($project, $location, $agent) + { + return self::getAgentGenerativeSettingsNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * agent_validation_result resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent_validation_result resource. + */ + public static function agentValidationResultName($project, $location, $agent) + { + return self::getAgentValidationResultNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a environment + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * + * @return string The formatted environment resource. + */ + public static function environmentName($project, $location, $agent, $environment) + { + return self::getEnvironmentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a flow + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow resource. + */ + public static function flowName($project, $location, $agent, $flow) + { + return self::getFlowNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * security_settings resource. + * + * @param string $project + * @param string $location + * @param string $securitySettings + * + * @return string The formatted security_settings resource. + */ + public static function securitySettingsName($project, $location, $securitySettings) + { + return self::getSecuritySettingsNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'security_settings' => $securitySettings, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - agentGenerativeSettings: projects/{project}/locations/{location}/agents/{agent}/generativeSettings + * - agentValidationResult: projects/{project}/locations/{location}/agents/{agent}/validationResult + * - environment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment} + * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} + * - location: projects/{project}/locations/{location} + * - securitySettings: projects/{project}/locations/{location}/securitySettings/{security_settings} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates an agent in the specified location. + * + * Note: You should always train flows prior to sending them queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedParent = $agentsClient->locationName('[PROJECT]', '[LOCATION]'); + * $agent = new Agent(); + * $response = $agentsClient->createAgent($formattedParent, $agent); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The location to create a agent for. + * Format: `projects//locations/`. + * @param Agent $agent Required. The agent to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Agent + * + * @throws ApiException if the remote call fails + */ + public function createAgent($parent, $agent, array $optionalArgs = []) + { + $request = new CreateAgentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setAgent($agent); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateAgent', Agent::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified agent. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedName = $agentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $agentsClient->deleteAgent($formattedName); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the agent to delete. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteAgent($name, array $optionalArgs = []) + { + $request = new DeleteAgentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteAgent', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Exports the specified agent to a binary file. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: + * [ExportAgentResponse][google.cloud.dialogflow.cx.v3.ExportAgentResponse] + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedName = $agentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $operationResponse = $agentsClient->exportAgent($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $agentsClient->exportAgent($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $agentsClient->resumeOperation($operationName, 'exportAgent'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the agent to export. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $agentUri + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the agent + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized agent is returned inline. + * + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type int $dataFormat + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\ExportAgentRequest\DataFormat} + * @type string $environment + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * @type GitDestination $gitDestination + * Optional. The Git branch to export the agent to. + * @type bool $includeBigqueryExportSettings + * Optional. Whether to include BigQuery Export setting. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function exportAgent($name, array $optionalArgs = []) + { + $request = new ExportAgentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['agentUri'])) { + $request->setAgentUri($optionalArgs['agentUri']); + } + + if (isset($optionalArgs['dataFormat'])) { + $request->setDataFormat($optionalArgs['dataFormat']); + } + + if (isset($optionalArgs['environment'])) { + $request->setEnvironment($optionalArgs['environment']); + } + + if (isset($optionalArgs['gitDestination'])) { + $request->setGitDestination($optionalArgs['gitDestination']); + } + + if (isset($optionalArgs['includeBigqueryExportSettings'])) { + $request->setIncludeBigqueryExportSettings($optionalArgs['includeBigqueryExportSettings']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportAgent', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Retrieves the specified agent. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedName = $agentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $response = $agentsClient->getAgent($formattedName); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the agent. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Agent + * + * @throws ApiException if the remote call fails + */ + public function getAgent($name, array $optionalArgs = []) + { + $request = new GetAgentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAgent', Agent::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the latest agent validation result. Agent validation is performed + * when ValidateAgent is called. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedName = $agentsClient->agentValidationResultName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $response = $agentsClient->getAgentValidationResult($formattedName); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $name Required. The agent name. + * Format: `projects//locations//agents//validationResult`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * If not specified, the agent's default language is used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\AgentValidationResult + * + * @throws ApiException if the remote call fails + */ + public function getAgentValidationResult($name, array $optionalArgs = []) + { + $request = new GetAgentValidationResultRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetAgentValidationResult', AgentValidationResult::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the generative settings for the agent. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedName = $agentsClient->agentGenerativeSettingsName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $languageCode = 'language_code'; + * $response = $agentsClient->getGenerativeSettings($formattedName, $languageCode); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $name Required. Format: `projects//locations//agents//generativeSettings`. + * @param string $languageCode Required. Language code of the generative settings. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings + * + * @throws ApiException if the remote call fails + */ + public function getGenerativeSettings($name, $languageCode, array $optionalArgs = []) + { + $request = new GetGenerativeSettingsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $request->setLanguageCode($languageCode); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetGenerativeSettings', GenerativeSettings::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all agents in the specified location. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedParent = $agentsClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $agentsClient->listAgents($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $agentsClient->listAgents($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The location to list all agents for. + * Format: `projects//locations/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listAgents($parent, array $optionalArgs = []) + { + $request = new ListAgentsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListAgents', $optionalArgs, ListAgentsResponse::class, $request); + } + + /** + * Restores the specified agent from a binary file. + * + * Replaces the current agent with a new one. Note that all existing resources + * in agent (e.g. intents, entity types, flows) will be removed. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train flows prior to sending them queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedName = $agentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $operationResponse = $agentsClient->restoreAgent($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $agentsClient->restoreAgent($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $agentsClient->resumeOperation($operationName, 'restoreAgent'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the agent to restore into. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $agentUri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to restore agent from. The format of this URI must be + * `gs:///`. + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type string $agentContent + * Uncompressed raw byte content for agent. + * @type GitSource $gitSource + * Setting for restoring from a git branch + * @type int $restoreOption + * Agent restore mode. If not specified, `KEEP` is assumed. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\RestoreAgentRequest\RestoreOption} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function restoreAgent($name, array $optionalArgs = []) + { + $request = new RestoreAgentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['agentUri'])) { + $request->setAgentUri($optionalArgs['agentUri']); + } + + if (isset($optionalArgs['agentContent'])) { + $request->setAgentContent($optionalArgs['agentContent']); + } + + if (isset($optionalArgs['gitSource'])) { + $request->setGitSource($optionalArgs['gitSource']); + } + + if (isset($optionalArgs['restoreOption'])) { + $request->setRestoreOption($optionalArgs['restoreOption']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RestoreAgent', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified agent. + * + * Note: You should always train flows prior to sending them queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $agent = new Agent(); + * $response = $agentsClient->updateAgent($agent); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param Agent $agent Required. The agent to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Agent + * + * @throws ApiException if the remote call fails + */ + public function updateAgent($agent, array $optionalArgs = []) + { + $request = new UpdateAgentRequest(); + $requestParamHeaders = []; + $request->setAgent($agent); + $requestParamHeaders['agent.name'] = $agent->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateAgent', Agent::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates the generative settings for the agent. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $generativeSettings = new GenerativeSettings(); + * $response = $agentsClient->updateGenerativeSettings($generativeSettings); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param GenerativeSettings $generativeSettings Required. Generative settings to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * Optional. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings + * + * @throws ApiException if the remote call fails + */ + public function updateGenerativeSettings($generativeSettings, array $optionalArgs = []) + { + $request = new UpdateGenerativeSettingsRequest(); + $requestParamHeaders = []; + $request->setGenerativeSettings($generativeSettings); + $requestParamHeaders['generative_settings.name'] = $generativeSettings->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateGenerativeSettings', GenerativeSettings::class, $optionalArgs, $request)->wait(); + } + + /** + * Validates the specified agent and creates or updates validation results. + * The agent in draft version is validated. Please call this API after the + * training is completed to get the complete validation results. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $formattedName = $agentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $response = $agentsClient->validateAgent($formattedName); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param string $name Required. The agent to validate. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * If not specified, the agent's default language is used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\AgentValidationResult + * + * @throws ApiException if the remote call fails + */ + public function validateAgent($name, array $optionalArgs = []) + { + $request = new ValidateAgentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ValidateAgent', AgentValidationResult::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * $response = $agentsClient->getLocation(); + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $agentsClient = new AgentsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $agentsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $agentsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $agentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/ChangelogsGapicClient.php b/DialogflowCx/src/V3/Gapic/ChangelogsGapicClient.php new file mode 100644 index 000000000000..33a6eefd661d --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/ChangelogsGapicClient.php @@ -0,0 +1,539 @@ +changelogName('[PROJECT]', '[LOCATION]', '[AGENT]', '[CHANGELOG]'); + * $response = $changelogsClient->getChangelog($formattedName); + * } finally { + * $changelogsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class ChangelogsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Changelogs'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $changelogNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/changelogs_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/changelogs_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/changelogs_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/changelogs_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getChangelogNameTemplate() + { + if (self::$changelogNameTemplate == null) { + self::$changelogNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/changelogs/{changelog}'); + } + + return self::$changelogNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'changelog' => self::getChangelogNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a changelog + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $changelog + * + * @return string The formatted changelog resource. + */ + public static function changelogName($project, $location, $agent, $changelog) + { + return self::getChangelogNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'changelog' => $changelog, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - changelog: projects/{project}/locations/{location}/agents/{agent}/changelogs/{changelog} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Retrieves the specified Changelog. + * + * Sample code: + * ``` + * $changelogsClient = new ChangelogsClient(); + * try { + * $formattedName = $changelogsClient->changelogName('[PROJECT]', '[LOCATION]', '[AGENT]', '[CHANGELOG]'); + * $response = $changelogsClient->getChangelog($formattedName); + * } finally { + * $changelogsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the changelog to get. + * Format: `projects//locations//agents//changelogs/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Changelog + * + * @throws ApiException if the remote call fails + */ + public function getChangelog($name, array $optionalArgs = []) + { + $request = new GetChangelogRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetChangelog', Changelog::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of Changelogs. + * + * Sample code: + * ``` + * $changelogsClient = new ChangelogsClient(); + * try { + * $formattedParent = $changelogsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * // Iterate over pages of elements + * $pagedResponse = $changelogsClient->listChangelogs($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $changelogsClient->listChangelogs($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $changelogsClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent containing the changelogs. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $filter + * The filter string. Supports filter by user_email, resource, type and + * create_time. Some examples: + * 1. By user email: + * user_email = "someone@google.com" + * 2. By resource name: + * resource = "projects/123/locations/global/agents/456/flows/789" + * 3. By resource display name: + * display_name = "my agent" + * 4. By action: + * action = "Create" + * 5. By type: + * type = "flows" + * 6. By create time. Currently predicates on `create_time` and + * `create_time_epoch_seconds` are supported: + * create_time_epoch_seconds > 1551790877 AND create_time <= + * 2017-01-15T01:30:15.01Z + * 7. Combination of above filters: + * resource = "projects/123/locations/global/agents/456/flows/789" + * AND user_email = "someone@google.com" + * AND create_time <= 2017-01-15T01:30:15.01Z + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listChangelogs($parent, array $optionalArgs = []) + { + $request = new ListChangelogsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListChangelogs', $optionalArgs, ListChangelogsResponse::class, $request); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $changelogsClient = new ChangelogsClient(); + * try { + * $response = $changelogsClient->getLocation(); + * } finally { + * $changelogsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $changelogsClient = new ChangelogsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $changelogsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $changelogsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $changelogsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/DeploymentsGapicClient.php b/DialogflowCx/src/V3/Gapic/DeploymentsGapicClient.php new file mode 100644 index 000000000000..09e0d009a8c8 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/DeploymentsGapicClient.php @@ -0,0 +1,523 @@ +deploymentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]', '[DEPLOYMENT]'); + * $response = $deploymentsClient->getDeployment($formattedName); + * } finally { + * $deploymentsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class DeploymentsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Deployments'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $deploymentNameTemplate; + + private static $environmentNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/deployments_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/deployments_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/deployments_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/deployments_rest_client_config.php', + ], + ], + ]; + } + + private static function getDeploymentNameTemplate() + { + if (self::$deploymentNameTemplate == null) { + self::$deploymentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/deployments/{deployment}'); + } + + return self::$deploymentNameTemplate; + } + + private static function getEnvironmentNameTemplate() + { + if (self::$environmentNameTemplate == null) { + self::$environmentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}'); + } + + return self::$environmentNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'deployment' => self::getDeploymentNameTemplate(), + 'environment' => self::getEnvironmentNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a deployment + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * @param string $deployment + * + * @return string The formatted deployment resource. + */ + public static function deploymentName($project, $location, $agent, $environment, $deployment) + { + return self::getDeploymentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + 'deployment' => $deployment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a environment + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * + * @return string The formatted environment resource. + */ + public static function environmentName($project, $location, $agent, $environment) + { + return self::getEnvironmentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - deployment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/deployments/{deployment} + * - environment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Retrieves the specified + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. + * + * Sample code: + * ``` + * $deploymentsClient = new DeploymentsClient(); + * try { + * $formattedName = $deploymentsClient->deploymentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]', '[DEPLOYMENT]'); + * $response = $deploymentsClient->getDeployment($formattedName); + * } finally { + * $deploymentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents//environments//deployments/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Deployment + * + * @throws ApiException if the remote call fails + */ + public function getDeployment($name, array $optionalArgs = []) + { + $request = new GetDeploymentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetDeployment', Deployment::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all deployments in the specified + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * Sample code: + * ``` + * $deploymentsClient = new DeploymentsClient(); + * try { + * $formattedParent = $deploymentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * // Iterate over pages of elements + * $pagedResponse = $deploymentsClient->listDeployments($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $deploymentsClient->listDeployments($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $deploymentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listDeployments($parent, array $optionalArgs = []) + { + $request = new ListDeploymentsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListDeployments', $optionalArgs, ListDeploymentsResponse::class, $request); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $deploymentsClient = new DeploymentsClient(); + * try { + * $response = $deploymentsClient->getLocation(); + * } finally { + * $deploymentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $deploymentsClient = new DeploymentsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $deploymentsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $deploymentsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $deploymentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/EntityTypesGapicClient.php b/DialogflowCx/src/V3/Gapic/EntityTypesGapicClient.php new file mode 100644 index 000000000000..13f889613de5 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/EntityTypesGapicClient.php @@ -0,0 +1,742 @@ +agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $entityType = new EntityType(); + * $response = $entityTypesClient->createEntityType($formattedParent, $entityType); + * } finally { + * $entityTypesClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class EntityTypesGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.EntityTypes'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $entityTypeNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/entity_types_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/entity_types_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/entity_types_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/entity_types_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getEntityTypeNameTemplate() + { + if (self::$entityTypeNameTemplate == null) { + self::$entityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}'); + } + + return self::$entityTypeNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'entityType' => self::getEntityTypeNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a entity_type + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $entityType + * + * @return string The formatted entity_type resource. + */ + public static function entityTypeName($project, $location, $agent, $entityType) + { + return self::getEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'entity_type' => $entityType, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - entityType: projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates an entity type in the specified agent. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $entityTypesClient = new EntityTypesClient(); + * try { + * $formattedParent = $entityTypesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $entityType = new EntityType(); + * $response = $entityTypesClient->createEntityType($formattedParent, $entityType); + * } finally { + * $entityTypesClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to create a entity type for. + * Format: `projects//locations//agents/`. + * @param EntityType $entityType Required. The entity type to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language of the following fields in `entity_type`: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\EntityType + * + * @throws ApiException if the remote call fails + */ + public function createEntityType($parent, $entityType, array $optionalArgs = []) + { + $request = new CreateEntityTypeRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setEntityType($entityType); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateEntityType', EntityType::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified entity type. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $entityTypesClient = new EntityTypesClient(); + * try { + * $formattedName = $entityTypesClient->entityTypeName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENTITY_TYPE]'); + * $entityTypesClient->deleteEntityType($formattedName); + * } finally { + * $entityTypesClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the entity type to delete. + * Format: `projects//locations//agents//entityTypes/`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $force + * This field has no effect for entity type not being used. + * For entity types that are used by intents or pages: + * + * * If `force` is set to false, an error will be returned with message + * indicating the referencing resources. + * * If `force` is set to true, Dialogflow will remove the entity type, as + * well as any references to the entity type (i.e. Page + * [parameter][google.cloud.dialogflow.cx.v3.Form.Parameter] of the entity + * type will be changed to + * '@sys.any' and intent + * [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] of the + * entity type will be removed). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteEntityType($name, array $optionalArgs = []) + { + $request = new DeleteEntityTypeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteEntityType', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the specified entity type. + * + * Sample code: + * ``` + * $entityTypesClient = new EntityTypesClient(); + * try { + * $formattedName = $entityTypesClient->entityTypeName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENTITY_TYPE]'); + * $response = $entityTypesClient->getEntityType($formattedName); + * } finally { + * $entityTypesClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the entity type. + * Format: `projects//locations//agents//entityTypes/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to retrieve the entity type for. The following fields are + * language dependent: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\EntityType + * + * @throws ApiException if the remote call fails + */ + public function getEntityType($name, array $optionalArgs = []) + { + $request = new GetEntityTypeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetEntityType', EntityType::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all entity types in the specified agent. + * + * Sample code: + * ``` + * $entityTypesClient = new EntityTypesClient(); + * try { + * $formattedParent = $entityTypesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * // Iterate over pages of elements + * $pagedResponse = $entityTypesClient->listEntityTypes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $entityTypesClient->listEntityTypes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $entityTypesClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to list all entity types for. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to list entity types for. The following fields are language + * dependent: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listEntityTypes($parent, array $optionalArgs = []) + { + $request = new ListEntityTypesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListEntityTypes', $optionalArgs, ListEntityTypesResponse::class, $request); + } + + /** + * Updates the specified entity type. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $entityTypesClient = new EntityTypesClient(); + * try { + * $entityType = new EntityType(); + * $response = $entityTypesClient->updateEntityType($entityType); + * } finally { + * $entityTypesClient->close(); + * } + * ``` + * + * @param EntityType $entityType Required. The entity type to update. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language of the following fields in `entity_type`: + * + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type FieldMask $updateMask + * The mask to control which fields get updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\EntityType + * + * @throws ApiException if the remote call fails + */ + public function updateEntityType($entityType, array $optionalArgs = []) + { + $request = new UpdateEntityTypeRequest(); + $requestParamHeaders = []; + $request->setEntityType($entityType); + $requestParamHeaders['entity_type.name'] = $entityType->getName(); + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateEntityType', EntityType::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $entityTypesClient = new EntityTypesClient(); + * try { + * $response = $entityTypesClient->getLocation(); + * } finally { + * $entityTypesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $entityTypesClient = new EntityTypesClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $entityTypesClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $entityTypesClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $entityTypesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/EnvironmentsGapicClient.php b/DialogflowCx/src/V3/Gapic/EnvironmentsGapicClient.php new file mode 100644 index 000000000000..7473620ed167 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/EnvironmentsGapicClient.php @@ -0,0 +1,1226 @@ +agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $environment = new Environment(); + * $operationResponse = $environmentsClient->createEnvironment($formattedParent, $environment); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $environmentsClient->createEnvironment($formattedParent, $environment); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $environmentsClient->resumeOperation($operationName, 'createEnvironment'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class EnvironmentsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Environments'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $environmentNameTemplate; + + private static $serviceNameTemplate; + + private static $testCaseNameTemplate; + + private static $versionNameTemplate; + + private static $webhookNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/environments_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/environments_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/environments_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/environments_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getEnvironmentNameTemplate() + { + if (self::$environmentNameTemplate == null) { + self::$environmentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}'); + } + + return self::$environmentNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getTestCaseNameTemplate() + { + if (self::$testCaseNameTemplate == null) { + self::$testCaseNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}'); + } + + return self::$testCaseNameTemplate; + } + + private static function getVersionNameTemplate() + { + if (self::$versionNameTemplate == null) { + self::$versionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}'); + } + + return self::$versionNameTemplate; + } + + private static function getWebhookNameTemplate() + { + if (self::$webhookNameTemplate == null) { + self::$webhookNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}'); + } + + return self::$webhookNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'environment' => self::getEnvironmentNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'testCase' => self::getTestCaseNameTemplate(), + 'version' => self::getVersionNameTemplate(), + 'webhook' => self::getWebhookNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a environment + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * + * @return string The formatted environment resource. + */ + public static function environmentName($project, $location, $agent, $environment) + { + return self::getEnvironmentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $namespace + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName($project, $location, $namespace, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'namespace' => $namespace, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a test_case + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $testCase + * + * @return string The formatted test_case resource. + */ + public static function testCaseName($project, $location, $agent, $testCase) + { + return self::getTestCaseNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'test_case' => $testCase, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a version + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $version + * + * @return string The formatted version resource. + */ + public static function versionName($project, $location, $agent, $flow, $version) + { + return self::getVersionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'version' => $version, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a webhook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $webhook + * + * @return string The formatted webhook resource. + */ + public static function webhookName($project, $location, $agent, $webhook) + { + return self::getWebhookNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'webhook' => $webhook, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - environment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment} + * - service: projects/{project}/locations/{location}/namespaces/{namespace}/services/{service} + * - testCase: projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case} + * - version: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version} + * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates an [Environment][google.cloud.dialogflow.cx.v3.Environment] in the + * specified [Agent][google.cloud.dialogflow.cx.v3.Agent]. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: [Environment][google.cloud.dialogflow.cx.v3.Environment] + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $formattedParent = $environmentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $environment = new Environment(); + * $operationResponse = $environmentsClient->createEnvironment($formattedParent, $environment); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $environmentsClient->createEnvironment($formattedParent, $environment); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $environmentsClient->resumeOperation($operationName, 'createEnvironment'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents/`. + * @param Environment $environment Required. The environment to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createEnvironment($parent, $environment, array $optionalArgs = []) + { + $request = new CreateEnvironmentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setEnvironment($environment); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateEnvironment', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $formattedName = $environmentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * $environmentsClient->deleteEnvironment($formattedName); + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteEnvironment($name, array $optionalArgs = []) + { + $request = new DeleteEnvironmentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteEnvironment', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Deploys a flow to the specified + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [DeployFlowMetadata][google.cloud.dialogflow.cx.v3.DeployFlowMetadata] + * - `response`: + * [DeployFlowResponse][google.cloud.dialogflow.cx.v3.DeployFlowResponse] + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $formattedEnvironment = $environmentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * $formattedFlowVersion = $environmentsClient->versionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[VERSION]'); + * $operationResponse = $environmentsClient->deployFlow($formattedEnvironment, $formattedFlowVersion); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $environmentsClient->deployFlow($formattedEnvironment, $formattedFlowVersion); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $environmentsClient->resumeOperation($operationName, 'deployFlow'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param string $environment Required. The environment to deploy the flow to. + * Format: `projects//locations//agents// + * environments/`. + * @param string $flowVersion Required. The flow version to deploy. + * Format: `projects//locations//agents// + * flows//versions/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function deployFlow($environment, $flowVersion, array $optionalArgs = []) + { + $request = new DeployFlowRequest(); + $requestParamHeaders = []; + $request->setEnvironment($environment); + $request->setFlowVersion($flowVersion); + $requestParamHeaders['environment'] = $environment; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('DeployFlow', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Retrieves the specified + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $formattedName = $environmentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * $response = $environmentsClient->getEnvironment($formattedName); + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Environment + * + * @throws ApiException if the remote call fails + */ + public function getEnvironment($name, array $optionalArgs = []) + { + $request = new GetEnvironmentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetEnvironment', Environment::class, $optionalArgs, $request)->wait(); + } + + /** + * Fetches a list of continuous test results for a given environment. + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $formattedParent = $environmentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * // Iterate over pages of elements + * $pagedResponse = $environmentsClient->listContinuousTestResults($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $environmentsClient->listContinuousTestResults($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The environment to list results for. + * Format: `projects//locations//agents// + * environments/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listContinuousTestResults($parent, array $optionalArgs = []) + { + $request = new ListContinuousTestResultsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListContinuousTestResults', $optionalArgs, ListContinuousTestResultsResponse::class, $request); + } + + /** + * Returns the list of all environments in the specified + * [Agent][google.cloud.dialogflow.cx.v3.Agent]. + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $formattedParent = $environmentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * // Iterate over pages of elements + * $pagedResponse = $environmentsClient->listEnvironments($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $environmentsClient->listEnvironments($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all + * environments for. Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listEnvironments($parent, array $optionalArgs = []) + { + $request = new ListEnvironmentsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListEnvironments', $optionalArgs, ListEnvironmentsResponse::class, $request); + } + + /** + * Looks up the history of the specified + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $formattedName = $environmentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * // Iterate over pages of elements + * $pagedResponse = $environmentsClient->lookupEnvironmentHistory($formattedName); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $environmentsClient->lookupEnvironmentHistory($formattedName); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the environment to look up the history for. + * Format: `projects//locations//agents//environments/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function lookupEnvironmentHistory($name, array $optionalArgs = []) + { + $request = new LookupEnvironmentHistoryRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('LookupEnvironmentHistory', $optionalArgs, LookupEnvironmentHistoryResponse::class, $request); + } + + /** + * Kicks off a continuous test under the specified + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [RunContinuousTestMetadata][google.cloud.dialogflow.cx.v3.RunContinuousTestMetadata] + * - `response`: + * [RunContinuousTestResponse][google.cloud.dialogflow.cx.v3.RunContinuousTestResponse] + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $formattedEnvironment = $environmentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * $operationResponse = $environmentsClient->runContinuousTest($formattedEnvironment); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $environmentsClient->runContinuousTest($formattedEnvironment); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $environmentsClient->resumeOperation($operationName, 'runContinuousTest'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param string $environment Required. Format: `projects//locations//agents//environments/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function runContinuousTest($environment, array $optionalArgs = []) + { + $request = new RunContinuousTestRequest(); + $requestParamHeaders = []; + $request->setEnvironment($environment); + $requestParamHeaders['environment'] = $environment; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RunContinuousTest', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: [Environment][google.cloud.dialogflow.cx.v3.Environment] + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $environment = new Environment(); + * $updateMask = new FieldMask(); + * $operationResponse = $environmentsClient->updateEnvironment($environment, $updateMask); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $environmentsClient->updateEnvironment($environment, $updateMask); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $environmentsClient->resumeOperation($operationName, 'updateEnvironment'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param Environment $environment Required. The environment to update. + * @param FieldMask $updateMask Required. The mask to control which fields get updated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function updateEnvironment($environment, $updateMask, array $optionalArgs = []) + { + $request = new UpdateEnvironmentRequest(); + $requestParamHeaders = []; + $request->setEnvironment($environment); + $request->setUpdateMask($updateMask); + $requestParamHeaders['environment.name'] = $environment->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('UpdateEnvironment', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * $response = $environmentsClient->getLocation(); + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $environmentsClient = new EnvironmentsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $environmentsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $environmentsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $environmentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/ExperimentsGapicClient.php b/DialogflowCx/src/V3/Gapic/ExperimentsGapicClient.php new file mode 100644 index 000000000000..583f2630789c --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/ExperimentsGapicClient.php @@ -0,0 +1,782 @@ +environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * $experiment = new Experiment(); + * $response = $experimentsClient->createExperiment($formattedParent, $experiment); + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class ExperimentsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Experiments'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $environmentNameTemplate; + + private static $experimentNameTemplate; + + private static $versionNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/experiments_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/experiments_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/experiments_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/experiments_rest_client_config.php', + ], + ], + ]; + } + + private static function getEnvironmentNameTemplate() + { + if (self::$environmentNameTemplate == null) { + self::$environmentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}'); + } + + return self::$environmentNameTemplate; + } + + private static function getExperimentNameTemplate() + { + if (self::$experimentNameTemplate == null) { + self::$experimentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/experiments/{experiment}'); + } + + return self::$experimentNameTemplate; + } + + private static function getVersionNameTemplate() + { + if (self::$versionNameTemplate == null) { + self::$versionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}'); + } + + return self::$versionNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'environment' => self::getEnvironmentNameTemplate(), + 'experiment' => self::getExperimentNameTemplate(), + 'version' => self::getVersionNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a environment + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * + * @return string The formatted environment resource. + */ + public static function environmentName($project, $location, $agent, $environment) + { + return self::getEnvironmentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a experiment + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * @param string $experiment + * + * @return string The formatted experiment resource. + */ + public static function experimentName($project, $location, $agent, $environment, $experiment) + { + return self::getExperimentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + 'experiment' => $experiment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a version + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $version + * + * @return string The formatted version resource. + */ + public static function versionName($project, $location, $agent, $flow, $version) + { + return self::getVersionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'version' => $version, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - environment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment} + * - experiment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/experiments/{experiment} + * - version: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates an [Experiment][google.cloud.dialogflow.cx.v3.Experiment] in the + * specified [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * $formattedParent = $experimentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * $experiment = new Experiment(); + * $response = $experimentsClient->createExperiment($formattedParent, $experiment); + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to create an + * [Environment][google.cloud.dialogflow.cx.v3.Environment] for. Format: + * `projects//locations//agents//environments/`. + * @param Experiment $experiment Required. The experiment to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment + * + * @throws ApiException if the remote call fails + */ + public function createExperiment($parent, $experiment, array $optionalArgs = []) + { + $request = new CreateExperimentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setExperiment($experiment); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateExperiment', Experiment::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified + * [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * $formattedName = $experimentsClient->experimentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]', '[EXPERIMENT]'); + * $experimentsClient->deleteExperiment($formattedName); + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment] to delete. Format: + * `projects//locations//agents//environments//experiments/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteExperiment($name, array $optionalArgs = []) + { + $request = new DeleteExperimentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteExperiment', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the specified + * [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * $formattedName = $experimentsClient->experimentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]', '[EXPERIMENT]'); + * $response = $experimentsClient->getExperiment($formattedName); + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments//experiments/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment + * + * @throws ApiException if the remote call fails + */ + public function getExperiment($name, array $optionalArgs = []) + { + $request = new GetExperimentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetExperiment', Experiment::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all experiments in the specified + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * $formattedParent = $experimentsClient->environmentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]'); + * // Iterate over pages of elements + * $pagedResponse = $experimentsClient->listExperiments($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $experimentsClient->listExperiments($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listExperiments($parent, array $optionalArgs = []) + { + $request = new ListExperimentsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListExperiments', $optionalArgs, ListExperimentsResponse::class, $request); + } + + /** + * Starts the specified + * [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. This rpc only + * changes the state of experiment from PENDING to RUNNING. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * $formattedName = $experimentsClient->experimentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]', '[EXPERIMENT]'); + * $response = $experimentsClient->startExperiment($formattedName); + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the experiment to start. + * Format: `projects//locations//agents//environments//experiments/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment + * + * @throws ApiException if the remote call fails + */ + public function startExperiment($name, array $optionalArgs = []) + { + $request = new StartExperimentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('StartExperiment', Experiment::class, $optionalArgs, $request)->wait(); + } + + /** + * Stops the specified [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. + * This rpc only changes the state of experiment from RUNNING to DONE. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * $formattedName = $experimentsClient->experimentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[ENVIRONMENT]', '[EXPERIMENT]'); + * $response = $experimentsClient->stopExperiment($formattedName); + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the experiment to stop. + * Format: `projects//locations//agents//environments//experiments/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment + * + * @throws ApiException if the remote call fails + */ + public function stopExperiment($name, array $optionalArgs = []) + { + $request = new StopExperimentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('StopExperiment', Experiment::class, $optionalArgs, $request)->wait(); + } + + /** + * Updates the specified + * [Experiment][google.cloud.dialogflow.cx.v3.Experiment]. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * $experiment = new Experiment(); + * $updateMask = new FieldMask(); + * $response = $experimentsClient->updateExperiment($experiment, $updateMask); + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param Experiment $experiment Required. The experiment to update. + * @param FieldMask $updateMask Required. The mask to control which fields get updated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Experiment + * + * @throws ApiException if the remote call fails + */ + public function updateExperiment($experiment, $updateMask, array $optionalArgs = []) + { + $request = new UpdateExperimentRequest(); + $requestParamHeaders = []; + $request->setExperiment($experiment); + $request->setUpdateMask($updateMask); + $requestParamHeaders['experiment.name'] = $experiment->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateExperiment', Experiment::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * $response = $experimentsClient->getLocation(); + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $experimentsClient = new ExperimentsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $experimentsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $experimentsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $experimentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/FlowsGapicClient.php b/DialogflowCx/src/V3/Gapic/FlowsGapicClient.php new file mode 100644 index 000000000000..20a150a8cd99 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/FlowsGapicClient.php @@ -0,0 +1,1416 @@ +agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $flow = new Flow(); + * $response = $flowsClient->createFlow($formattedParent, $flow); + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class FlowsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Flows'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $flowNameTemplate; + + private static $flowValidationResultNameTemplate; + + private static $intentNameTemplate; + + private static $pageNameTemplate; + + private static $projectLocationAgentFlowTransitionRouteGroupNameTemplate; + + private static $projectLocationAgentTransitionRouteGroupNameTemplate; + + private static $transitionRouteGroupNameTemplate; + + private static $webhookNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/flows_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/flows_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/flows_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/flows_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getFlowNameTemplate() + { + if (self::$flowNameTemplate == null) { + self::$flowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}'); + } + + return self::$flowNameTemplate; + } + + private static function getFlowValidationResultNameTemplate() + { + if (self::$flowValidationResultNameTemplate == null) { + self::$flowValidationResultNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult'); + } + + return self::$flowValidationResultNameTemplate; + } + + private static function getIntentNameTemplate() + { + if (self::$intentNameTemplate == null) { + self::$intentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/intents/{intent}'); + } + + return self::$intentNameTemplate; + } + + private static function getPageNameTemplate() + { + if (self::$pageNameTemplate == null) { + self::$pageNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}'); + } + + return self::$pageNameTemplate; + } + + private static function getProjectLocationAgentFlowTransitionRouteGroupNameTemplate() + { + if (self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate == null) { + self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate; + } + + private static function getProjectLocationAgentTransitionRouteGroupNameTemplate() + { + if (self::$projectLocationAgentTransitionRouteGroupNameTemplate == null) { + self::$projectLocationAgentTransitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$projectLocationAgentTransitionRouteGroupNameTemplate; + } + + private static function getTransitionRouteGroupNameTemplate() + { + if (self::$transitionRouteGroupNameTemplate == null) { + self::$transitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$transitionRouteGroupNameTemplate; + } + + private static function getWebhookNameTemplate() + { + if (self::$webhookNameTemplate == null) { + self::$webhookNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}'); + } + + return self::$webhookNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'flow' => self::getFlowNameTemplate(), + 'flowValidationResult' => self::getFlowValidationResultNameTemplate(), + 'intent' => self::getIntentNameTemplate(), + 'page' => self::getPageNameTemplate(), + 'projectLocationAgentFlowTransitionRouteGroup' => self::getProjectLocationAgentFlowTransitionRouteGroupNameTemplate(), + 'projectLocationAgentTransitionRouteGroup' => self::getProjectLocationAgentTransitionRouteGroupNameTemplate(), + 'transitionRouteGroup' => self::getTransitionRouteGroupNameTemplate(), + 'webhook' => self::getWebhookNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a flow + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow resource. + */ + public static function flowName($project, $location, $agent, $flow) + { + return self::getFlowNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * flow_validation_result resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow_validation_result resource. + */ + public static function flowValidationResultName($project, $location, $agent, $flow) + { + return self::getFlowValidationResultNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a intent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $intent + * + * @return string The formatted intent resource. + */ + public static function intentName($project, $location, $agent, $intent) + { + return self::getIntentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'intent' => $intent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a page + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $page + * + * @return string The formatted page resource. + */ + public static function pageName($project, $location, $agent, $flow, $page) + { + return self::getPageNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'page' => $page, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_flow_transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $transitionRouteGroup + * + * @return string The formatted project_location_agent_flow_transition_route_group resource. + */ + public static function projectLocationAgentFlowTransitionRouteGroupName($project, $location, $agent, $flow, $transitionRouteGroup) + { + return self::getProjectLocationAgentFlowTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $transitionRouteGroup + * + * @return string The formatted project_location_agent_transition_route_group resource. + */ + public static function projectLocationAgentTransitionRouteGroupName($project, $location, $agent, $transitionRouteGroup) + { + return self::getProjectLocationAgentTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $transitionRouteGroup + * + * @return string The formatted transition_route_group resource. + */ + public static function transitionRouteGroupName($project, $location, $agent, $flow, $transitionRouteGroup) + { + return self::getTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a webhook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $webhook + * + * @return string The formatted webhook resource. + */ + public static function webhookName($project, $location, $agent, $webhook) + { + return self::getWebhookNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'webhook' => $webhook, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} + * - flowValidationResult: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/validationResult + * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} + * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} + * - projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group} + * - transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} + * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates a flow in the specified agent. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedParent = $flowsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $flow = new Flow(); + * $response = $flowsClient->createFlow($formattedParent, $flow); + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to create a flow for. + * Format: `projects//locations//agents/`. + * @param Flow $flow Required. The flow to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language of the following fields in `flow`: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Flow + * + * @throws ApiException if the remote call fails + */ + public function createFlow($parent, $flow, array $optionalArgs = []) + { + $request = new CreateFlowRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setFlow($flow); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateFlow', Flow::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes a specified flow. + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedName = $flowsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $flowsClient->deleteFlow($formattedName); + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the flow to delete. + * Format: `projects//locations//agents//flows/`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $force + * This field has no effect for flows with no incoming transitions. + * For flows with incoming transitions: + * + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the flow, as well as + * any transitions to the flow (i.e. [Target + * flow][EventHandler.target_flow] in event handlers or [Target + * flow][TransitionRoute.target_flow] in transition routes that point to + * this flow will be cleared). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteFlow($name, array $optionalArgs = []) + { + $request = new DeleteFlowRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteFlow', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Exports the specified flow to a binary file. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: + * [ExportFlowResponse][google.cloud.dialogflow.cx.v3.ExportFlowResponse] + * + * Note that resources (e.g. intents, entities, webhooks) that the flow + * references will also be exported. + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedName = $flowsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $operationResponse = $flowsClient->exportFlow($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $flowsClient->exportFlow($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $flowsClient->resumeOperation($operationName, 'exportFlow'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the flow to export. + * Format: `projects//locations//agents//flows/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $flowUri + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the flow to. + * The format of this URI must be `gs:///`. If left + * unspecified, the serialized flow is returned inline. + * + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type bool $includeReferencedFlows + * Optional. Whether to export flows referenced by the specified flow. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function exportFlow($name, array $optionalArgs = []) + { + $request = new ExportFlowRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['flowUri'])) { + $request->setFlowUri($optionalArgs['flowUri']); + } + + if (isset($optionalArgs['includeReferencedFlows'])) { + $request->setIncludeReferencedFlows($optionalArgs['includeReferencedFlows']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportFlow', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Retrieves the specified flow. + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedName = $flowsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $response = $flowsClient->getFlow($formattedName); + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the flow to get. + * Format: `projects//locations//agents//flows/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to retrieve the flow for. The following fields are language + * dependent: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Flow + * + * @throws ApiException if the remote call fails + */ + public function getFlow($name, array $optionalArgs = []) + { + $request = new GetFlowRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFlow', Flow::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets the latest flow validation result. Flow validation is performed + * when ValidateFlow is called. + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedName = $flowsClient->flowValidationResultName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $response = $flowsClient->getFlowValidationResult($formattedName); + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $name Required. The flow name. + * Format: `projects//locations//agents//flows//validationResult`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * If not specified, the agent's default language is used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\FlowValidationResult + * + * @throws ApiException if the remote call fails + */ + public function getFlowValidationResult($name, array $optionalArgs = []) + { + $request = new GetFlowValidationResultRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetFlowValidationResult', FlowValidationResult::class, $optionalArgs, $request)->wait(); + } + + /** + * Imports the specified flow to the specified agent from a binary file. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: + * [ImportFlowResponse][google.cloud.dialogflow.cx.v3.ImportFlowResponse] + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedParent = $flowsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $operationResponse = $flowsClient->importFlow($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $flowsClient->importFlow($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $flowsClient->resumeOperation($operationName, 'importFlow'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to import the flow into. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $flowUri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import flow from. The format of this URI must be + * `gs:///`. + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type string $flowContent + * Uncompressed raw byte content for flow. + * @type int $importOption + * Flow import mode. If not specified, `KEEP` is assumed. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\ImportFlowRequest\ImportOption} + * @type FlowImportStrategy $flowImportStrategy + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function importFlow($parent, array $optionalArgs = []) + { + $request = new ImportFlowRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['flowUri'])) { + $request->setFlowUri($optionalArgs['flowUri']); + } + + if (isset($optionalArgs['flowContent'])) { + $request->setFlowContent($optionalArgs['flowContent']); + } + + if (isset($optionalArgs['importOption'])) { + $request->setImportOption($optionalArgs['importOption']); + } + + if (isset($optionalArgs['flowImportStrategy'])) { + $request->setFlowImportStrategy($optionalArgs['flowImportStrategy']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ImportFlow', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Returns the list of all flows in the specified agent. + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedParent = $flowsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * // Iterate over pages of elements + * $pagedResponse = $flowsClient->listFlows($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $flowsClient->listFlows($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent containing the flows. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $languageCode + * The language to list flows for. The following fields are language + * dependent: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listFlows($parent, array $optionalArgs = []) + { + $request = new ListFlowsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListFlows', $optionalArgs, ListFlowsResponse::class, $request); + } + + /** + * Trains the specified flow. Note that only the flow in 'draft' environment + * is trained. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedName = $flowsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $operationResponse = $flowsClient->trainFlow($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $flowsClient->trainFlow($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $flowsClient->resumeOperation($operationName, 'trainFlow'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $name Required. The flow to train. + * Format: `projects//locations//agents//flows/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function trainFlow($name, array $optionalArgs = []) + { + $request = new TrainFlowRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('TrainFlow', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified flow. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $flow = new Flow(); + * $response = $flowsClient->updateFlow($flow); + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param Flow $flow Required. The flow to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @type string $languageCode + * The language of the following fields in `flow`: + * + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Flow + * + * @throws ApiException if the remote call fails + */ + public function updateFlow($flow, array $optionalArgs = []) + { + $request = new UpdateFlowRequest(); + $requestParamHeaders = []; + $request->setFlow($flow); + $requestParamHeaders['flow.name'] = $flow->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateFlow', Flow::class, $optionalArgs, $request)->wait(); + } + + /** + * Validates the specified flow and creates or updates validation results. + * Please call this API after the training is completed to get the complete + * validation results. + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $formattedName = $flowsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $response = $flowsClient->validateFlow($formattedName); + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param string $name Required. The flow to validate. + * Format: `projects//locations//agents//flows/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * If not specified, the agent's default language is used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\FlowValidationResult + * + * @throws ApiException if the remote call fails + */ + public function validateFlow($name, array $optionalArgs = []) + { + $request = new ValidateFlowRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('ValidateFlow', FlowValidationResult::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * $response = $flowsClient->getLocation(); + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $flowsClient = new FlowsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $flowsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $flowsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $flowsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/IntentsGapicClient.php b/DialogflowCx/src/V3/Gapic/IntentsGapicClient.php new file mode 100644 index 000000000000..82a8f8af0e62 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/IntentsGapicClient.php @@ -0,0 +1,1011 @@ +agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $intent = new Intent(); + * $response = $intentsClient->createIntent($formattedParent, $intent); + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class IntentsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Intents'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $entityTypeNameTemplate; + + private static $intentNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/intents_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/intents_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/intents_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/intents_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getEntityTypeNameTemplate() + { + if (self::$entityTypeNameTemplate == null) { + self::$entityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}'); + } + + return self::$entityTypeNameTemplate; + } + + private static function getIntentNameTemplate() + { + if (self::$intentNameTemplate == null) { + self::$intentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/intents/{intent}'); + } + + return self::$intentNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'entityType' => self::getEntityTypeNameTemplate(), + 'intent' => self::getIntentNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a entity_type + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $entityType + * + * @return string The formatted entity_type resource. + */ + public static function entityTypeName($project, $location, $agent, $entityType) + { + return self::getEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a intent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $intent + * + * @return string The formatted intent resource. + */ + public static function intentName($project, $location, $agent, $intent) + { + return self::getIntentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'intent' => $intent, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - entityType: projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type} + * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Creates an intent in the specified agent. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * $formattedParent = $intentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $intent = new Intent(); + * $response = $intentsClient->createIntent($formattedParent, $intent); + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to create an intent for. + * Format: `projects//locations//agents/`. + * @param Intent $intent Required. The intent to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language of the following fields in `intent`: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Intent + * + * @throws ApiException if the remote call fails + */ + public function createIntent($parent, $intent, array $optionalArgs = []) + { + $request = new CreateIntentRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setIntent($intent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateIntent', Intent::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified intent. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * $formattedName = $intentsClient->intentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[INTENT]'); + * $intentsClient->deleteIntent($formattedName); + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the intent to delete. + * Format: `projects//locations//agents//intents/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteIntent($name, array $optionalArgs = []) + { + $request = new DeleteIntentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteIntent', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Exports the selected intents. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3.ExportIntentsMetadata] + * - `response`: + * [ExportIntentsResponse][google.cloud.dialogflow.cx.v3.ExportIntentsResponse] + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * $formattedParent = $intentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $intents = []; + * $operationResponse = $intentsClient->exportIntents($formattedParent, $intents); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $intentsClient->exportIntents($formattedParent, $intents); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $intentsClient->resumeOperation($operationName, 'exportIntents'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The name of the parent agent to export intents. + * Format: `projects//locations//agents/`. + * @param string[] $intents Required. The name of the intents to export. + * Format: `projects//locations//agents//intents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $intentsUri + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the + * intents to. The format of this URI must be + * `gs:///`. + * + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type bool $intentsContentInline + * Optional. The option to return the serialized intents inline. + * @type int $dataFormat + * Optional. The data format of the exported intents. If not specified, `BLOB` + * is assumed. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\ExportIntentsRequest\DataFormat} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function exportIntents($parent, $intents, array $optionalArgs = []) + { + $request = new ExportIntentsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setIntents($intents); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['intentsUri'])) { + $request->setIntentsUri($optionalArgs['intentsUri']); + } + + if (isset($optionalArgs['intentsContentInline'])) { + $request->setIntentsContentInline($optionalArgs['intentsContentInline']); + } + + if (isset($optionalArgs['dataFormat'])) { + $request->setDataFormat($optionalArgs['dataFormat']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportIntents', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Retrieves the specified intent. + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * $formattedName = $intentsClient->intentName('[PROJECT]', '[LOCATION]', '[AGENT]', '[INTENT]'); + * $response = $intentsClient->getIntent($formattedName); + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the intent. + * Format: `projects//locations//agents//intents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to retrieve the intent for. The following fields are language + * dependent: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Intent + * + * @throws ApiException if the remote call fails + */ + public function getIntent($name, array $optionalArgs = []) + { + $request = new GetIntentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetIntent', Intent::class, $optionalArgs, $request)->wait(); + } + + /** + * Imports the specified intents into the agent. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3.ImportIntentsMetadata] + * - `response`: + * [ImportIntentsResponse][google.cloud.dialogflow.cx.v3.ImportIntentsResponse] + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * $formattedParent = $intentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $operationResponse = $intentsClient->importIntents($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $intentsClient->importIntents($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $intentsClient->resumeOperation($operationName, 'importIntents'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to import the intents into. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $intentsUri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import intents from. The format of this URI must be + * `gs:///`. + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type InlineSource $intentsContent + * Uncompressed byte content of intents. + * @type int $mergeOption + * Merge option for importing intents. If not specified, `REJECT` is assumed. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\ImportIntentsRequest\MergeOption} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function importIntents($parent, array $optionalArgs = []) + { + $request = new ImportIntentsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['intentsUri'])) { + $request->setIntentsUri($optionalArgs['intentsUri']); + } + + if (isset($optionalArgs['intentsContent'])) { + $request->setIntentsContent($optionalArgs['intentsContent']); + } + + if (isset($optionalArgs['mergeOption'])) { + $request->setMergeOption($optionalArgs['mergeOption']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ImportIntents', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Returns the list of all intents in the specified agent. + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * $formattedParent = $intentsClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * // Iterate over pages of elements + * $pagedResponse = $intentsClient->listIntents($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $intentsClient->listIntents($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to list all intents for. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to list intents for. The following fields are language + * dependent: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type int $intentView + * The resource view to apply to the returned intent. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\IntentView} + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listIntents($parent, array $optionalArgs = []) + { + $request = new ListIntentsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + if (isset($optionalArgs['intentView'])) { + $request->setIntentView($optionalArgs['intentView']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListIntents', $optionalArgs, ListIntentsResponse::class, $request); + } + + /** + * Updates the specified intent. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * $intent = new Intent(); + * $response = $intentsClient->updateIntent($intent); + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param Intent $intent Required. The intent to update. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language of the following fields in `intent`: + * + * * `Intent.training_phrases.parts.text` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type FieldMask $updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Intent + * + * @throws ApiException if the remote call fails + */ + public function updateIntent($intent, array $optionalArgs = []) + { + $request = new UpdateIntentRequest(); + $requestParamHeaders = []; + $request->setIntent($intent); + $requestParamHeaders['intent.name'] = $intent->getName(); + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateIntent', Intent::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * $response = $intentsClient->getLocation(); + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $intentsClient = new IntentsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $intentsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $intentsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $intentsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/PagesGapicClient.php b/DialogflowCx/src/V3/Gapic/PagesGapicClient.php new file mode 100644 index 000000000000..cc315c5dd6a5 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/PagesGapicClient.php @@ -0,0 +1,991 @@ +flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $page = new Page(); + * $response = $pagesClient->createPage($formattedParent, $page); + * } finally { + * $pagesClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class PagesGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Pages'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $entityTypeNameTemplate; + + private static $flowNameTemplate; + + private static $intentNameTemplate; + + private static $pageNameTemplate; + + private static $projectLocationAgentFlowTransitionRouteGroupNameTemplate; + + private static $projectLocationAgentTransitionRouteGroupNameTemplate; + + private static $transitionRouteGroupNameTemplate; + + private static $webhookNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/pages_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/pages_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/pages_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/pages_rest_client_config.php', + ], + ], + ]; + } + + private static function getEntityTypeNameTemplate() + { + if (self::$entityTypeNameTemplate == null) { + self::$entityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}'); + } + + return self::$entityTypeNameTemplate; + } + + private static function getFlowNameTemplate() + { + if (self::$flowNameTemplate == null) { + self::$flowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}'); + } + + return self::$flowNameTemplate; + } + + private static function getIntentNameTemplate() + { + if (self::$intentNameTemplate == null) { + self::$intentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/intents/{intent}'); + } + + return self::$intentNameTemplate; + } + + private static function getPageNameTemplate() + { + if (self::$pageNameTemplate == null) { + self::$pageNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}'); + } + + return self::$pageNameTemplate; + } + + private static function getProjectLocationAgentFlowTransitionRouteGroupNameTemplate() + { + if (self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate == null) { + self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate; + } + + private static function getProjectLocationAgentTransitionRouteGroupNameTemplate() + { + if (self::$projectLocationAgentTransitionRouteGroupNameTemplate == null) { + self::$projectLocationAgentTransitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$projectLocationAgentTransitionRouteGroupNameTemplate; + } + + private static function getTransitionRouteGroupNameTemplate() + { + if (self::$transitionRouteGroupNameTemplate == null) { + self::$transitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$transitionRouteGroupNameTemplate; + } + + private static function getWebhookNameTemplate() + { + if (self::$webhookNameTemplate == null) { + self::$webhookNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}'); + } + + return self::$webhookNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'entityType' => self::getEntityTypeNameTemplate(), + 'flow' => self::getFlowNameTemplate(), + 'intent' => self::getIntentNameTemplate(), + 'page' => self::getPageNameTemplate(), + 'projectLocationAgentFlowTransitionRouteGroup' => self::getProjectLocationAgentFlowTransitionRouteGroupNameTemplate(), + 'projectLocationAgentTransitionRouteGroup' => self::getProjectLocationAgentTransitionRouteGroupNameTemplate(), + 'transitionRouteGroup' => self::getTransitionRouteGroupNameTemplate(), + 'webhook' => self::getWebhookNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a entity_type + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $entityType + * + * @return string The formatted entity_type resource. + */ + public static function entityTypeName($project, $location, $agent, $entityType) + { + return self::getEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a flow + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow resource. + */ + public static function flowName($project, $location, $agent, $flow) + { + return self::getFlowNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a intent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $intent + * + * @return string The formatted intent resource. + */ + public static function intentName($project, $location, $agent, $intent) + { + return self::getIntentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'intent' => $intent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a page + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $page + * + * @return string The formatted page resource. + */ + public static function pageName($project, $location, $agent, $flow, $page) + { + return self::getPageNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'page' => $page, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_flow_transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $transitionRouteGroup + * + * @return string The formatted project_location_agent_flow_transition_route_group resource. + */ + public static function projectLocationAgentFlowTransitionRouteGroupName($project, $location, $agent, $flow, $transitionRouteGroup) + { + return self::getProjectLocationAgentFlowTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $transitionRouteGroup + * + * @return string The formatted project_location_agent_transition_route_group resource. + */ + public static function projectLocationAgentTransitionRouteGroupName($project, $location, $agent, $transitionRouteGroup) + { + return self::getProjectLocationAgentTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $transitionRouteGroup + * + * @return string The formatted transition_route_group resource. + */ + public static function transitionRouteGroupName($project, $location, $agent, $flow, $transitionRouteGroup) + { + return self::getTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a webhook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $webhook + * + * @return string The formatted webhook resource. + */ + public static function webhookName($project, $location, $agent, $webhook) + { + return self::getWebhookNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'webhook' => $webhook, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - entityType: projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type} + * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} + * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} + * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} + * - projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group} + * - transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} + * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a page in the specified flow. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $pagesClient = new PagesClient(); + * try { + * $formattedParent = $pagesClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $page = new Page(); + * $response = $pagesClient->createPage($formattedParent, $page); + * } finally { + * $pagesClient->close(); + * } + * ``` + * + * @param string $parent Required. The flow to create a page for. + * Format: `projects//locations//agents//flows/`. + * @param Page $page Required. The page to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language of the following fields in `page`: + * + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Page + * + * @throws ApiException if the remote call fails + */ + public function createPage($parent, $page, array $optionalArgs = []) + { + $request = new CreatePageRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setPage($page); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreatePage', Page::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified page. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $pagesClient = new PagesClient(); + * try { + * $formattedName = $pagesClient->pageName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[PAGE]'); + * $pagesClient->deletePage($formattedName); + * } finally { + * $pagesClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the page to delete. + * Format: `projects//locations//agents//Flows//pages/`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $force + * This field has no effect for pages with no incoming transitions. + * For pages with incoming transitions: + * + * * If `force` is set to false, an error will be returned with message + * indicating the incoming transitions. + * * If `force` is set to true, Dialogflow will remove the page, as well as + * any transitions to the page (i.e. [Target + * page][EventHandler.target_page] in event handlers or [Target + * page][TransitionRoute.target_page] in transition routes that point to + * this page will be cleared). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deletePage($name, array $optionalArgs = []) + { + $request = new DeletePageRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeletePage', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the specified page. + * + * Sample code: + * ``` + * $pagesClient = new PagesClient(); + * try { + * $formattedName = $pagesClient->pageName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[PAGE]'); + * $response = $pagesClient->getPage($formattedName); + * } finally { + * $pagesClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the page. + * Format: `projects//locations//agents//flows//pages/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to retrieve the page for. The following fields are language + * dependent: + * + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Page + * + * @throws ApiException if the remote call fails + */ + public function getPage($name, array $optionalArgs = []) + { + $request = new GetPageRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetPage', Page::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all pages in the specified flow. + * + * Sample code: + * ``` + * $pagesClient = new PagesClient(); + * try { + * $formattedParent = $pagesClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * // Iterate over pages of elements + * $pagedResponse = $pagesClient->listPages($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $pagesClient->listPages($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $pagesClient->close(); + * } + * ``` + * + * @param string $parent Required. The flow to list all pages for. + * Format: `projects//locations//agents//flows/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to list pages for. The following fields are language + * dependent: + * + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listPages($parent, array $optionalArgs = []) + { + $request = new ListPagesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListPages', $optionalArgs, ListPagesResponse::class, $request); + } + + /** + * Updates the specified page. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $pagesClient = new PagesClient(); + * try { + * $page = new Page(); + * $response = $pagesClient->updatePage($page); + * } finally { + * $pagesClient->close(); + * } + * ``` + * + * @param Page $page Required. The page to update. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language of the following fields in `page`: + * + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type FieldMask $updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Page + * + * @throws ApiException if the remote call fails + */ + public function updatePage($page, array $optionalArgs = []) + { + $request = new UpdatePageRequest(); + $requestParamHeaders = []; + $request->setPage($page); + $requestParamHeaders['page.name'] = $page->getName(); + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdatePage', Page::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $pagesClient = new PagesClient(); + * try { + * $response = $pagesClient->getLocation(); + * } finally { + * $pagesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $pagesClient = new PagesClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $pagesClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $pagesClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $pagesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/SecuritySettingsServiceGapicClient.php b/DialogflowCx/src/V3/Gapic/SecuritySettingsServiceGapicClient.php new file mode 100644 index 000000000000..a0983c4410e5 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/SecuritySettingsServiceGapicClient.php @@ -0,0 +1,840 @@ +locationName('[PROJECT]', '[LOCATION]'); + * $securitySettings = new SecuritySettings(); + * $response = $securitySettingsServiceClient->createSecuritySettings($formattedParent, $securitySettings); + * } finally { + * $securitySettingsServiceClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class SecuritySettingsServiceGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.SecuritySettingsService'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $deidentifyTemplateNameTemplate; + + private static $inspectTemplateNameTemplate; + + private static $locationNameTemplate; + + private static $organizationLocationDeidentifyTemplateNameTemplate; + + private static $organizationLocationInspectTemplateNameTemplate; + + private static $projectLocationDeidentifyTemplateNameTemplate; + + private static $projectLocationInspectTemplateNameTemplate; + + private static $securitySettingsNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/security_settings_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/security_settings_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/security_settings_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/security_settings_service_rest_client_config.php', + ], + ], + ]; + } + + private static function getDeidentifyTemplateNameTemplate() + { + if (self::$deidentifyTemplateNameTemplate == null) { + self::$deidentifyTemplateNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}'); + } + + return self::$deidentifyTemplateNameTemplate; + } + + private static function getInspectTemplateNameTemplate() + { + if (self::$inspectTemplateNameTemplate == null) { + self::$inspectTemplateNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}'); + } + + return self::$inspectTemplateNameTemplate; + } + + private static function getLocationNameTemplate() + { + if (self::$locationNameTemplate == null) { + self::$locationNameTemplate = new PathTemplate('projects/{project}/locations/{location}'); + } + + return self::$locationNameTemplate; + } + + private static function getOrganizationLocationDeidentifyTemplateNameTemplate() + { + if (self::$organizationLocationDeidentifyTemplateNameTemplate == null) { + self::$organizationLocationDeidentifyTemplateNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template}'); + } + + return self::$organizationLocationDeidentifyTemplateNameTemplate; + } + + private static function getOrganizationLocationInspectTemplateNameTemplate() + { + if (self::$organizationLocationInspectTemplateNameTemplate == null) { + self::$organizationLocationInspectTemplateNameTemplate = new PathTemplate('organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template}'); + } + + return self::$organizationLocationInspectTemplateNameTemplate; + } + + private static function getProjectLocationDeidentifyTemplateNameTemplate() + { + if (self::$projectLocationDeidentifyTemplateNameTemplate == null) { + self::$projectLocationDeidentifyTemplateNameTemplate = new PathTemplate('projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template}'); + } + + return self::$projectLocationDeidentifyTemplateNameTemplate; + } + + private static function getProjectLocationInspectTemplateNameTemplate() + { + if (self::$projectLocationInspectTemplateNameTemplate == null) { + self::$projectLocationInspectTemplateNameTemplate = new PathTemplate('projects/{project}/locations/{location}/inspectTemplates/{inspect_template}'); + } + + return self::$projectLocationInspectTemplateNameTemplate; + } + + private static function getSecuritySettingsNameTemplate() + { + if (self::$securitySettingsNameTemplate == null) { + self::$securitySettingsNameTemplate = new PathTemplate('projects/{project}/locations/{location}/securitySettings/{security_settings}'); + } + + return self::$securitySettingsNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'deidentifyTemplate' => self::getDeidentifyTemplateNameTemplate(), + 'inspectTemplate' => self::getInspectTemplateNameTemplate(), + 'location' => self::getLocationNameTemplate(), + 'organizationLocationDeidentifyTemplate' => self::getOrganizationLocationDeidentifyTemplateNameTemplate(), + 'organizationLocationInspectTemplate' => self::getOrganizationLocationInspectTemplateNameTemplate(), + 'projectLocationDeidentifyTemplate' => self::getProjectLocationDeidentifyTemplateNameTemplate(), + 'projectLocationInspectTemplate' => self::getProjectLocationInspectTemplateNameTemplate(), + 'securitySettings' => self::getSecuritySettingsNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * deidentify_template resource. + * + * @param string $organization + * @param string $location + * @param string $deidentifyTemplate + * + * @return string The formatted deidentify_template resource. + */ + public static function deidentifyTemplateName($organization, $location, $deidentifyTemplate) + { + return self::getDeidentifyTemplateNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'deidentify_template' => $deidentifyTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * inspect_template resource. + * + * @param string $organization + * @param string $location + * @param string $inspectTemplate + * + * @return string The formatted inspect_template resource. + */ + public static function inspectTemplateName($organization, $location, $inspectTemplate) + { + return self::getInspectTemplateNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'inspect_template' => $inspectTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a location + * resource. + * + * @param string $project + * @param string $location + * + * @return string The formatted location resource. + */ + public static function locationName($project, $location) + { + return self::getLocationNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_deidentify_template resource. + * + * @param string $organization + * @param string $location + * @param string $deidentifyTemplate + * + * @return string The formatted organization_location_deidentify_template resource. + */ + public static function organizationLocationDeidentifyTemplateName($organization, $location, $deidentifyTemplate) + { + return self::getOrganizationLocationDeidentifyTemplateNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'deidentify_template' => $deidentifyTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * organization_location_inspect_template resource. + * + * @param string $organization + * @param string $location + * @param string $inspectTemplate + * + * @return string The formatted organization_location_inspect_template resource. + */ + public static function organizationLocationInspectTemplateName($organization, $location, $inspectTemplate) + { + return self::getOrganizationLocationInspectTemplateNameTemplate()->render([ + 'organization' => $organization, + 'location' => $location, + 'inspect_template' => $inspectTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_deidentify_template resource. + * + * @param string $project + * @param string $location + * @param string $deidentifyTemplate + * + * @return string The formatted project_location_deidentify_template resource. + */ + public static function projectLocationDeidentifyTemplateName($project, $location, $deidentifyTemplate) + { + return self::getProjectLocationDeidentifyTemplateNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'deidentify_template' => $deidentifyTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_inspect_template resource. + * + * @param string $project + * @param string $location + * @param string $inspectTemplate + * + * @return string The formatted project_location_inspect_template resource. + */ + public static function projectLocationInspectTemplateName($project, $location, $inspectTemplate) + { + return self::getProjectLocationInspectTemplateNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'inspect_template' => $inspectTemplate, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * security_settings resource. + * + * @param string $project + * @param string $location + * @param string $securitySettings + * + * @return string The formatted security_settings resource. + */ + public static function securitySettingsName($project, $location, $securitySettings) + { + return self::getSecuritySettingsNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'security_settings' => $securitySettings, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - deidentifyTemplate: organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template} + * - inspectTemplate: organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template} + * - location: projects/{project}/locations/{location} + * - organizationLocationDeidentifyTemplate: organizations/{organization}/locations/{location}/deidentifyTemplates/{deidentify_template} + * - organizationLocationInspectTemplate: organizations/{organization}/locations/{location}/inspectTemplates/{inspect_template} + * - projectLocationDeidentifyTemplate: projects/{project}/locations/{location}/deidentifyTemplates/{deidentify_template} + * - projectLocationInspectTemplate: projects/{project}/locations/{location}/inspectTemplates/{inspect_template} + * - securitySettings: projects/{project}/locations/{location}/securitySettings/{security_settings} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Create security settings in the specified location. + * + * Sample code: + * ``` + * $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + * try { + * $formattedParent = $securitySettingsServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * $securitySettings = new SecuritySettings(); + * $response = $securitySettingsServiceClient->createSecuritySettings($formattedParent, $securitySettings); + * } finally { + * $securitySettingsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The location to create an + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] for. + * Format: `projects//locations/`. + * @param SecuritySettings $securitySettings Required. The security settings to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\SecuritySettings + * + * @throws ApiException if the remote call fails + */ + public function createSecuritySettings($parent, $securitySettings, array $optionalArgs = []) + { + $request = new CreateSecuritySettingsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSecuritySettings($securitySettings); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSecuritySettings', SecuritySettings::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. + * + * Sample code: + * ``` + * $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + * try { + * $formattedName = $securitySettingsServiceClient->securitySettingsName('[PROJECT]', '[LOCATION]', '[SECURITY_SETTINGS]'); + * $securitySettingsServiceClient->deleteSecuritySettings($formattedName); + * } finally { + * $securitySettingsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] to + * delete. Format: `projects//locations//securitySettings/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteSecuritySettings($name, array $optionalArgs = []) + { + $request = new DeleteSecuritySettingsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteSecuritySettings', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the specified + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. The + * returned settings may be stale by up to 1 minute. + * + * Sample code: + * ``` + * $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + * try { + * $formattedName = $securitySettingsServiceClient->securitySettingsName('[PROJECT]', '[LOCATION]', '[SECURITY_SETTINGS]'); + * $response = $securitySettingsServiceClient->getSecuritySettings($formattedName); + * } finally { + * $securitySettingsServiceClient->close(); + * } + * ``` + * + * @param string $name Required. Resource name of the settings. + * Format: `projects//locations//securitySettings/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\SecuritySettings + * + * @throws ApiException if the remote call fails + */ + public function getSecuritySettings($name, array $optionalArgs = []) + { + $request = new GetSecuritySettingsRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSecuritySettings', SecuritySettings::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all security settings in the specified location. + * + * Sample code: + * ``` + * $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + * try { + * $formattedParent = $securitySettingsServiceClient->locationName('[PROJECT]', '[LOCATION]'); + * // Iterate over pages of elements + * $pagedResponse = $securitySettingsServiceClient->listSecuritySettings($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $securitySettingsServiceClient->listSecuritySettings($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $securitySettingsServiceClient->close(); + * } + * ``` + * + * @param string $parent Required. The location to list all security settings for. + * Format: `projects//locations/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSecuritySettings($parent, array $optionalArgs = []) + { + $request = new ListSecuritySettingsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSecuritySettings', $optionalArgs, ListSecuritySettingsResponse::class, $request); + } + + /** + * Updates the specified + * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings]. + * + * Sample code: + * ``` + * $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + * try { + * $securitySettings = new SecuritySettings(); + * $updateMask = new FieldMask(); + * $response = $securitySettingsServiceClient->updateSecuritySettings($securitySettings, $updateMask); + * } finally { + * $securitySettingsServiceClient->close(); + * } + * ``` + * + * @param SecuritySettings $securitySettings Required. [SecuritySettings] object that contains values for each of the + * fields to update. + * @param FieldMask $updateMask Required. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\SecuritySettings + * + * @throws ApiException if the remote call fails + */ + public function updateSecuritySettings($securitySettings, $updateMask, array $optionalArgs = []) + { + $request = new UpdateSecuritySettingsRequest(); + $requestParamHeaders = []; + $request->setSecuritySettings($securitySettings); + $request->setUpdateMask($updateMask); + $requestParamHeaders['security_settings.name'] = $securitySettings->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateSecuritySettings', SecuritySettings::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + * try { + * $response = $securitySettingsServiceClient->getLocation(); + * } finally { + * $securitySettingsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $securitySettingsServiceClient = new SecuritySettingsServiceClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $securitySettingsServiceClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $securitySettingsServiceClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $securitySettingsServiceClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/SessionEntityTypesGapicClient.php b/DialogflowCx/src/V3/Gapic/SessionEntityTypesGapicClient.php new file mode 100644 index 000000000000..05028065dc4f --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/SessionEntityTypesGapicClient.php @@ -0,0 +1,818 @@ +sessionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]'); + * $sessionEntityType = new SessionEntityType(); + * $response = $sessionEntityTypesClient->createSessionEntityType($formattedParent, $sessionEntityType); + * } finally { + * $sessionEntityTypesClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class SessionEntityTypesGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.SessionEntityTypes'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $projectLocationAgentEnvironmentSessionNameTemplate; + + private static $projectLocationAgentEnvironmentSessionEntityTypeNameTemplate; + + private static $projectLocationAgentSessionNameTemplate; + + private static $projectLocationAgentSessionEntityTypeNameTemplate; + + private static $sessionNameTemplate; + + private static $sessionEntityTypeNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/session_entity_types_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/session_entity_types_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/session_entity_types_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/session_entity_types_rest_client_config.php', + ], + ], + ]; + } + + private static function getProjectLocationAgentEnvironmentSessionNameTemplate() + { + if (self::$projectLocationAgentEnvironmentSessionNameTemplate == null) { + self::$projectLocationAgentEnvironmentSessionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}'); + } + + return self::$projectLocationAgentEnvironmentSessionNameTemplate; + } + + private static function getProjectLocationAgentEnvironmentSessionEntityTypeNameTemplate() + { + if (self::$projectLocationAgentEnvironmentSessionEntityTypeNameTemplate == null) { + self::$projectLocationAgentEnvironmentSessionEntityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}'); + } + + return self::$projectLocationAgentEnvironmentSessionEntityTypeNameTemplate; + } + + private static function getProjectLocationAgentSessionNameTemplate() + { + if (self::$projectLocationAgentSessionNameTemplate == null) { + self::$projectLocationAgentSessionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/sessions/{session}'); + } + + return self::$projectLocationAgentSessionNameTemplate; + } + + private static function getProjectLocationAgentSessionEntityTypeNameTemplate() + { + if (self::$projectLocationAgentSessionEntityTypeNameTemplate == null) { + self::$projectLocationAgentSessionEntityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}'); + } + + return self::$projectLocationAgentSessionEntityTypeNameTemplate; + } + + private static function getSessionNameTemplate() + { + if (self::$sessionNameTemplate == null) { + self::$sessionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/sessions/{session}'); + } + + return self::$sessionNameTemplate; + } + + private static function getSessionEntityTypeNameTemplate() + { + if (self::$sessionEntityTypeNameTemplate == null) { + self::$sessionEntityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}'); + } + + return self::$sessionEntityTypeNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'projectLocationAgentEnvironmentSession' => self::getProjectLocationAgentEnvironmentSessionNameTemplate(), + 'projectLocationAgentEnvironmentSessionEntityType' => self::getProjectLocationAgentEnvironmentSessionEntityTypeNameTemplate(), + 'projectLocationAgentSession' => self::getProjectLocationAgentSessionNameTemplate(), + 'projectLocationAgentSessionEntityType' => self::getProjectLocationAgentSessionEntityTypeNameTemplate(), + 'session' => self::getSessionNameTemplate(), + 'sessionEntityType' => self::getSessionEntityTypeNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_environment_session resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * @param string $session + * + * @return string The formatted project_location_agent_environment_session resource. + */ + public static function projectLocationAgentEnvironmentSessionName($project, $location, $agent, $environment, $session) + { + return self::getProjectLocationAgentEnvironmentSessionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_environment_session_entity_type resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * @param string $session + * @param string $entityType + * + * @return string The formatted project_location_agent_environment_session_entity_type resource. + */ + public static function projectLocationAgentEnvironmentSessionEntityTypeName($project, $location, $agent, $environment, $session, $entityType) + { + return self::getProjectLocationAgentEnvironmentSessionEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + 'session' => $session, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_session resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $session + * + * @return string The formatted project_location_agent_session resource. + */ + public static function projectLocationAgentSessionName($project, $location, $agent, $session) + { + return self::getProjectLocationAgentSessionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_session_entity_type resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $session + * @param string $entityType + * + * @return string The formatted project_location_agent_session_entity_type resource. + */ + public static function projectLocationAgentSessionEntityTypeName($project, $location, $agent, $session, $entityType) + { + return self::getProjectLocationAgentSessionEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'session' => $session, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a session + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $session + * + * @return string The formatted session resource. + */ + public static function sessionName($project, $location, $agent, $session) + { + return self::getSessionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * session_entity_type resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $session + * @param string $entityType + * + * @return string The formatted session_entity_type resource. + */ + public static function sessionEntityTypeName($project, $location, $agent, $session, $entityType) + { + return self::getSessionEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'session' => $session, + 'entity_type' => $entityType, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - projectLocationAgentEnvironmentSession: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session} + * - projectLocationAgentEnvironmentSessionEntityType: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type} + * - projectLocationAgentSession: projects/{project}/locations/{location}/agents/{agent}/sessions/{session} + * - projectLocationAgentSessionEntityType: projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type} + * - session: projects/{project}/locations/{location}/agents/{agent}/sessions/{session} + * - sessionEntityType: projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a session entity type. + * + * Sample code: + * ``` + * $sessionEntityTypesClient = new SessionEntityTypesClient(); + * try { + * $formattedParent = $sessionEntityTypesClient->sessionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]'); + * $sessionEntityType = new SessionEntityType(); + * $response = $sessionEntityTypesClient->createSessionEntityType($formattedParent, $sessionEntityType); + * } finally { + * $sessionEntityTypesClient->close(); + * } + * ``` + * + * @param string $parent Required. The session to create a session entity type for. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param SessionEntityType $sessionEntityType Required. The session entity type to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType + * + * @throws ApiException if the remote call fails + */ + public function createSessionEntityType($parent, $sessionEntityType, array $optionalArgs = []) + { + $request = new CreateSessionEntityTypeRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setSessionEntityType($sessionEntityType); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateSessionEntityType', SessionEntityType::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified session entity type. + * + * Sample code: + * ``` + * $sessionEntityTypesClient = new SessionEntityTypesClient(); + * try { + * $formattedName = $sessionEntityTypesClient->sessionEntityTypeName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]', '[ENTITY_TYPE]'); + * $sessionEntityTypesClient->deleteSessionEntityType($formattedName); + * } finally { + * $sessionEntityTypesClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the session entity type to delete. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteSessionEntityType($name, array $optionalArgs = []) + { + $request = new DeleteSessionEntityTypeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteSessionEntityType', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the specified session entity type. + * + * Sample code: + * ``` + * $sessionEntityTypesClient = new SessionEntityTypesClient(); + * try { + * $formattedName = $sessionEntityTypesClient->sessionEntityTypeName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]', '[ENTITY_TYPE]'); + * $response = $sessionEntityTypesClient->getSessionEntityType($formattedName); + * } finally { + * $sessionEntityTypesClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the session entity type. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType + * + * @throws ApiException if the remote call fails + */ + public function getSessionEntityType($name, array $optionalArgs = []) + { + $request = new GetSessionEntityTypeRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetSessionEntityType', SessionEntityType::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all session entity types in the specified session. + * + * Sample code: + * ``` + * $sessionEntityTypesClient = new SessionEntityTypesClient(); + * try { + * $formattedParent = $sessionEntityTypesClient->sessionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]'); + * // Iterate over pages of elements + * $pagedResponse = $sessionEntityTypesClient->listSessionEntityTypes($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $sessionEntityTypesClient->listSessionEntityTypes($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $sessionEntityTypesClient->close(); + * } + * ``` + * + * @param string $parent Required. The session to list all session entity types from. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listSessionEntityTypes($parent, array $optionalArgs = []) + { + $request = new ListSessionEntityTypesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListSessionEntityTypes', $optionalArgs, ListSessionEntityTypesResponse::class, $request); + } + + /** + * Updates the specified session entity type. + * + * Sample code: + * ``` + * $sessionEntityTypesClient = new SessionEntityTypesClient(); + * try { + * $sessionEntityType = new SessionEntityType(); + * $response = $sessionEntityTypesClient->updateSessionEntityType($sessionEntityType); + * } finally { + * $sessionEntityTypesClient->close(); + * } + * ``` + * + * @param SessionEntityType $sessionEntityType Required. The session entity type to update. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The mask to control which fields get updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType + * + * @throws ApiException if the remote call fails + */ + public function updateSessionEntityType($sessionEntityType, array $optionalArgs = []) + { + $request = new UpdateSessionEntityTypeRequest(); + $requestParamHeaders = []; + $request->setSessionEntityType($sessionEntityType); + $requestParamHeaders['session_entity_type.name'] = $sessionEntityType->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateSessionEntityType', SessionEntityType::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $sessionEntityTypesClient = new SessionEntityTypesClient(); + * try { + * $response = $sessionEntityTypesClient->getLocation(); + * } finally { + * $sessionEntityTypesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $sessionEntityTypesClient = new SessionEntityTypesClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $sessionEntityTypesClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $sessionEntityTypesClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $sessionEntityTypesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/SessionsGapicClient.php b/DialogflowCx/src/V3/Gapic/SessionsGapicClient.php new file mode 100644 index 000000000000..7bf971d55f7d --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/SessionsGapicClient.php @@ -0,0 +1,1005 @@ +sessionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]'); + * $queryInput = new QueryInput(); + * $response = $sessionsClient->detectIntent($formattedSession, $queryInput); + * } finally { + * $sessionsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class SessionsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Sessions'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $entityTypeNameTemplate; + + private static $intentNameTemplate; + + private static $pageNameTemplate; + + private static $projectLocationAgentEnvironmentSessionNameTemplate; + + private static $projectLocationAgentEnvironmentSessionEntityTypeNameTemplate; + + private static $projectLocationAgentSessionNameTemplate; + + private static $projectLocationAgentSessionEntityTypeNameTemplate; + + private static $sessionNameTemplate; + + private static $sessionEntityTypeNameTemplate; + + private static $versionNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/sessions_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/sessions_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/sessions_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/sessions_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getEntityTypeNameTemplate() + { + if (self::$entityTypeNameTemplate == null) { + self::$entityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}'); + } + + return self::$entityTypeNameTemplate; + } + + private static function getIntentNameTemplate() + { + if (self::$intentNameTemplate == null) { + self::$intentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/intents/{intent}'); + } + + return self::$intentNameTemplate; + } + + private static function getPageNameTemplate() + { + if (self::$pageNameTemplate == null) { + self::$pageNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}'); + } + + return self::$pageNameTemplate; + } + + private static function getProjectLocationAgentEnvironmentSessionNameTemplate() + { + if (self::$projectLocationAgentEnvironmentSessionNameTemplate == null) { + self::$projectLocationAgentEnvironmentSessionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}'); + } + + return self::$projectLocationAgentEnvironmentSessionNameTemplate; + } + + private static function getProjectLocationAgentEnvironmentSessionEntityTypeNameTemplate() + { + if (self::$projectLocationAgentEnvironmentSessionEntityTypeNameTemplate == null) { + self::$projectLocationAgentEnvironmentSessionEntityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}'); + } + + return self::$projectLocationAgentEnvironmentSessionEntityTypeNameTemplate; + } + + private static function getProjectLocationAgentSessionNameTemplate() + { + if (self::$projectLocationAgentSessionNameTemplate == null) { + self::$projectLocationAgentSessionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/sessions/{session}'); + } + + return self::$projectLocationAgentSessionNameTemplate; + } + + private static function getProjectLocationAgentSessionEntityTypeNameTemplate() + { + if (self::$projectLocationAgentSessionEntityTypeNameTemplate == null) { + self::$projectLocationAgentSessionEntityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}'); + } + + return self::$projectLocationAgentSessionEntityTypeNameTemplate; + } + + private static function getSessionNameTemplate() + { + if (self::$sessionNameTemplate == null) { + self::$sessionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/sessions/{session}'); + } + + return self::$sessionNameTemplate; + } + + private static function getSessionEntityTypeNameTemplate() + { + if (self::$sessionEntityTypeNameTemplate == null) { + self::$sessionEntityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}'); + } + + return self::$sessionEntityTypeNameTemplate; + } + + private static function getVersionNameTemplate() + { + if (self::$versionNameTemplate == null) { + self::$versionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}'); + } + + return self::$versionNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'entityType' => self::getEntityTypeNameTemplate(), + 'intent' => self::getIntentNameTemplate(), + 'page' => self::getPageNameTemplate(), + 'projectLocationAgentEnvironmentSession' => self::getProjectLocationAgentEnvironmentSessionNameTemplate(), + 'projectLocationAgentEnvironmentSessionEntityType' => self::getProjectLocationAgentEnvironmentSessionEntityTypeNameTemplate(), + 'projectLocationAgentSession' => self::getProjectLocationAgentSessionNameTemplate(), + 'projectLocationAgentSessionEntityType' => self::getProjectLocationAgentSessionEntityTypeNameTemplate(), + 'session' => self::getSessionNameTemplate(), + 'sessionEntityType' => self::getSessionEntityTypeNameTemplate(), + 'version' => self::getVersionNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a entity_type + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $entityType + * + * @return string The formatted entity_type resource. + */ + public static function entityTypeName($project, $location, $agent, $entityType) + { + return self::getEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a intent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $intent + * + * @return string The formatted intent resource. + */ + public static function intentName($project, $location, $agent, $intent) + { + return self::getIntentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'intent' => $intent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a page + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $page + * + * @return string The formatted page resource. + */ + public static function pageName($project, $location, $agent, $flow, $page) + { + return self::getPageNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'page' => $page, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_environment_session resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * @param string $session + * + * @return string The formatted project_location_agent_environment_session resource. + */ + public static function projectLocationAgentEnvironmentSessionName($project, $location, $agent, $environment, $session) + { + return self::getProjectLocationAgentEnvironmentSessionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_environment_session_entity_type resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * @param string $session + * @param string $entityType + * + * @return string The formatted project_location_agent_environment_session_entity_type resource. + */ + public static function projectLocationAgentEnvironmentSessionEntityTypeName($project, $location, $agent, $environment, $session, $entityType) + { + return self::getProjectLocationAgentEnvironmentSessionEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + 'session' => $session, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_session resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $session + * + * @return string The formatted project_location_agent_session resource. + */ + public static function projectLocationAgentSessionName($project, $location, $agent, $session) + { + return self::getProjectLocationAgentSessionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_session_entity_type resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $session + * @param string $entityType + * + * @return string The formatted project_location_agent_session_entity_type resource. + */ + public static function projectLocationAgentSessionEntityTypeName($project, $location, $agent, $session, $entityType) + { + return self::getProjectLocationAgentSessionEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'session' => $session, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a session + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $session + * + * @return string The formatted session resource. + */ + public static function sessionName($project, $location, $agent, $session) + { + return self::getSessionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * session_entity_type resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $session + * @param string $entityType + * + * @return string The formatted session_entity_type resource. + */ + public static function sessionEntityTypeName($project, $location, $agent, $session, $entityType) + { + return self::getSessionEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'session' => $session, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a version + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $version + * + * @return string The formatted version resource. + */ + public static function versionName($project, $location, $agent, $flow, $version) + { + return self::getVersionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'version' => $version, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - entityType: projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type} + * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} + * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - projectLocationAgentEnvironmentSession: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session} + * - projectLocationAgentEnvironmentSessionEntityType: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type} + * - projectLocationAgentSession: projects/{project}/locations/{location}/agents/{agent}/sessions/{session} + * - projectLocationAgentSessionEntityType: projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type} + * - session: projects/{project}/locations/{location}/agents/{agent}/sessions/{session} + * - sessionEntityType: projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type} + * - version: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Processes a natural language query and returns structured, actionable data + * as a result. This method is not idempotent, because it may cause 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/cx/docs/concept/version). + * + * Sample code: + * ``` + * $sessionsClient = new SessionsClient(); + * try { + * $formattedSession = $sessionsClient->sessionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]'); + * $queryInput = new QueryInput(); + * $response = $sessionsClient->detectIntent($formattedSession, $queryInput); + * } finally { + * $sessionsClient->close(); + * } + * ``` + * + * @param string $session Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * + * Note: Always use agent versions for production traffic. + * See [Versions and + * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version). + * @param QueryInput $queryInput Required. The input specification. + * @param array $optionalArgs { + * Optional. + * + * @type QueryParameters $queryParams + * The parameters of this query. + * @type OutputAudioConfig $outputAudioConfig + * Instructs the speech synthesizer how to generate the output audio. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\DetectIntentResponse + * + * @throws ApiException if the remote call fails + */ + public function detectIntent($session, $queryInput, array $optionalArgs = []) + { + $request = new DetectIntentRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setQueryInput($queryInput); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['queryParams'])) { + $request->setQueryParams($optionalArgs['queryParams']); + } + + if (isset($optionalArgs['outputAudioConfig'])) { + $request->setOutputAudioConfig($optionalArgs['outputAudioConfig']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DetectIntent', DetectIntentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Fulfills a matched intent returned by + * [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent]. Must be + * called after + * [MatchIntent][google.cloud.dialogflow.cx.v3.Sessions.MatchIntent], with + * input from + * [MatchIntentResponse][google.cloud.dialogflow.cx.v3.MatchIntentResponse]. + * Otherwise, the behavior is undefined. + * + * Sample code: + * ``` + * $sessionsClient = new SessionsClient(); + * try { + * $response = $sessionsClient->fulfillIntent(); + * } finally { + * $sessionsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type MatchIntentRequest $matchIntentRequest + * Must be same as the corresponding MatchIntent request, otherwise the + * behavior is undefined. + * @type PBMatch $match + * The matched intent/event to fulfill. + * @type OutputAudioConfig $outputAudioConfig + * Instructs the speech synthesizer how to generate output audio. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\FulfillIntentResponse + * + * @throws ApiException if the remote call fails + */ + public function fulfillIntent(array $optionalArgs = []) + { + $request = new FulfillIntentRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['matchIntentRequest'])) { + $request->setMatchIntentRequest($optionalArgs['matchIntentRequest']); + } + + if (isset($optionalArgs['match'])) { + $request->setMatch($optionalArgs['match']); + } + + if (isset($optionalArgs['outputAudioConfig'])) { + $request->setOutputAudioConfig($optionalArgs['outputAudioConfig']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('FulfillIntent', FulfillIntentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns preliminary intent match results, doesn't change the session + * status. + * + * Sample code: + * ``` + * $sessionsClient = new SessionsClient(); + * try { + * $formattedSession = $sessionsClient->sessionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[SESSION]'); + * $queryInput = new QueryInput(); + * $response = $sessionsClient->matchIntent($formattedSession, $queryInput); + * } finally { + * $sessionsClient->close(); + * } + * ``` + * + * @param string $session Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * @param QueryInput $queryInput Required. The input specification. + * @param array $optionalArgs { + * Optional. + * + * @type QueryParameters $queryParams + * The parameters of this query. + * @type bool $persistParameterChanges + * Persist session parameter changes from `query_params`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\MatchIntentResponse + * + * @throws ApiException if the remote call fails + */ + public function matchIntent($session, $queryInput, array $optionalArgs = []) + { + $request = new MatchIntentRequest(); + $requestParamHeaders = []; + $request->setSession($session); + $request->setQueryInput($queryInput); + $requestParamHeaders['session'] = $session; + if (isset($optionalArgs['queryParams'])) { + $request->setQueryParams($optionalArgs['queryParams']); + } + + if (isset($optionalArgs['persistParameterChanges'])) { + $request->setPersistParameterChanges($optionalArgs['persistParameterChanges']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('MatchIntent', MatchIntentResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * 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/cx/docs/concept/version). + * + * Sample code: + * ``` + * $sessionsClient = new SessionsClient(); + * try { + * $queryInput = new QueryInput(); + * $request = new StreamingDetectIntentRequest(); + * $request->setQueryInput($queryInput); + * // Write all requests to the server, then read all responses until the + * // stream is complete + * $requests = [ + * $request, + * ]; + * $stream = $sessionsClient->streamingDetectIntent(); + * $stream->writeAll($requests); + * foreach ($stream->closeWriteAndReadAll() as $element) { + * // doSomethingWith($element); + * } + * // Alternatively: + * // Write requests individually, making read() calls if + * // required. Call closeWrite() once writes are complete, and read the + * // remaining responses from the server. + * $requests = [ + * $request, + * ]; + * $stream = $sessionsClient->streamingDetectIntent(); + * foreach ($requests as $request) { + * $stream->write($request); + * // if required, read a single response from the stream + * $element = $stream->read(); + * // doSomethingWith($element) + * } + * $stream->closeWrite(); + * $element = $stream->read(); + * while (!is_null($element)) { + * // doSomethingWith($element) + * $element = $stream->read(); + * } + * } finally { + * $sessionsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type int $timeoutMillis + * Timeout to use for this call. + * } + * + * @return \Google\ApiCore\BidiStream + * + * @throws ApiException if the remote call fails + */ + public function streamingDetectIntent(array $optionalArgs = []) + { + return $this->startCall('StreamingDetectIntent', StreamingDetectIntentResponse::class, $optionalArgs, null, Call::BIDI_STREAMING_CALL); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $sessionsClient = new SessionsClient(); + * try { + * $response = $sessionsClient->getLocation(); + * } finally { + * $sessionsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $sessionsClient = new SessionsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $sessionsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $sessionsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $sessionsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/TestCasesGapicClient.php b/DialogflowCx/src/V3/Gapic/TestCasesGapicClient.php new file mode 100644 index 000000000000..c03449bf3b8f --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/TestCasesGapicClient.php @@ -0,0 +1,1629 @@ +agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $formattedNames = [ + * $testCasesClient->testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]'), + * ]; + * $testCasesClient->batchDeleteTestCases($formattedParent, $formattedNames); + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class TestCasesGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.TestCases'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $entityTypeNameTemplate; + + private static $environmentNameTemplate; + + private static $flowNameTemplate; + + private static $intentNameTemplate; + + private static $pageNameTemplate; + + private static $projectLocationAgentFlowTransitionRouteGroupNameTemplate; + + private static $projectLocationAgentTransitionRouteGroupNameTemplate; + + private static $testCaseNameTemplate; + + private static $testCaseResultNameTemplate; + + private static $transitionRouteGroupNameTemplate; + + private static $webhookNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/test_cases_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/test_cases_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/test_cases_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/test_cases_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getEntityTypeNameTemplate() + { + if (self::$entityTypeNameTemplate == null) { + self::$entityTypeNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}'); + } + + return self::$entityTypeNameTemplate; + } + + private static function getEnvironmentNameTemplate() + { + if (self::$environmentNameTemplate == null) { + self::$environmentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/environments/{environment}'); + } + + return self::$environmentNameTemplate; + } + + private static function getFlowNameTemplate() + { + if (self::$flowNameTemplate == null) { + self::$flowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}'); + } + + return self::$flowNameTemplate; + } + + private static function getIntentNameTemplate() + { + if (self::$intentNameTemplate == null) { + self::$intentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/intents/{intent}'); + } + + return self::$intentNameTemplate; + } + + private static function getPageNameTemplate() + { + if (self::$pageNameTemplate == null) { + self::$pageNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}'); + } + + return self::$pageNameTemplate; + } + + private static function getProjectLocationAgentFlowTransitionRouteGroupNameTemplate() + { + if (self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate == null) { + self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate; + } + + private static function getProjectLocationAgentTransitionRouteGroupNameTemplate() + { + if (self::$projectLocationAgentTransitionRouteGroupNameTemplate == null) { + self::$projectLocationAgentTransitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$projectLocationAgentTransitionRouteGroupNameTemplate; + } + + private static function getTestCaseNameTemplate() + { + if (self::$testCaseNameTemplate == null) { + self::$testCaseNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}'); + } + + return self::$testCaseNameTemplate; + } + + private static function getTestCaseResultNameTemplate() + { + if (self::$testCaseResultNameTemplate == null) { + self::$testCaseResultNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}'); + } + + return self::$testCaseResultNameTemplate; + } + + private static function getTransitionRouteGroupNameTemplate() + { + if (self::$transitionRouteGroupNameTemplate == null) { + self::$transitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$transitionRouteGroupNameTemplate; + } + + private static function getWebhookNameTemplate() + { + if (self::$webhookNameTemplate == null) { + self::$webhookNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}'); + } + + return self::$webhookNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'entityType' => self::getEntityTypeNameTemplate(), + 'environment' => self::getEnvironmentNameTemplate(), + 'flow' => self::getFlowNameTemplate(), + 'intent' => self::getIntentNameTemplate(), + 'page' => self::getPageNameTemplate(), + 'projectLocationAgentFlowTransitionRouteGroup' => self::getProjectLocationAgentFlowTransitionRouteGroupNameTemplate(), + 'projectLocationAgentTransitionRouteGroup' => self::getProjectLocationAgentTransitionRouteGroupNameTemplate(), + 'testCase' => self::getTestCaseNameTemplate(), + 'testCaseResult' => self::getTestCaseResultNameTemplate(), + 'transitionRouteGroup' => self::getTransitionRouteGroupNameTemplate(), + 'webhook' => self::getWebhookNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a entity_type + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $entityType + * + * @return string The formatted entity_type resource. + */ + public static function entityTypeName($project, $location, $agent, $entityType) + { + return self::getEntityTypeNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'entity_type' => $entityType, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a environment + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $environment + * + * @return string The formatted environment resource. + */ + public static function environmentName($project, $location, $agent, $environment) + { + return self::getEnvironmentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'environment' => $environment, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a flow + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow resource. + */ + public static function flowName($project, $location, $agent, $flow) + { + return self::getFlowNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a intent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $intent + * + * @return string The formatted intent resource. + */ + public static function intentName($project, $location, $agent, $intent) + { + return self::getIntentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'intent' => $intent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a page + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $page + * + * @return string The formatted page resource. + */ + public static function pageName($project, $location, $agent, $flow, $page) + { + return self::getPageNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'page' => $page, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_flow_transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $transitionRouteGroup + * + * @return string The formatted project_location_agent_flow_transition_route_group resource. + */ + public static function projectLocationAgentFlowTransitionRouteGroupName($project, $location, $agent, $flow, $transitionRouteGroup) + { + return self::getProjectLocationAgentFlowTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $transitionRouteGroup + * + * @return string The formatted project_location_agent_transition_route_group resource. + */ + public static function projectLocationAgentTransitionRouteGroupName($project, $location, $agent, $transitionRouteGroup) + { + return self::getProjectLocationAgentTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a test_case + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $testCase + * + * @return string The formatted test_case resource. + */ + public static function testCaseName($project, $location, $agent, $testCase) + { + return self::getTestCaseNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'test_case' => $testCase, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * test_case_result resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $testCase + * @param string $result + * + * @return string The formatted test_case_result resource. + */ + public static function testCaseResultName($project, $location, $agent, $testCase, $result) + { + return self::getTestCaseResultNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'test_case' => $testCase, + 'result' => $result, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $transitionRouteGroup + * + * @return string The formatted transition_route_group resource. + */ + public static function transitionRouteGroupName($project, $location, $agent, $flow, $transitionRouteGroup) + { + return self::getTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a webhook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $webhook + * + * @return string The formatted webhook resource. + */ + public static function webhookName($project, $location, $agent, $webhook) + { + return self::getWebhookNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'webhook' => $webhook, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - entityType: projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type} + * - environment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment} + * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} + * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} + * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} + * - projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group} + * - testCase: projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case} + * - testCaseResult: projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result} + * - transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} + * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Batch deletes test cases. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedParent = $testCasesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $formattedNames = [ + * $testCasesClient->testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]'), + * ]; + * $testCasesClient->batchDeleteTestCases($formattedParent, $formattedNames); + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to delete test cases from. + * Format: `projects//locations//agents/`. + * @param string[] $names Required. Format of test case names: `projects//locations/ + * /agents//testCases/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function batchDeleteTestCases($parent, $names, array $optionalArgs = []) + { + $request = new BatchDeleteTestCasesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setNames($names); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('BatchDeleteTestCases', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Kicks off a batch run of test cases. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [BatchRunTestCasesMetadata][google.cloud.dialogflow.cx.v3.BatchRunTestCasesMetadata] + * - `response`: + * [BatchRunTestCasesResponse][google.cloud.dialogflow.cx.v3.BatchRunTestCasesResponse] + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedParent = $testCasesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $formattedTestCases = [ + * $testCasesClient->testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]'), + * ]; + * $operationResponse = $testCasesClient->batchRunTestCases($formattedParent, $formattedTestCases); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $testCasesClient->batchRunTestCases($formattedParent, $formattedTestCases); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $testCasesClient->resumeOperation($operationName, 'batchRunTestCases'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $parent Required. Agent name. Format: `projects//locations//agents/ `. + * @param string[] $testCases Required. Format: `projects//locations//agents//testCases/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $environment + * Optional. If not set, draft environment is assumed. Format: + * `projects//locations//agents//environments/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function batchRunTestCases($parent, $testCases, array $optionalArgs = []) + { + $request = new BatchRunTestCasesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTestCases($testCases); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['environment'])) { + $request->setEnvironment($optionalArgs['environment']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('BatchRunTestCases', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Calculates the test coverage for an agent. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedAgent = $testCasesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $type = CoverageType::COVERAGE_TYPE_UNSPECIFIED; + * $response = $testCasesClient->calculateCoverage($formattedAgent, $type); + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $agent Required. The agent to calculate coverage for. + * Format: `projects//locations//agents/`. + * @param int $type Required. The type of coverage requested. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\CalculateCoverageRequest\CoverageType} + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\CalculateCoverageResponse + * + * @throws ApiException if the remote call fails + */ + public function calculateCoverage($agent, $type, array $optionalArgs = []) + { + $request = new CalculateCoverageRequest(); + $requestParamHeaders = []; + $request->setAgent($agent); + $request->setType($type); + $requestParamHeaders['agent'] = $agent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CalculateCoverage', CalculateCoverageResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a test case for the given agent. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedParent = $testCasesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $testCase = new TestCase(); + * $response = $testCasesClient->createTestCase($formattedParent, $testCase); + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to create the test case for. + * Format: `projects//locations//agents/`. + * @param TestCase $testCase Required. The test case to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\TestCase + * + * @throws ApiException if the remote call fails + */ + public function createTestCase($parent, $testCase, array $optionalArgs = []) + { + $request = new CreateTestCaseRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTestCase($testCase); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateTestCase', TestCase::class, $optionalArgs, $request)->wait(); + } + + /** + * Exports the test cases under the agent to a Cloud Storage bucket or a local + * file. Filter can be applied to export a subset of test cases. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [ExportTestCasesMetadata][google.cloud.dialogflow.cx.v3.ExportTestCasesMetadata] + * - `response`: + * [ExportTestCasesResponse][google.cloud.dialogflow.cx.v3.ExportTestCasesResponse] + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedParent = $testCasesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $operationResponse = $testCasesClient->exportTestCases($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $testCasesClient->exportTestCases($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $testCasesClient->resumeOperation($operationName, 'exportTestCases'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent where to export test cases from. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $gcsUri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI to + * export the test cases to. The format of this URI must be + * `gs:///`. If unspecified, the serialized test + * cases is returned inline. + * + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type int $dataFormat + * The data format of the exported test cases. If not specified, `BLOB` is + * assumed. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\ExportTestCasesRequest\DataFormat} + * @type string $filter + * The filter expression used to filter exported test cases, see + * [API Filtering](https://aip.dev/160). The expression is case insensitive + * and supports the following syntax: + * + * name = [OR name = ] ... + * + * For example: + * + * * "name = t1 OR name = t2" matches the test case with the exact resource + * name "t1" or "t2". + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function exportTestCases($parent, array $optionalArgs = []) + { + $request = new ExportTestCasesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['gcsUri'])) { + $request->setGcsUri($optionalArgs['gcsUri']); + } + + if (isset($optionalArgs['dataFormat'])) { + $request->setDataFormat($optionalArgs['dataFormat']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportTestCases', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Gets a test case. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedName = $testCasesClient->testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]'); + * $response = $testCasesClient->getTestCase($formattedName); + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the testcase. + * Format: `projects//locations//agents//testCases/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\TestCase + * + * @throws ApiException if the remote call fails + */ + public function getTestCase($name, array $optionalArgs = []) + { + $request = new GetTestCaseRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTestCase', TestCase::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets a test case result. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedName = $testCasesClient->testCaseResultName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]', '[RESULT]'); + * $response = $testCasesClient->getTestCaseResult($formattedName); + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the testcase. + * Format: `projects//locations//agents//testCases//results/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\TestCaseResult + * + * @throws ApiException if the remote call fails + */ + public function getTestCaseResult($name, array $optionalArgs = []) + { + $request = new GetTestCaseResultRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTestCaseResult', TestCaseResult::class, $optionalArgs, $request)->wait(); + } + + /** + * Imports the test cases from a Cloud Storage bucket or a local file. It + * always creates new test cases and won't overwrite any existing ones. The + * provided ID in the imported test case is neglected. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [ImportTestCasesMetadata][google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata] + * - `response`: + * [ImportTestCasesResponse][google.cloud.dialogflow.cx.v3.ImportTestCasesResponse] + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedParent = $testCasesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $operationResponse = $testCasesClient->importTestCases($formattedParent); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $testCasesClient->importTestCases($formattedParent); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $testCasesClient->resumeOperation($operationName, 'importTestCases'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to import test cases to. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $gcsUri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import test cases from. The format of this URI must be + * `gs:///`. + * + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type string $content + * Uncompressed raw byte content for test cases. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function importTestCases($parent, array $optionalArgs = []) + { + $request = new ImportTestCasesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['gcsUri'])) { + $request->setGcsUri($optionalArgs['gcsUri']); + } + + if (isset($optionalArgs['content'])) { + $request->setContent($optionalArgs['content']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ImportTestCases', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Fetches the list of run results for the given test case. A maximum of 100 + * results are kept for each test case. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedParent = $testCasesClient->testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]'); + * // Iterate over pages of elements + * $pagedResponse = $testCasesClient->listTestCaseResults($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $testCasesClient->listTestCaseResults($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $parent Required. The test case to list results for. + * Format: `projects//locations//agents// + * testCases/`. Specify a `-` as a wildcard for TestCase ID to + * list results across multiple test cases. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $filter + * The filter expression used to filter test case results. See + * [API Filtering](https://aip.dev/160). + * + * The expression is case insensitive. Only 'AND' is supported for logical + * operators. The supported syntax is listed below in detail: + * + * [AND ] ... + * [AND latest] + * + * The supported fields and operators are: + * field operator + * `environment` `=`, `IN` (Use value `draft` for draft environment) + * `test_time` `>`, `<` + * + * `latest` only returns the latest test result in all results for each test + * case. + * + * Examples: + * * "environment=draft AND latest" matches the latest test result for each + * test case in the draft environment. + * * "environment IN (e1,e2)" matches any test case results with an + * environment resource name of either "e1" or "e2". + * * "test_time > 1602540713" matches any test case results with test time + * later than a unix timestamp in seconds 1602540713. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTestCaseResults($parent, array $optionalArgs = []) + { + $request = new ListTestCaseResultsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTestCaseResults', $optionalArgs, ListTestCaseResultsResponse::class, $request); + } + + /** + * Fetches a list of test cases for a given agent. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedParent = $testCasesClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * // Iterate over pages of elements + * $pagedResponse = $testCasesClient->listTestCases($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $testCasesClient->listTestCases($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to list all pages for. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type int $view + * Specifies whether response should include all fields or just the metadata. + * For allowed values, use constants defined on {@see \Google\Cloud\Dialogflow\Cx\V3\ListTestCasesRequest\TestCaseView} + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTestCases($parent, array $optionalArgs = []) + { + $request = new ListTestCasesRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['view'])) { + $request->setView($optionalArgs['view']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTestCases', $optionalArgs, ListTestCasesResponse::class, $request); + } + + /** + * Kicks off a test case run. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [RunTestCaseMetadata][google.cloud.dialogflow.cx.v3.RunTestCaseMetadata] + * - `response`: + * [RunTestCaseResponse][google.cloud.dialogflow.cx.v3.RunTestCaseResponse] + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $formattedName = $testCasesClient->testCaseName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TEST_CASE]'); + * $operationResponse = $testCasesClient->runTestCase($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $testCasesClient->runTestCase($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $testCasesClient->resumeOperation($operationName, 'runTestCase'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param string $name Required. Format of test case name to run: `projects//locations/ /agents//testCases/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $environment + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function runTestCase($name, array $optionalArgs = []) + { + $request = new RunTestCaseRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['environment'])) { + $request->setEnvironment($optionalArgs['environment']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('RunTestCase', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified test case. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $testCase = new TestCase(); + * $updateMask = new FieldMask(); + * $response = $testCasesClient->updateTestCase($testCase, $updateMask); + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param TestCase $testCase Required. The test case to update. + * @param FieldMask $updateMask Required. The mask to specify which fields should be updated. The + * [`creationTime`][google.cloud.dialogflow.cx.v3.TestCase.creation_time] and + * [`lastTestResult`][google.cloud.dialogflow.cx.v3.TestCase.last_test_result] + * cannot be updated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\TestCase + * + * @throws ApiException if the remote call fails + */ + public function updateTestCase($testCase, $updateMask, array $optionalArgs = []) + { + $request = new UpdateTestCaseRequest(); + $requestParamHeaders = []; + $request->setTestCase($testCase); + $request->setUpdateMask($updateMask); + $requestParamHeaders['test_case.name'] = $testCase->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateTestCase', TestCase::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * $response = $testCasesClient->getLocation(); + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $testCasesClient = new TestCasesClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $testCasesClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $testCasesClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $testCasesClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/TransitionRouteGroupsGapicClient.php b/DialogflowCx/src/V3/Gapic/TransitionRouteGroupsGapicClient.php new file mode 100644 index 000000000000..b270cafb3f8b --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/TransitionRouteGroupsGapicClient.php @@ -0,0 +1,966 @@ +flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $transitionRouteGroup = new TransitionRouteGroup(); + * $response = $transitionRouteGroupsClient->createTransitionRouteGroup($formattedParent, $transitionRouteGroup); + * } finally { + * $transitionRouteGroupsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class TransitionRouteGroupsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.TransitionRouteGroups'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $flowNameTemplate; + + private static $intentNameTemplate; + + private static $pageNameTemplate; + + private static $projectLocationAgentFlowTransitionRouteGroupNameTemplate; + + private static $projectLocationAgentTransitionRouteGroupNameTemplate; + + private static $transitionRouteGroupNameTemplate; + + private static $webhookNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/transition_route_groups_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/transition_route_groups_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/transition_route_groups_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/transition_route_groups_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getFlowNameTemplate() + { + if (self::$flowNameTemplate == null) { + self::$flowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}'); + } + + return self::$flowNameTemplate; + } + + private static function getIntentNameTemplate() + { + if (self::$intentNameTemplate == null) { + self::$intentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/intents/{intent}'); + } + + return self::$intentNameTemplate; + } + + private static function getPageNameTemplate() + { + if (self::$pageNameTemplate == null) { + self::$pageNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}'); + } + + return self::$pageNameTemplate; + } + + private static function getProjectLocationAgentFlowTransitionRouteGroupNameTemplate() + { + if (self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate == null) { + self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$projectLocationAgentFlowTransitionRouteGroupNameTemplate; + } + + private static function getProjectLocationAgentTransitionRouteGroupNameTemplate() + { + if (self::$projectLocationAgentTransitionRouteGroupNameTemplate == null) { + self::$projectLocationAgentTransitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$projectLocationAgentTransitionRouteGroupNameTemplate; + } + + private static function getTransitionRouteGroupNameTemplate() + { + if (self::$transitionRouteGroupNameTemplate == null) { + self::$transitionRouteGroupNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}'); + } + + return self::$transitionRouteGroupNameTemplate; + } + + private static function getWebhookNameTemplate() + { + if (self::$webhookNameTemplate == null) { + self::$webhookNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}'); + } + + return self::$webhookNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'flow' => self::getFlowNameTemplate(), + 'intent' => self::getIntentNameTemplate(), + 'page' => self::getPageNameTemplate(), + 'projectLocationAgentFlowTransitionRouteGroup' => self::getProjectLocationAgentFlowTransitionRouteGroupNameTemplate(), + 'projectLocationAgentTransitionRouteGroup' => self::getProjectLocationAgentTransitionRouteGroupNameTemplate(), + 'transitionRouteGroup' => self::getTransitionRouteGroupNameTemplate(), + 'webhook' => self::getWebhookNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a flow + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow resource. + */ + public static function flowName($project, $location, $agent, $flow) + { + return self::getFlowNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a intent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $intent + * + * @return string The formatted intent resource. + */ + public static function intentName($project, $location, $agent, $intent) + { + return self::getIntentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'intent' => $intent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a page + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $page + * + * @return string The formatted page resource. + */ + public static function pageName($project, $location, $agent, $flow, $page) + { + return self::getPageNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'page' => $page, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_flow_transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $transitionRouteGroup + * + * @return string The formatted project_location_agent_flow_transition_route_group resource. + */ + public static function projectLocationAgentFlowTransitionRouteGroupName($project, $location, $agent, $flow, $transitionRouteGroup) + { + return self::getProjectLocationAgentFlowTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_agent_transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $transitionRouteGroup + * + * @return string The formatted project_location_agent_transition_route_group resource. + */ + public static function projectLocationAgentTransitionRouteGroupName($project, $location, $agent, $transitionRouteGroup) + { + return self::getProjectLocationAgentTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * transition_route_group resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $transitionRouteGroup + * + * @return string The formatted transition_route_group resource. + */ + public static function transitionRouteGroupName($project, $location, $agent, $flow, $transitionRouteGroup) + { + return self::getTransitionRouteGroupNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'transition_route_group' => $transitionRouteGroup, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a webhook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $webhook + * + * @return string The formatted webhook resource. + */ + public static function webhookName($project, $location, $agent, $webhook) + { + return self::getWebhookNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'webhook' => $webhook, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} + * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} + * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} + * - projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group} + * - transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} + * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates an + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * in the specified flow. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + * try { + * $formattedParent = $transitionRouteGroupsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $transitionRouteGroup = new TransitionRouteGroup(); + * $response = $transitionRouteGroupsClient->createTransitionRouteGroup($formattedParent, $transitionRouteGroup); + * } finally { + * $transitionRouteGroupsClient->close(); + * } + * ``` + * + * @param string $parent Required. The flow to create an + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * for. Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/` + * for agent-level groups. + * @param TransitionRouteGroup $transitionRouteGroup Required. The transition route group to create. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language of the following fields in `TransitionRouteGroup`: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup + * + * @throws ApiException if the remote call fails + */ + public function createTransitionRouteGroup($parent, $transitionRouteGroup, array $optionalArgs = []) + { + $request = new CreateTransitionRouteGroupRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setTransitionRouteGroup($transitionRouteGroup); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateTransitionRouteGroup', TransitionRouteGroup::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + * try { + * $formattedName = $transitionRouteGroupsClient->transitionRouteGroupName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[TRANSITION_ROUTE_GROUP]'); + * $transitionRouteGroupsClient->deleteTransitionRouteGroup($formattedName); + * } finally { + * $transitionRouteGroupsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * to delete. Format: `projects//locations//agents//flows//transitionRouteGroups/` or `projects//locations//agents//transitionRouteGroups/`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $force + * This field has no effect for transition route group that no page is using. + * If the transition route group is referenced by any page: + * + * * If `force` is set to false, an error will be returned with message + * indicating pages that reference the transition route group. + * * If `force` is set to true, Dialogflow will remove the transition route + * group, as well as any reference to it. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteTransitionRouteGroup($name, array $optionalArgs = []) + { + $request = new DeleteTransitionRouteGroupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteTransitionRouteGroup', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the specified + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. + * + * Sample code: + * ``` + * $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + * try { + * $formattedName = $transitionRouteGroupsClient->transitionRouteGroupName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[TRANSITION_ROUTE_GROUP]'); + * $response = $transitionRouteGroupsClient->getTransitionRouteGroup($formattedName); + * } finally { + * $transitionRouteGroupsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. + * Format: `projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to retrieve the transition route group for. The following + * fields are language dependent: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup + * + * @throws ApiException if the remote call fails + */ + public function getTransitionRouteGroup($name, array $optionalArgs = []) + { + $request = new GetTransitionRouteGroupRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetTransitionRouteGroup', TransitionRouteGroup::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all transition route groups in the specified flow. + * + * Sample code: + * ``` + * $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + * try { + * $formattedParent = $transitionRouteGroupsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * // Iterate over pages of elements + * $pagedResponse = $transitionRouteGroupsClient->listTransitionRouteGroups($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $transitionRouteGroupsClient->listTransitionRouteGroups($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $transitionRouteGroupsClient->close(); + * } + * ``` + * + * @param string $parent Required. The flow to list all transition route groups for. + * Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type string $languageCode + * The language to list transition route groups for. The following fields are + * language dependent: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listTransitionRouteGroups($parent, array $optionalArgs = []) + { + $request = new ListTransitionRouteGroupsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListTransitionRouteGroups', $optionalArgs, ListTransitionRouteGroupsResponse::class, $request); + } + + /** + * Updates the specified + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. + * + * Note: You should always train a flow prior to sending it queries. See the + * [training + * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). + * + * Sample code: + * ``` + * $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + * try { + * $transitionRouteGroup = new TransitionRouteGroup(); + * $response = $transitionRouteGroupsClient->updateTransitionRouteGroup($transitionRouteGroup); + * } finally { + * $transitionRouteGroupsClient->close(); + * } + * ``` + * + * @param TransitionRouteGroup $transitionRouteGroup Required. The transition route group to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The mask to control which fields get updated. + * @type string $languageCode + * The language of the following fields in `TransitionRouteGroup`: + * + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup + * + * @throws ApiException if the remote call fails + */ + public function updateTransitionRouteGroup($transitionRouteGroup, array $optionalArgs = []) + { + $request = new UpdateTransitionRouteGroupRequest(); + $requestParamHeaders = []; + $request->setTransitionRouteGroup($transitionRouteGroup); + $requestParamHeaders['transition_route_group.name'] = $transitionRouteGroup->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateTransitionRouteGroup', TransitionRouteGroup::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + * try { + * $response = $transitionRouteGroupsClient->getLocation(); + * } finally { + * $transitionRouteGroupsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $transitionRouteGroupsClient = new TransitionRouteGroupsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $transitionRouteGroupsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $transitionRouteGroupsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $transitionRouteGroupsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/VersionsGapicClient.php b/DialogflowCx/src/V3/Gapic/VersionsGapicClient.php new file mode 100644 index 000000000000..cbdfe2d8d42c --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/VersionsGapicClient.php @@ -0,0 +1,870 @@ +versionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[VERSION]'); + * $formattedTargetVersion = $versionsClient->versionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[VERSION]'); + * $response = $versionsClient->compareVersions($formattedBaseVersion, $formattedTargetVersion); + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class VersionsGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Versions'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $flowNameTemplate; + + private static $versionNameTemplate; + + private static $pathTemplateMap; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/versions_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/versions_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/versions_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/versions_rest_client_config.php', + ], + ], + ]; + } + + private static function getFlowNameTemplate() + { + if (self::$flowNameTemplate == null) { + self::$flowNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}'); + } + + return self::$flowNameTemplate; + } + + private static function getVersionNameTemplate() + { + if (self::$versionNameTemplate == null) { + self::$versionNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}'); + } + + return self::$versionNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'flow' => self::getFlowNameTemplate(), + 'version' => self::getVersionNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a flow + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow resource. + */ + public static function flowName($project, $location, $agent, $flow) + { + return self::getFlowNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a version + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * @param string $version + * + * @return string The formatted version resource. + */ + public static function versionName($project, $location, $agent, $flow, $version) + { + return self::getVersionNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + 'version' => $version, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} + * - version: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) ? $this->descriptors[$methodName]['longRunning'] : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** + * Compares the specified base version with target version. + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * $formattedBaseVersion = $versionsClient->versionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[VERSION]'); + * $formattedTargetVersion = $versionsClient->versionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[VERSION]'); + * $response = $versionsClient->compareVersions($formattedBaseVersion, $formattedTargetVersion); + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param string $baseVersion Required. Name of the base flow version to compare with the target version. + * Use version ID `0` to indicate the draft version of the specified flow. + * + * Format: `projects//locations//agents/ + * /flows//versions/`. + * @param string $targetVersion Required. Name of the target flow version to compare with the + * base version. Use version ID `0` to indicate the draft version of the + * specified flow. Format: `projects//locations//agents//flows//versions/`. + * @param array $optionalArgs { + * Optional. + * + * @type string $languageCode + * The language to compare the flow versions for. + * + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/docs/reference/language) are + * supported. Note: languages must be enabled in the agent before they can be + * used. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\CompareVersionsResponse + * + * @throws ApiException if the remote call fails + */ + public function compareVersions($baseVersion, $targetVersion, array $optionalArgs = []) + { + $request = new CompareVersionsRequest(); + $requestParamHeaders = []; + $request->setBaseVersion($baseVersion); + $request->setTargetVersion($targetVersion); + $requestParamHeaders['base_version'] = $baseVersion; + if (isset($optionalArgs['languageCode'])) { + $request->setLanguageCode($optionalArgs['languageCode']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CompareVersions', CompareVersionsResponse::class, $optionalArgs, $request)->wait(); + } + + /** + * Creates a [Version][google.cloud.dialogflow.cx.v3.Version] in the specified + * [Flow][google.cloud.dialogflow.cx.v3.Flow]. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: + * [CreateVersionOperationMetadata][google.cloud.dialogflow.cx.v3.CreateVersionOperationMetadata] + * - `response`: [Version][google.cloud.dialogflow.cx.v3.Version] + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * $formattedParent = $versionsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * $version = new Version(); + * $operationResponse = $versionsClient->createVersion($formattedParent, $version); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * $result = $operationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $versionsClient->createVersion($formattedParent, $version); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $versionsClient->resumeOperation($operationName, 'createVersion'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param string $parent Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to create an + * [Version][google.cloud.dialogflow.cx.v3.Version] for. Format: + * `projects//locations//agents//flows/`. + * @param Version $version Required. The version to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function createVersion($parent, $version, array $optionalArgs = []) + { + $request = new CreateVersionRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setVersion($version); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('CreateVersion', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Deletes the specified [Version][google.cloud.dialogflow.cx.v3.Version]. + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * $formattedName = $versionsClient->versionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[VERSION]'); + * $versionsClient->deleteVersion($formattedName); + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version] + * to delete. Format: `projects//locations//agents//flows//versions/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteVersion($name, array $optionalArgs = []) + { + $request = new DeleteVersionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteVersion', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the specified [Version][google.cloud.dialogflow.cx.v3.Version]. + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * $formattedName = $versionsClient->versionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[VERSION]'); + * $response = $versionsClient->getVersion($formattedName); + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Version + * + * @throws ApiException if the remote call fails + */ + public function getVersion($name, array $optionalArgs = []) + { + $request = new GetVersionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetVersion', Version::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all versions in the specified + * [Flow][google.cloud.dialogflow.cx.v3.Flow]. + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * $formattedParent = $versionsClient->flowName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]'); + * // Iterate over pages of elements + * $pagedResponse = $versionsClient->listVersions($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $versionsClient->listVersions($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param string $parent Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all + * versions for. Format: `projects//locations//agents//flows/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listVersions($parent, array $optionalArgs = []) + { + $request = new ListVersionsRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListVersions', $optionalArgs, ListVersionsResponse::class, $request); + } + + /** + * Loads resources in the specified version to the draft flow. + * + * This method is a [long-running + * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). + * The returned `Operation` type has the following method-specific fields: + * + * - `metadata`: An empty [Struct + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct) + * - `response`: An [Empty + * message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty) + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * $formattedName = $versionsClient->versionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[FLOW]', '[VERSION]'); + * $operationResponse = $versionsClient->loadVersion($formattedName); + * $operationResponse->pollUntilComplete(); + * if ($operationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $operationResponse->getError(); + * // handleError($error) + * } + * // Alternatively: + * // start the operation, keep the operation name, and resume later + * $operationResponse = $versionsClient->loadVersion($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $versionsClient->resumeOperation($operationName, 'loadVersion'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * // operation succeeded and returns no value + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param string $name Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded + * to draft flow. Format: `projects//locations//agents//flows//versions/`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $allowOverrideAgentResources + * This field is used to prevent accidental overwrite of other agent + * resources, which can potentially impact other flow's behavior. If + * `allow_override_agent_resources` is false, conflicted agent-level resources + * will not be overridden (i.e. intents, entities, webhooks). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function loadVersion($name, array $optionalArgs = []) + { + $request = new LoadVersionRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['allowOverrideAgentResources'])) { + $request->setAllowOverrideAgentResources($optionalArgs['allowOverrideAgentResources']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('LoadVersion', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + + /** + * Updates the specified [Version][google.cloud.dialogflow.cx.v3.Version]. + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * $version = new Version(); + * $updateMask = new FieldMask(); + * $response = $versionsClient->updateVersion($version, $updateMask); + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param Version $version Required. The version to update. + * @param FieldMask $updateMask Required. The mask to control which fields get updated. Currently only + * `description` and `display_name` can be updated. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Version + * + * @throws ApiException if the remote call fails + */ + public function updateVersion($version, $updateMask, array $optionalArgs = []) + { + $request = new UpdateVersionRequest(); + $requestParamHeaders = []; + $request->setVersion($version); + $request->setUpdateMask($updateMask); + $requestParamHeaders['version.name'] = $version->getName(); + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateVersion', Version::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * $response = $versionsClient->getLocation(); + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $versionsClient = new VersionsClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $versionsClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $versionsClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $versionsClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/Gapic/WebhooksGapicClient.php b/DialogflowCx/src/V3/Gapic/WebhooksGapicClient.php new file mode 100644 index 000000000000..1e907e592253 --- /dev/null +++ b/DialogflowCx/src/V3/Gapic/WebhooksGapicClient.php @@ -0,0 +1,697 @@ +agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $webhook = new Webhook(); + * $response = $webhooksClient->createWebhook($formattedParent, $webhook); + * } finally { + * $webhooksClient->close(); + * } + * ``` + * + * Many parameters require resource names to be formatted in a particular way. To + * assist with these names, this class includes a format method for each type of + * name, and additionally a parseName method to extract the individual identifiers + * contained within formatted names that are returned by the API. + */ +class WebhooksGapicClient +{ + use GapicClientTrait; + + /** The name of the service. */ + const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Webhooks'; + + /** The default address of the service. */ + const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The default port of the service. */ + const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static $agentNameTemplate; + + private static $serviceNameTemplate; + + private static $webhookNameTemplate; + + private static $pathTemplateMap; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/webhooks_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/webhooks_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/webhooks_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/webhooks_rest_client_config.php', + ], + ], + ]; + } + + private static function getAgentNameTemplate() + { + if (self::$agentNameTemplate == null) { + self::$agentNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}'); + } + + return self::$agentNameTemplate; + } + + private static function getServiceNameTemplate() + { + if (self::$serviceNameTemplate == null) { + self::$serviceNameTemplate = new PathTemplate('projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}'); + } + + return self::$serviceNameTemplate; + } + + private static function getWebhookNameTemplate() + { + if (self::$webhookNameTemplate == null) { + self::$webhookNameTemplate = new PathTemplate('projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}'); + } + + return self::$webhookNameTemplate; + } + + private static function getPathTemplateMap() + { + if (self::$pathTemplateMap == null) { + self::$pathTemplateMap = [ + 'agent' => self::getAgentNameTemplate(), + 'service' => self::getServiceNameTemplate(), + 'webhook' => self::getWebhookNameTemplate(), + ]; + } + + return self::$pathTemplateMap; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName($project, $location, $agent) + { + return self::getAgentNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $namespace + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName($project, $location, $namespace, $service) + { + return self::getServiceNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'namespace' => $namespace, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a webhook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $webhook + * + * @return string The formatted webhook resource. + */ + public static function webhookName($project, $location, $agent, $webhook) + { + return self::getWebhookNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'webhook' => $webhook, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - service: projects/{project}/locations/{location}/namespaces/{namespace}/services/{service} + * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName($formattedName, $template = null) + { + $templateMap = self::getPathTemplateMap(); + if ($template) { + if (!isset($templateMap[$template])) { + throw new ValidationException("Template name $template does not exist"); + } + + return $templateMap[$template]->match($formattedName); + } + + foreach ($templateMap as $templateName => $pathTemplate) { + try { + return $pathTemplate->match($formattedName); + } catch (ValidationException $ex) { + // Swallow the exception to continue trying other path templates + } + } + + throw new ValidationException("Input did not match any known format. Input: $formattedName"); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** + * Creates a webhook in the specified agent. + * + * Sample code: + * ``` + * $webhooksClient = new WebhooksClient(); + * try { + * $formattedParent = $webhooksClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * $webhook = new Webhook(); + * $response = $webhooksClient->createWebhook($formattedParent, $webhook); + * } finally { + * $webhooksClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to create a webhook for. + * Format: `projects//locations//agents/`. + * @param Webhook $webhook Required. The webhook to create. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Webhook + * + * @throws ApiException if the remote call fails + */ + public function createWebhook($parent, $webhook, array $optionalArgs = []) + { + $request = new CreateWebhookRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $request->setWebhook($webhook); + $requestParamHeaders['parent'] = $parent; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('CreateWebhook', Webhook::class, $optionalArgs, $request)->wait(); + } + + /** + * Deletes the specified webhook. + * + * Sample code: + * ``` + * $webhooksClient = new WebhooksClient(); + * try { + * $formattedName = $webhooksClient->webhookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[WEBHOOK]'); + * $webhooksClient->deleteWebhook($formattedName); + * } finally { + * $webhooksClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the webhook to delete. + * Format: `projects//locations//agents//webhooks/`. + * @param array $optionalArgs { + * Optional. + * + * @type bool $force + * This field has no effect for webhook not being used. + * For webhooks that are used by pages/flows/transition route groups: + * + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the webhook, as well + * as any references to the webhook (i.e. + * [Webhook][google.cloud.dialogflow.cx.v3.Fulfillment.webhook] and + * [tag][google.cloud.dialogflow.cx.v3.Fulfillment.tag]in fulfillments that + * point to this webhook will be removed). + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException if the remote call fails + */ + public function deleteWebhook($name, array $optionalArgs = []) + { + $request = new DeleteWebhookRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['force'])) { + $request->setForce($optionalArgs['force']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('DeleteWebhook', GPBEmpty::class, $optionalArgs, $request)->wait(); + } + + /** + * Retrieves the specified webhook. + * + * Sample code: + * ``` + * $webhooksClient = new WebhooksClient(); + * try { + * $formattedName = $webhooksClient->webhookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[WEBHOOK]'); + * $response = $webhooksClient->getWebhook($formattedName); + * } finally { + * $webhooksClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the webhook. + * Format: `projects//locations//agents//webhooks/`. + * @param array $optionalArgs { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Webhook + * + * @throws ApiException if the remote call fails + */ + public function getWebhook($name, array $optionalArgs = []) + { + $request = new GetWebhookRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetWebhook', Webhook::class, $optionalArgs, $request)->wait(); + } + + /** + * Returns the list of all webhooks in the specified agent. + * + * Sample code: + * ``` + * $webhooksClient = new WebhooksClient(); + * try { + * $formattedParent = $webhooksClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + * // Iterate over pages of elements + * $pagedResponse = $webhooksClient->listWebhooks($formattedParent); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $webhooksClient->listWebhooks($formattedParent); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $webhooksClient->close(); + * } + * ``` + * + * @param string $parent Required. The agent to list all webhooks for. + * Format: `projects//locations//agents/`. + * @param array $optionalArgs { + * Optional. + * + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listWebhooks($parent, array $optionalArgs = []) + { + $request = new ListWebhooksRequest(); + $requestParamHeaders = []; + $request->setParent($parent); + $requestParamHeaders['parent'] = $parent; + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListWebhooks', $optionalArgs, ListWebhooksResponse::class, $request); + } + + /** + * Updates the specified webhook. + * + * Sample code: + * ``` + * $webhooksClient = new WebhooksClient(); + * try { + * $webhook = new Webhook(); + * $response = $webhooksClient->updateWebhook($webhook); + * } finally { + * $webhooksClient->close(); + * } + * ``` + * + * @param Webhook $webhook Required. The webhook to update. + * @param array $optionalArgs { + * Optional. + * + * @type FieldMask $updateMask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Dialogflow\Cx\V3\Webhook + * + * @throws ApiException if the remote call fails + */ + public function updateWebhook($webhook, array $optionalArgs = []) + { + $request = new UpdateWebhookRequest(); + $requestParamHeaders = []; + $request->setWebhook($webhook); + $requestParamHeaders['webhook.name'] = $webhook->getName(); + if (isset($optionalArgs['updateMask'])) { + $request->setUpdateMask($optionalArgs['updateMask']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('UpdateWebhook', Webhook::class, $optionalArgs, $request)->wait(); + } + + /** + * Gets information about a location. + * + * Sample code: + * ``` + * $webhooksClient = new WebhooksClient(); + * try { + * $response = $webhooksClient->getLocation(); + * } finally { + * $webhooksClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * Resource name for the location. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\Cloud\Location\Location + * + * @throws ApiException if the remote call fails + */ + public function getLocation(array $optionalArgs = []) + { + $request = new GetLocationRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startCall('GetLocation', Location::class, $optionalArgs, $request, Call::UNARY_CALL, 'google.cloud.location.Locations')->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * Sample code: + * ``` + * $webhooksClient = new WebhooksClient(); + * try { + * // Iterate over pages of elements + * $pagedResponse = $webhooksClient->listLocations(); + * foreach ($pagedResponse->iteratePages() as $page) { + * foreach ($page as $element) { + * // doSomethingWith($element); + * } + * } + * // Alternatively: + * // Iterate through all elements + * $pagedResponse = $webhooksClient->listLocations(); + * foreach ($pagedResponse->iterateAllElements() as $element) { + * // doSomethingWith($element); + * } + * } finally { + * $webhooksClient->close(); + * } + * ``` + * + * @param array $optionalArgs { + * Optional. + * + * @type string $name + * The resource that owns the locations collection, if applicable. + * @type string $filter + * The standard list filter. + * @type int $pageSize + * The maximum number of resources contained in the underlying API + * response. The API may return fewer values in a page, even if + * there are additional values to be retrieved. + * @type string $pageToken + * A page token is used to specify a page of values to be returned. + * If no page token is specified (the default), the first page + * of values will be returned. Any page token used here must have + * been generated by a previous call to the API. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\PagedListResponse + * + * @throws ApiException if the remote call fails + */ + public function listLocations(array $optionalArgs = []) + { + $request = new ListLocationsRequest(); + $requestParamHeaders = []; + if (isset($optionalArgs['name'])) { + $request->setName($optionalArgs['name']); + $requestParamHeaders['name'] = $optionalArgs['name']; + } + + if (isset($optionalArgs['filter'])) { + $request->setFilter($optionalArgs['filter']); + } + + if (isset($optionalArgs['pageSize'])) { + $request->setPageSize($optionalArgs['pageSize']); + } + + if (isset($optionalArgs['pageToken'])) { + $request->setPageToken($optionalArgs['pageToken']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->getPagedListResponse('ListLocations', $optionalArgs, ListLocationsResponse::class, $request, 'google.cloud.location.Locations'); + } +} diff --git a/DialogflowCx/src/V3/GcsDestination.php b/DialogflowCx/src/V3/GcsDestination.php new file mode 100644 index 000000000000..b69c376b01ac --- /dev/null +++ b/DialogflowCx/src/V3/GcsDestination.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.GcsDestination + */ +class GcsDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Google Cloud Storage URI for the exported objects. A URI is + * of the form: `gs://bucket/object-name-or-prefix` Whether a full object + * name, or just a prefix, its usage depends on the Dialogflow operation. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * Required. The Google Cloud Storage URI for the exported objects. A URI is + * of the form: `gs://bucket/object-name-or-prefix` Whether a full object + * name, or just a prefix, its usage depends on the Dialogflow operation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Gcs::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Google Cloud Storage URI for the exported objects. A URI is + * of the form: `gs://bucket/object-name-or-prefix` Whether a full object + * name, or just a prefix, its usage depends on the Dialogflow operation. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * Required. The Google Cloud Storage URI for the exported objects. A URI is + * of the form: `gs://bucket/object-name-or-prefix` Whether a full object + * name, or just a prefix, its usage depends on the Dialogflow operation. + * + * Generated from protobuf field string uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GenerativeSettings.php b/DialogflowCx/src/V3/GenerativeSettings.php new file mode 100644 index 000000000000..42f34da2a054 --- /dev/null +++ b/DialogflowCx/src/V3/GenerativeSettings.php @@ -0,0 +1,237 @@ +google.cloud.dialogflow.cx.v3.GenerativeSettings + */ +class GenerativeSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Format: `projects//locations//agents//generativeSettings`. + * + * Generated from protobuf field string name = 5; + */ + protected $name = ''; + /** + * Settings for Generative Fallback. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings fallback_settings = 1; + */ + protected $fallback_settings = null; + /** + * Settings for Generative Safety. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings generative_safety_settings = 3; + */ + protected $generative_safety_settings = null; + /** + * Settings for knowledge connector. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GenerativeSettings.KnowledgeConnectorSettings knowledge_connector_settings = 7; + */ + protected $knowledge_connector_settings = null; + /** + * Language for this settings. + * + * Generated from protobuf field string language_code = 4; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Format: `projects//locations//agents//generativeSettings`. + * @type \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\FallbackSettings $fallback_settings + * Settings for Generative Fallback. + * @type \Google\Cloud\Dialogflow\Cx\V3\SafetySettings $generative_safety_settings + * Settings for Generative Safety. + * @type \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\KnowledgeConnectorSettings $knowledge_connector_settings + * Settings for knowledge connector. + * @type string $language_code + * Language for this settings. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings::initOnce(); + parent::__construct($data); + } + + /** + * Format: `projects//locations//agents//generativeSettings`. + * + * Generated from protobuf field string name = 5; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Format: `projects//locations//agents//generativeSettings`. + * + * Generated from protobuf field string name = 5; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Settings for Generative Fallback. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings fallback_settings = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\FallbackSettings|null + */ + public function getFallbackSettings() + { + return $this->fallback_settings; + } + + public function hasFallbackSettings() + { + return isset($this->fallback_settings); + } + + public function clearFallbackSettings() + { + unset($this->fallback_settings); + } + + /** + * Settings for Generative Fallback. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings fallback_settings = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\FallbackSettings $var + * @return $this + */ + public function setFallbackSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\FallbackSettings::class); + $this->fallback_settings = $var; + + return $this; + } + + /** + * Settings for Generative Safety. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings generative_safety_settings = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\SafetySettings|null + */ + public function getGenerativeSafetySettings() + { + return $this->generative_safety_settings; + } + + public function hasGenerativeSafetySettings() + { + return isset($this->generative_safety_settings); + } + + public function clearGenerativeSafetySettings() + { + unset($this->generative_safety_settings); + } + + /** + * Settings for Generative Safety. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings generative_safety_settings = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\SafetySettings $var + * @return $this + */ + public function setGenerativeSafetySettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings::class); + $this->generative_safety_settings = $var; + + return $this; + } + + /** + * Settings for knowledge connector. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GenerativeSettings.KnowledgeConnectorSettings knowledge_connector_settings = 7; + * @return \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\KnowledgeConnectorSettings|null + */ + public function getKnowledgeConnectorSettings() + { + return $this->knowledge_connector_settings; + } + + public function hasKnowledgeConnectorSettings() + { + return isset($this->knowledge_connector_settings); + } + + public function clearKnowledgeConnectorSettings() + { + unset($this->knowledge_connector_settings); + } + + /** + * Settings for knowledge connector. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.GenerativeSettings.KnowledgeConnectorSettings knowledge_connector_settings = 7; + * @param \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\KnowledgeConnectorSettings $var + * @return $this + */ + public function setKnowledgeConnectorSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\KnowledgeConnectorSettings::class); + $this->knowledge_connector_settings = $var; + + return $this; + } + + /** + * Language for this settings. + * + * Generated from protobuf field string language_code = 4; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Language for this settings. + * + * Generated from protobuf field string language_code = 4; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GenerativeSettings/FallbackSettings.php b/DialogflowCx/src/V3/GenerativeSettings/FallbackSettings.php new file mode 100644 index 000000000000..73fc894afb97 --- /dev/null +++ b/DialogflowCx/src/V3/GenerativeSettings/FallbackSettings.php @@ -0,0 +1,106 @@ +google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings + */ +class FallbackSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Display name of the selected prompt. + * + * Generated from protobuf field string selected_prompt = 3; + */ + protected $selected_prompt = ''; + /** + * Stored prompts that can be selected, for example default templates like + * "conservative" or "chatty", or user defined ones. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings.PromptTemplate prompt_templates = 4; + */ + private $prompt_templates; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $selected_prompt + * Display name of the selected prompt. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\FallbackSettings\PromptTemplate>|\Google\Protobuf\Internal\RepeatedField $prompt_templates + * Stored prompts that can be selected, for example default templates like + * "conservative" or "chatty", or user defined ones. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings::initOnce(); + parent::__construct($data); + } + + /** + * Display name of the selected prompt. + * + * Generated from protobuf field string selected_prompt = 3; + * @return string + */ + public function getSelectedPrompt() + { + return $this->selected_prompt; + } + + /** + * Display name of the selected prompt. + * + * Generated from protobuf field string selected_prompt = 3; + * @param string $var + * @return $this + */ + public function setSelectedPrompt($var) + { + GPBUtil::checkString($var, True); + $this->selected_prompt = $var; + + return $this; + } + + /** + * Stored prompts that can be selected, for example default templates like + * "conservative" or "chatty", or user defined ones. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings.PromptTemplate prompt_templates = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPromptTemplates() + { + return $this->prompt_templates; + } + + /** + * Stored prompts that can be selected, for example default templates like + * "conservative" or "chatty", or user defined ones. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings.PromptTemplate prompt_templates = 4; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\FallbackSettings\PromptTemplate>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPromptTemplates($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings\FallbackSettings\PromptTemplate::class); + $this->prompt_templates = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/GenerativeSettings/FallbackSettings/PromptTemplate.php b/DialogflowCx/src/V3/GenerativeSettings/FallbackSettings/PromptTemplate.php new file mode 100644 index 000000000000..f08fbf510180 --- /dev/null +++ b/DialogflowCx/src/V3/GenerativeSettings/FallbackSettings/PromptTemplate.php @@ -0,0 +1,148 @@ +google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings.PromptTemplate + */ +class PromptTemplate extends \Google\Protobuf\Internal\Message +{ + /** + * Prompt name. + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + /** + * Prompt text that is sent to a LLM on no-match default, placeholders are + * filled downstream. For example: "Here is a conversation $conversation, + * a response is: " + * + * Generated from protobuf field string prompt_text = 2; + */ + protected $prompt_text = ''; + /** + * If the flag is true, the prompt is frozen and cannot be modified by + * users. + * + * Generated from protobuf field bool frozen = 3; + */ + protected $frozen = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * Prompt name. + * @type string $prompt_text + * Prompt text that is sent to a LLM on no-match default, placeholders are + * filled downstream. For example: "Here is a conversation $conversation, + * a response is: " + * @type bool $frozen + * If the flag is true, the prompt is frozen and cannot be modified by + * users. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings::initOnce(); + parent::__construct($data); + } + + /** + * Prompt name. + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Prompt name. + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Prompt text that is sent to a LLM on no-match default, placeholders are + * filled downstream. For example: "Here is a conversation $conversation, + * a response is: " + * + * Generated from protobuf field string prompt_text = 2; + * @return string + */ + public function getPromptText() + { + return $this->prompt_text; + } + + /** + * Prompt text that is sent to a LLM on no-match default, placeholders are + * filled downstream. For example: "Here is a conversation $conversation, + * a response is: " + * + * Generated from protobuf field string prompt_text = 2; + * @param string $var + * @return $this + */ + public function setPromptText($var) + { + GPBUtil::checkString($var, True); + $this->prompt_text = $var; + + return $this; + } + + /** + * If the flag is true, the prompt is frozen and cannot be modified by + * users. + * + * Generated from protobuf field bool frozen = 3; + * @return bool + */ + public function getFrozen() + { + return $this->frozen; + } + + /** + * If the flag is true, the prompt is frozen and cannot be modified by + * users. + * + * Generated from protobuf field bool frozen = 3; + * @param bool $var + * @return $this + */ + public function setFrozen($var) + { + GPBUtil::checkBool($var); + $this->frozen = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/GenerativeSettings/KnowledgeConnectorSettings.php b/DialogflowCx/src/V3/GenerativeSettings/KnowledgeConnectorSettings.php new file mode 100644 index 000000000000..b2a96a40c9df --- /dev/null +++ b/DialogflowCx/src/V3/GenerativeSettings/KnowledgeConnectorSettings.php @@ -0,0 +1,223 @@ +. You are a helpful and verbose at + * , . Your task is to help humans on + * ". + * + * Generated from protobuf message google.cloud.dialogflow.cx.v3.GenerativeSettings.KnowledgeConnectorSettings + */ +class KnowledgeConnectorSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Name of the company, organization or other entity that the agent + * represents. Used for knowledge connector LLM prompt and for knowledge + * search. + * + * Generated from protobuf field string business = 1; + */ + protected $business = ''; + /** + * Name of the virtual agent. Used for LLM prompt. Can be left empty. + * + * Generated from protobuf field string agent = 2; + */ + protected $agent = ''; + /** + * Identity of the agent, e.g. "virtual agent", "AI assistant". + * + * Generated from protobuf field string agent_identity = 3; + */ + protected $agent_identity = ''; + /** + * Company description, used for LLM prompt, e.g. "a family company selling + * freshly roasted coffee beans". + * + * Generated from protobuf field string business_description = 4; + */ + protected $business_description = ''; + /** + * Agent scope, e.g. "Example company website", "internal Example + * company website for employees", "manual of car owner". + * + * Generated from protobuf field string agent_scope = 5; + */ + protected $agent_scope = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $business + * Name of the company, organization or other entity that the agent + * represents. Used for knowledge connector LLM prompt and for knowledge + * search. + * @type string $agent + * Name of the virtual agent. Used for LLM prompt. Can be left empty. + * @type string $agent_identity + * Identity of the agent, e.g. "virtual agent", "AI assistant". + * @type string $business_description + * Company description, used for LLM prompt, e.g. "a family company selling + * freshly roasted coffee beans". + * @type string $agent_scope + * Agent scope, e.g. "Example company website", "internal Example + * company website for employees", "manual of car owner". + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings::initOnce(); + parent::__construct($data); + } + + /** + * Name of the company, organization or other entity that the agent + * represents. Used for knowledge connector LLM prompt and for knowledge + * search. + * + * Generated from protobuf field string business = 1; + * @return string + */ + public function getBusiness() + { + return $this->business; + } + + /** + * Name of the company, organization or other entity that the agent + * represents. Used for knowledge connector LLM prompt and for knowledge + * search. + * + * Generated from protobuf field string business = 1; + * @param string $var + * @return $this + */ + public function setBusiness($var) + { + GPBUtil::checkString($var, True); + $this->business = $var; + + return $this; + } + + /** + * Name of the virtual agent. Used for LLM prompt. Can be left empty. + * + * Generated from protobuf field string agent = 2; + * @return string + */ + public function getAgent() + { + return $this->agent; + } + + /** + * Name of the virtual agent. Used for LLM prompt. Can be left empty. + * + * Generated from protobuf field string agent = 2; + * @param string $var + * @return $this + */ + public function setAgent($var) + { + GPBUtil::checkString($var, True); + $this->agent = $var; + + return $this; + } + + /** + * Identity of the agent, e.g. "virtual agent", "AI assistant". + * + * Generated from protobuf field string agent_identity = 3; + * @return string + */ + public function getAgentIdentity() + { + return $this->agent_identity; + } + + /** + * Identity of the agent, e.g. "virtual agent", "AI assistant". + * + * Generated from protobuf field string agent_identity = 3; + * @param string $var + * @return $this + */ + public function setAgentIdentity($var) + { + GPBUtil::checkString($var, True); + $this->agent_identity = $var; + + return $this; + } + + /** + * Company description, used for LLM prompt, e.g. "a family company selling + * freshly roasted coffee beans". + * + * Generated from protobuf field string business_description = 4; + * @return string + */ + public function getBusinessDescription() + { + return $this->business_description; + } + + /** + * Company description, used for LLM prompt, e.g. "a family company selling + * freshly roasted coffee beans". + * + * Generated from protobuf field string business_description = 4; + * @param string $var + * @return $this + */ + public function setBusinessDescription($var) + { + GPBUtil::checkString($var, True); + $this->business_description = $var; + + return $this; + } + + /** + * Agent scope, e.g. "Example company website", "internal Example + * company website for employees", "manual of car owner". + * + * Generated from protobuf field string agent_scope = 5; + * @return string + */ + public function getAgentScope() + { + return $this->agent_scope; + } + + /** + * Agent scope, e.g. "Example company website", "internal Example + * company website for employees", "manual of car owner". + * + * Generated from protobuf field string agent_scope = 5; + * @param string $var + * @return $this + */ + public function setAgentScope($var) + { + GPBUtil::checkString($var, True); + $this->agent_scope = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/GetAgentRequest.php b/DialogflowCx/src/V3/GetAgentRequest.php new file mode 100644 index 000000000000..b3403f6be4de --- /dev/null +++ b/DialogflowCx/src/V3/GetAgentRequest.php @@ -0,0 +1,72 @@ +google.cloud.dialogflow.cx.v3.GetAgentRequest + */ +class GetAgentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the agent. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the agent. + * Format: `projects//locations//agents/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the agent. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the agent. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetAgentValidationResultRequest.php b/DialogflowCx/src/V3/GetAgentValidationResultRequest.php new file mode 100644 index 000000000000..5a4cec331dd4 --- /dev/null +++ b/DialogflowCx/src/V3/GetAgentValidationResultRequest.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.GetAgentValidationResultRequest + */ +class GetAgentValidationResultRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent name. + * Format: `projects//locations//agents//validationResult`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If not specified, the agent's default language is used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The agent name. + * Format: `projects//locations//agents//validationResult`. + * @type string $language_code + * If not specified, the agent's default language is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent name. + * Format: `projects//locations//agents//validationResult`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The agent name. + * Format: `projects//locations//agents//validationResult`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * If not specified, the agent's default language is used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * If not specified, the agent's default language is used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetChangelogRequest.php b/DialogflowCx/src/V3/GetChangelogRequest.php new file mode 100644 index 000000000000..05ac7173c574 --- /dev/null +++ b/DialogflowCx/src/V3/GetChangelogRequest.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.GetChangelogRequest + */ +class GetChangelogRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the changelog to get. + * Format: `projects//locations//agents//changelogs/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the changelog to get. + * Format: `projects//locations//agents//changelogs/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Changelog::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the changelog to get. + * Format: `projects//locations//agents//changelogs/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the changelog to get. + * Format: `projects//locations//agents//changelogs/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetDeploymentRequest.php b/DialogflowCx/src/V3/GetDeploymentRequest.php new file mode 100644 index 000000000000..8227fcaed3f6 --- /dev/null +++ b/DialogflowCx/src/V3/GetDeploymentRequest.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.GetDeploymentRequest + */ +class GetDeploymentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents//environments//deployments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents//environments//deployments/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Deployment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents//environments//deployments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the + * [Deployment][google.cloud.dialogflow.cx.v3.Deployment]. Format: + * `projects//locations//agents//environments//deployments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetEntityTypeRequest.php b/DialogflowCx/src/V3/GetEntityTypeRequest.php new file mode 100644 index 000000000000..2f3cfaebbda1 --- /dev/null +++ b/DialogflowCx/src/V3/GetEntityTypeRequest.php @@ -0,0 +1,146 @@ +google.cloud.dialogflow.cx.v3.GetEntityTypeRequest + */ +class GetEntityTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the entity type. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The language to retrieve the entity type for. The following fields are + * language dependent: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the entity type. + * Format: `projects//locations//agents//entityTypes/`. + * @type string $language_code + * The language to retrieve the entity type for. The following fields are + * language dependent: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\EntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the entity type. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the entity type. + * Format: `projects//locations//agents//entityTypes/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The language to retrieve the entity type for. The following fields are + * language dependent: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to retrieve the entity type for. The following fields are + * language dependent: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetEnvironmentRequest.php b/DialogflowCx/src/V3/GetEnvironmentRequest.php new file mode 100644 index 000000000000..df7211d60f1f --- /dev/null +++ b/DialogflowCx/src/V3/GetEnvironmentRequest.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.GetEnvironmentRequest + */ +class GetEnvironmentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetExperimentRequest.php b/DialogflowCx/src/V3/GetExperimentRequest.php new file mode 100644 index 000000000000..c6c8b88b6599 --- /dev/null +++ b/DialogflowCx/src/V3/GetExperimentRequest.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.GetExperimentRequest + */ +class GetExperimentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments//experiments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments//experiments/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments//experiments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the + * [Environment][google.cloud.dialogflow.cx.v3.Environment]. Format: + * `projects//locations//agents//environments//experiments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetFlowRequest.php b/DialogflowCx/src/V3/GetFlowRequest.php new file mode 100644 index 000000000000..9b5933ae5c94 --- /dev/null +++ b/DialogflowCx/src/V3/GetFlowRequest.php @@ -0,0 +1,150 @@ +google.cloud.dialogflow.cx.v3.GetFlowRequest + */ +class GetFlowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the flow to get. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The language to retrieve the flow for. The following fields are language + * dependent: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the flow to get. + * Format: `projects//locations//agents//flows/`. + * @type string $language_code + * The language to retrieve the flow for. The following fields are language + * dependent: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the flow to get. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the flow to get. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The language to retrieve the flow for. The following fields are language + * dependent: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to retrieve the flow for. The following fields are language + * dependent: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetFlowValidationResultRequest.php b/DialogflowCx/src/V3/GetFlowValidationResultRequest.php new file mode 100644 index 000000000000..6133074f6d64 --- /dev/null +++ b/DialogflowCx/src/V3/GetFlowValidationResultRequest.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.GetFlowValidationResultRequest + */ +class GetFlowValidationResultRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The flow name. + * Format: `projects//locations//agents//flows//validationResult`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * If not specified, the agent's default language is used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The flow name. + * Format: `projects//locations//agents//flows//validationResult`. + * @type string $language_code + * If not specified, the agent's default language is used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Required. The flow name. + * Format: `projects//locations//agents//flows//validationResult`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The flow name. + * Format: `projects//locations//agents//flows//validationResult`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * If not specified, the agent's default language is used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * If not specified, the agent's default language is used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetGenerativeSettingsRequest.php b/DialogflowCx/src/V3/GetGenerativeSettingsRequest.php new file mode 100644 index 000000000000..3b88efb8dcaf --- /dev/null +++ b/DialogflowCx/src/V3/GetGenerativeSettingsRequest.php @@ -0,0 +1,107 @@ +google.cloud.dialogflow.cx.v3.GetGenerativeSettingsRequest + */ +class GetGenerativeSettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format: `projects//locations//agents//generativeSettings`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. Language code of the generative settings. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Format: `projects//locations//agents//generativeSettings`. + * @type string $language_code + * Required. Language code of the generative settings. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format: `projects//locations//agents//generativeSettings`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Format: `projects//locations//agents//generativeSettings`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Language code of the generative settings. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Required. Language code of the generative settings. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetIntentRequest.php b/DialogflowCx/src/V3/GetIntentRequest.php new file mode 100644 index 000000000000..910aa8747d02 --- /dev/null +++ b/DialogflowCx/src/V3/GetIntentRequest.php @@ -0,0 +1,138 @@ +google.cloud.dialogflow.cx.v3.GetIntentRequest + */ +class GetIntentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the intent. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The language to retrieve the intent for. The following fields are language + * dependent: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the intent. + * Format: `projects//locations//agents//intents/`. + * @type string $language_code + * The language to retrieve the intent for. The following fields are language + * dependent: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the intent. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the intent. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The language to retrieve the intent for. The following fields are language + * dependent: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to retrieve the intent for. The following fields are language + * dependent: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetPageRequest.php b/DialogflowCx/src/V3/GetPageRequest.php new file mode 100644 index 000000000000..09be79d5cec5 --- /dev/null +++ b/DialogflowCx/src/V3/GetPageRequest.php @@ -0,0 +1,182 @@ +google.cloud.dialogflow.cx.v3.GetPageRequest + */ +class GetPageRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the page. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The language to retrieve the page for. The following fields are language + * dependent: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the page. + * Format: `projects//locations//agents//flows//pages/`. + * @type string $language_code + * The language to retrieve the page for. The following fields are language + * dependent: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the page. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the page. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The language to retrieve the page for. The following fields are language + * dependent: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to retrieve the page for. The following fields are language + * dependent: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetSecuritySettingsRequest.php b/DialogflowCx/src/V3/GetSecuritySettingsRequest.php new file mode 100644 index 000000000000..cd16bce60627 --- /dev/null +++ b/DialogflowCx/src/V3/GetSecuritySettingsRequest.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.GetSecuritySettingsRequest + */ +class GetSecuritySettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the settings. + * Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the settings. + * Format: `projects//locations//securitySettings/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SecuritySettings::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the settings. + * Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the settings. + * Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetSessionEntityTypeRequest.php b/DialogflowCx/src/V3/GetSessionEntityTypeRequest.php new file mode 100644 index 000000000000..0fdfa6cf8af4 --- /dev/null +++ b/DialogflowCx/src/V3/GetSessionEntityTypeRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.GetSessionEntityTypeRequest + */ +class GetSessionEntityTypeRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the session entity type. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the session entity type. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the session entity type. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the session entity type. + * Format: `projects//locations//agents//sessions//entityTypes/` or + * `projects//locations//agents//environments//sessions//entityTypes/`. If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetTestCaseRequest.php b/DialogflowCx/src/V3/GetTestCaseRequest.php new file mode 100644 index 000000000000..aa6fdab0a56f --- /dev/null +++ b/DialogflowCx/src/V3/GetTestCaseRequest.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.GetTestCaseRequest + */ +class GetTestCaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the testcase. + * Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the testcase. + * Format: `projects//locations//agents//testCases/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the testcase. + * Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the testcase. + * Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetTestCaseResultRequest.php b/DialogflowCx/src/V3/GetTestCaseResultRequest.php new file mode 100644 index 000000000000..3cb600e1cf19 --- /dev/null +++ b/DialogflowCx/src/V3/GetTestCaseResultRequest.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.GetTestCaseResultRequest + */ +class GetTestCaseResultRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the testcase. + * Format: `projects//locations//agents//testCases//results/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the testcase. + * Format: `projects//locations//agents//testCases//results/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the testcase. + * Format: `projects//locations//agents//testCases//results/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the testcase. + * Format: `projects//locations//agents//testCases//results/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetTransitionRouteGroupRequest.php b/DialogflowCx/src/V3/GetTransitionRouteGroupRequest.php new file mode 100644 index 000000000000..79bd221f1f48 --- /dev/null +++ b/DialogflowCx/src/V3/GetTransitionRouteGroupRequest.php @@ -0,0 +1,158 @@ +google.cloud.dialogflow.cx.v3.GetTransitionRouteGroupRequest + */ +class GetTransitionRouteGroupRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. + * Format: `projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The language to retrieve the transition route group for. The following + * fields are language dependent: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. + * Format: `projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/`. + * @type string $language_code + * The language to retrieve the transition route group for. The following + * fields are language dependent: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. + * Format: `projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the + * [TransitionRouteGroup][google.cloud.dialogflow.cx.v3.TransitionRouteGroup]. + * Format: `projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The language to retrieve the transition route group for. The following + * fields are language dependent: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to retrieve the transition route group for. The following + * fields are language dependent: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetVersionRequest.php b/DialogflowCx/src/V3/GetVersionRequest.php new file mode 100644 index 000000000000..997e5fa480ac --- /dev/null +++ b/DialogflowCx/src/V3/GetVersionRequest.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.GetVersionRequest + */ +class GetVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the [Version][google.cloud.dialogflow.cx.v3.Version]. + * Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetWebhookRequest.php b/DialogflowCx/src/V3/GetWebhookRequest.php new file mode 100644 index 000000000000..10f4e0ee8c67 --- /dev/null +++ b/DialogflowCx/src/V3/GetWebhookRequest.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.GetWebhookRequest + */ +class GetWebhookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the webhook. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the webhook. + * Format: `projects//locations//agents//webhooks/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the webhook. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the webhook. + * Format: `projects//locations//agents//webhooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ImportFlowRequest.php b/DialogflowCx/src/V3/ImportFlowRequest.php new file mode 100644 index 000000000000..08ebb9fb9b2b --- /dev/null +++ b/DialogflowCx/src/V3/ImportFlowRequest.php @@ -0,0 +1,250 @@ +google.cloud.dialogflow.cx.v3.ImportFlowRequest + */ +class ImportFlowRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to import the flow into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Flow import mode. If not specified, `KEEP` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportFlowRequest.ImportOption import_option = 4; + */ + protected $import_option = 0; + /** + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.FlowImportStrategy flow_import_strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $flow_import_strategy = null; + protected $flow; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to import the flow into. + * Format: `projects//locations//agents/`. + * @type string $flow_uri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import flow from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type string $flow_content + * Uncompressed raw byte content for flow. + * @type int $import_option + * Flow import mode. If not specified, `KEEP` is assumed. + * @type \Google\Cloud\Dialogflow\Cx\V3\FlowImportStrategy $flow_import_strategy + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to import the flow into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to import the flow into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import flow from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string flow_uri = 2; + * @return string + */ + public function getFlowUri() + { + return $this->readOneof(2); + } + + public function hasFlowUri() + { + return $this->hasOneof(2); + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import flow from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string flow_uri = 2; + * @param string $var + * @return $this + */ + public function setFlowUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Uncompressed raw byte content for flow. + * + * Generated from protobuf field bytes flow_content = 3; + * @return string + */ + public function getFlowContent() + { + return $this->readOneof(3); + } + + public function hasFlowContent() + { + return $this->hasOneof(3); + } + + /** + * Uncompressed raw byte content for flow. + * + * Generated from protobuf field bytes flow_content = 3; + * @param string $var + * @return $this + */ + public function setFlowContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Flow import mode. If not specified, `KEEP` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportFlowRequest.ImportOption import_option = 4; + * @return int + */ + public function getImportOption() + { + return $this->import_option; + } + + /** + * Flow import mode. If not specified, `KEEP` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportFlowRequest.ImportOption import_option = 4; + * @param int $var + * @return $this + */ + public function setImportOption($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ImportFlowRequest\ImportOption::class); + $this->import_option = $var; + + return $this; + } + + /** + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.FlowImportStrategy flow_import_strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\FlowImportStrategy|null + */ + public function getFlowImportStrategy() + { + return $this->flow_import_strategy; + } + + public function hasFlowImportStrategy() + { + return isset($this->flow_import_strategy); + } + + public function clearFlowImportStrategy() + { + unset($this->flow_import_strategy); + } + + /** + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.FlowImportStrategy flow_import_strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\FlowImportStrategy $var + * @return $this + */ + public function setFlowImportStrategy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\FlowImportStrategy::class); + $this->flow_import_strategy = $var; + + return $this; + } + + /** + * @return string + */ + public function getFlow() + { + return $this->whichOneof("flow"); + } + +} + diff --git a/DialogflowCx/src/V3/ImportFlowRequest/ImportOption.php b/DialogflowCx/src/V3/ImportFlowRequest/ImportOption.php new file mode 100644 index 000000000000..2c1eba91a9cb --- /dev/null +++ b/DialogflowCx/src/V3/ImportFlowRequest/ImportOption.php @@ -0,0 +1,66 @@ +google.cloud.dialogflow.cx.v3.ImportFlowRequest.ImportOption + */ +class ImportOption +{ + /** + * Unspecified. Treated as `KEEP`. + * + * Generated from protobuf enum IMPORT_OPTION_UNSPECIFIED = 0; + */ + const IMPORT_OPTION_UNSPECIFIED = 0; + /** + * Always respect settings in exported flow content. It may cause a + * import failure if some settings (e.g. custom NLU) are not supported in + * the agent to import into. + * + * Generated from protobuf enum KEEP = 1; + */ + const KEEP = 1; + /** + * Fallback to default settings if some settings are not supported in the + * agent to import into. E.g. Standard NLU will be used if custom NLU is + * not available. + * + * Generated from protobuf enum FALLBACK = 2; + */ + const FALLBACK = 2; + + private static $valueToName = [ + self::IMPORT_OPTION_UNSPECIFIED => 'IMPORT_OPTION_UNSPECIFIED', + self::KEEP => 'KEEP', + self::FALLBACK => 'FALLBACK', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ImportFlowResponse.php b/DialogflowCx/src/V3/ImportFlowResponse.php new file mode 100644 index 000000000000..f49941b0b297 --- /dev/null +++ b/DialogflowCx/src/V3/ImportFlowResponse.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.ImportFlowResponse + */ +class ImportFlowResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the new flow. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.resource_reference) = { + */ + protected $flow = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $flow + * The unique identifier of the new flow. + * Format: `projects//locations//agents//flows/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the new flow. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getFlow() + { + return $this->flow; + } + + /** + * The unique identifier of the new flow. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setFlow($var) + { + GPBUtil::checkString($var, True); + $this->flow = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ImportIntentsMetadata.php b/DialogflowCx/src/V3/ImportIntentsMetadata.php new file mode 100644 index 000000000000..fcc991e68182 --- /dev/null +++ b/DialogflowCx/src/V3/ImportIntentsMetadata.php @@ -0,0 +1,35 @@ +google.cloud.dialogflow.cx.v3.ImportIntentsMetadata + */ +class ImportIntentsMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + +} + diff --git a/DialogflowCx/src/V3/ImportIntentsRequest.php b/DialogflowCx/src/V3/ImportIntentsRequest.php new file mode 100644 index 000000000000..698bb1f29df6 --- /dev/null +++ b/DialogflowCx/src/V3/ImportIntentsRequest.php @@ -0,0 +1,202 @@ +google.cloud.dialogflow.cx.v3.ImportIntentsRequest + */ +class ImportIntentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to import the intents into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Merge option for importing intents. If not specified, `REJECT` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportIntentsRequest.MergeOption merge_option = 4; + */ + protected $merge_option = 0; + protected $intents; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to import the intents into. + * Format: `projects//locations//agents/`. + * @type string $intents_uri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import intents from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type \Google\Cloud\Dialogflow\Cx\V3\InlineSource $intents_content + * Uncompressed byte content of intents. + * @type int $merge_option + * Merge option for importing intents. If not specified, `REJECT` is assumed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to import the intents into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to import the intents into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import intents from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string intents_uri = 2; + * @return string + */ + public function getIntentsUri() + { + return $this->readOneof(2); + } + + public function hasIntentsUri() + { + return $this->hasOneof(2); + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import intents from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string intents_uri = 2; + * @param string $var + * @return $this + */ + public function setIntentsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Uncompressed byte content of intents. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InlineSource intents_content = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\InlineSource|null + */ + public function getIntentsContent() + { + return $this->readOneof(3); + } + + public function hasIntentsContent() + { + return $this->hasOneof(3); + } + + /** + * Uncompressed byte content of intents. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InlineSource intents_content = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\InlineSource $var + * @return $this + */ + public function setIntentsContent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\InlineSource::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Merge option for importing intents. If not specified, `REJECT` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportIntentsRequest.MergeOption merge_option = 4; + * @return int + */ + public function getMergeOption() + { + return $this->merge_option; + } + + /** + * Merge option for importing intents. If not specified, `REJECT` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportIntentsRequest.MergeOption merge_option = 4; + * @param int $var + * @return $this + */ + public function setMergeOption($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ImportIntentsRequest\MergeOption::class); + $this->merge_option = $var; + + return $this; + } + + /** + * @return string + */ + public function getIntents() + { + return $this->whichOneof("intents"); + } + +} + diff --git a/DialogflowCx/src/V3/ImportIntentsRequest/MergeOption.php b/DialogflowCx/src/V3/ImportIntentsRequest/MergeOption.php new file mode 100644 index 000000000000..6cf9cf4d34f3 --- /dev/null +++ b/DialogflowCx/src/V3/ImportIntentsRequest/MergeOption.php @@ -0,0 +1,98 @@ +google.cloud.dialogflow.cx.v3.ImportIntentsRequest.MergeOption + */ +class MergeOption +{ + /** + * Unspecified. Should not be used. + * + * Generated from protobuf enum MERGE_OPTION_UNSPECIFIED = 0; + */ + const MERGE_OPTION_UNSPECIFIED = 0; + /** + * DEPRECATED: Please use + * [REPORT_CONFLICT][ImportIntentsRequest.REPORT_CONFLICT] instead. + * Fail the request if there are intents whose display names conflict with + * the display names of intents in the agent. + * + * Generated from protobuf enum REJECT = 1 [deprecated = true]; + */ + const REJECT = 1; + /** + * Replace the original intent in the agent with the new intent when display + * name conflicts exist. + * + * Generated from protobuf enum REPLACE = 2; + */ + const REPLACE = 2; + /** + * Merge the original intent with the new intent when display name conflicts + * exist. + * + * Generated from protobuf enum MERGE = 3; + */ + const MERGE = 3; + /** + * Create new intents with new display names to differentiate them from the + * existing intents when display name conflicts exist. + * + * Generated from protobuf enum RENAME = 4; + */ + const RENAME = 4; + /** + * Report conflict information if display names conflict is detected. + * Otherwise, import intents. + * + * Generated from protobuf enum REPORT_CONFLICT = 5; + */ + const REPORT_CONFLICT = 5; + /** + * Keep the original intent and discard the conflicting new intent when + * display name conflicts exist. + * + * Generated from protobuf enum KEEP = 6; + */ + const KEEP = 6; + + private static $valueToName = [ + self::MERGE_OPTION_UNSPECIFIED => 'MERGE_OPTION_UNSPECIFIED', + self::REJECT => 'REJECT', + self::REPLACE => 'REPLACE', + self::MERGE => 'MERGE', + self::RENAME => 'RENAME', + self::REPORT_CONFLICT => 'REPORT_CONFLICT', + self::KEEP => 'KEEP', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ImportIntentsResponse.php b/DialogflowCx/src/V3/ImportIntentsResponse.php new file mode 100644 index 000000000000..c1db25e27b51 --- /dev/null +++ b/DialogflowCx/src/V3/ImportIntentsResponse.php @@ -0,0 +1,128 @@ +google.cloud.dialogflow.cx.v3.ImportIntentsResponse + */ +class ImportIntentsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the imported intents. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field repeated string intents = 1 [(.google.api.resource_reference) = { + */ + private $intents; + /** + * Info which resources have conflicts when + * [REPORT_CONFLICT][ImportIntentsResponse.REPORT_CONFLICT] merge_option is + * set in ImportIntentsRequest. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportIntentsResponse.ConflictingResources conflicting_resources = 2; + */ + protected $conflicting_resources = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $intents + * The unique identifier of the imported intents. + * Format: `projects//locations//agents//intents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\ImportIntentsResponse\ConflictingResources $conflicting_resources + * Info which resources have conflicts when + * [REPORT_CONFLICT][ImportIntentsResponse.REPORT_CONFLICT] merge_option is + * set in ImportIntentsRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the imported intents. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field repeated string intents = 1 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIntents() + { + return $this->intents; + } + + /** + * The unique identifier of the imported intents. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field repeated string intents = 1 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIntents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->intents = $arr; + + return $this; + } + + /** + * Info which resources have conflicts when + * [REPORT_CONFLICT][ImportIntentsResponse.REPORT_CONFLICT] merge_option is + * set in ImportIntentsRequest. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportIntentsResponse.ConflictingResources conflicting_resources = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\ImportIntentsResponse\ConflictingResources|null + */ + public function getConflictingResources() + { + return $this->conflicting_resources; + } + + public function hasConflictingResources() + { + return isset($this->conflicting_resources); + } + + public function clearConflictingResources() + { + unset($this->conflicting_resources); + } + + /** + * Info which resources have conflicts when + * [REPORT_CONFLICT][ImportIntentsResponse.REPORT_CONFLICT] merge_option is + * set in ImportIntentsRequest. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportIntentsResponse.ConflictingResources conflicting_resources = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\ImportIntentsResponse\ConflictingResources $var + * @return $this + */ + public function setConflictingResources($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ImportIntentsResponse\ConflictingResources::class); + $this->conflicting_resources = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ImportIntentsResponse/ConflictingResources.php b/DialogflowCx/src/V3/ImportIntentsResponse/ConflictingResources.php new file mode 100644 index 000000000000..bff13bdaa28c --- /dev/null +++ b/DialogflowCx/src/V3/ImportIntentsResponse/ConflictingResources.php @@ -0,0 +1,104 @@ +google.cloud.dialogflow.cx.v3.ImportIntentsResponse.ConflictingResources + */ +class ConflictingResources extends \Google\Protobuf\Internal\Message +{ + /** + * Display names of conflicting intents. + * + * Generated from protobuf field repeated string intent_display_names = 1; + */ + private $intent_display_names; + /** + * Display names of conflicting entities. + * + * Generated from protobuf field repeated string entity_display_names = 2; + */ + private $entity_display_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $intent_display_names + * Display names of conflicting intents. + * @type array|\Google\Protobuf\Internal\RepeatedField $entity_display_names + * Display names of conflicting entities. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Display names of conflicting intents. + * + * Generated from protobuf field repeated string intent_display_names = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIntentDisplayNames() + { + return $this->intent_display_names; + } + + /** + * Display names of conflicting intents. + * + * Generated from protobuf field repeated string intent_display_names = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIntentDisplayNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->intent_display_names = $arr; + + return $this; + } + + /** + * Display names of conflicting entities. + * + * Generated from protobuf field repeated string entity_display_names = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntityDisplayNames() + { + return $this->entity_display_names; + } + + /** + * Display names of conflicting entities. + * + * Generated from protobuf field repeated string entity_display_names = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntityDisplayNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->entity_display_names = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ImportStrategy.php b/DialogflowCx/src/V3/ImportStrategy.php new file mode 100644 index 000000000000..d14d8f01de64 --- /dev/null +++ b/DialogflowCx/src/V3/ImportStrategy.php @@ -0,0 +1,87 @@ +google.cloud.dialogflow.cx.v3.ImportStrategy + */ +class ImportStrategy +{ + /** + * Unspecified. Treated as 'CREATE_NEW'. + * + * Generated from protobuf enum IMPORT_STRATEGY_UNSPECIFIED = 0; + */ + const IMPORT_STRATEGY_UNSPECIFIED = 0; + /** + * Create a new resource with a numeric suffix appended to the end of the + * existing display name. + * + * Generated from protobuf enum IMPORT_STRATEGY_CREATE_NEW = 1; + */ + const IMPORT_STRATEGY_CREATE_NEW = 1; + /** + * Replace existing resource with incoming resource in the content to be + * imported. + * + * Generated from protobuf enum IMPORT_STRATEGY_REPLACE = 2; + */ + const IMPORT_STRATEGY_REPLACE = 2; + /** + * Keep existing resource and discard incoming resource in the content to be + * imported. + * + * Generated from protobuf enum IMPORT_STRATEGY_KEEP = 3; + */ + const IMPORT_STRATEGY_KEEP = 3; + /** + * Combine existing and incoming resources when a conflict is encountered. + * + * Generated from protobuf enum IMPORT_STRATEGY_MERGE = 4; + */ + const IMPORT_STRATEGY_MERGE = 4; + /** + * Throw error if a conflict is encountered. + * + * Generated from protobuf enum IMPORT_STRATEGY_THROW_ERROR = 5; + */ + const IMPORT_STRATEGY_THROW_ERROR = 5; + + private static $valueToName = [ + self::IMPORT_STRATEGY_UNSPECIFIED => 'IMPORT_STRATEGY_UNSPECIFIED', + self::IMPORT_STRATEGY_CREATE_NEW => 'IMPORT_STRATEGY_CREATE_NEW', + self::IMPORT_STRATEGY_REPLACE => 'IMPORT_STRATEGY_REPLACE', + self::IMPORT_STRATEGY_KEEP => 'IMPORT_STRATEGY_KEEP', + self::IMPORT_STRATEGY_MERGE => 'IMPORT_STRATEGY_MERGE', + self::IMPORT_STRATEGY_THROW_ERROR => 'IMPORT_STRATEGY_THROW_ERROR', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DialogflowCx/src/V3/ImportTestCasesMetadata.php b/DialogflowCx/src/V3/ImportTestCasesMetadata.php new file mode 100644 index 000000000000..5266a067f3d7 --- /dev/null +++ b/DialogflowCx/src/V3/ImportTestCasesMetadata.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.ImportTestCasesMetadata + */ +class ImportTestCasesMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Errors for failed test cases. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseError errors = 1; + */ + private $errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TestCaseError>|\Google\Protobuf\Internal\RepeatedField $errors + * Errors for failed test cases. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Errors for failed test cases. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseError errors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * Errors for failed test cases. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseError errors = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TestCaseError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TestCaseError::class); + $this->errors = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ImportTestCasesRequest.php b/DialogflowCx/src/V3/ImportTestCasesRequest.php new file mode 100644 index 000000000000..d247a33a50a3 --- /dev/null +++ b/DialogflowCx/src/V3/ImportTestCasesRequest.php @@ -0,0 +1,168 @@ +google.cloud.dialogflow.cx.v3.ImportTestCasesRequest + */ +class ImportTestCasesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to import test cases to. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to import test cases to. + * Format: `projects//locations//agents/`. + * @type string $gcs_uri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import test cases from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type string $content + * Uncompressed raw byte content for test cases. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to import test cases to. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to import test cases to. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import test cases from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string gcs_uri = 2; + * @return string + */ + public function getGcsUri() + { + return $this->readOneof(2); + } + + public function hasGcsUri() + { + return $this->hasOneof(2); + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to import test cases from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string gcs_uri = 2; + * @param string $var + * @return $this + */ + public function setGcsUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Uncompressed raw byte content for test cases. + * + * Generated from protobuf field bytes content = 3; + * @return string + */ + public function getContent() + { + return $this->readOneof(3); + } + + public function hasContent() + { + return $this->hasOneof(3); + } + + /** + * Uncompressed raw byte content for test cases. + * + * Generated from protobuf field bytes content = 3; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + diff --git a/DialogflowCx/src/V3/ImportTestCasesResponse.php b/DialogflowCx/src/V3/ImportTestCasesResponse.php new file mode 100644 index 000000000000..22692be05db2 --- /dev/null +++ b/DialogflowCx/src/V3/ImportTestCasesResponse.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.ImportTestCasesResponse + */ +class ImportTestCasesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifiers of the new test cases. + * Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field repeated string names = 1 [(.google.api.resource_reference) = { + */ + private $names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $names + * The unique identifiers of the new test cases. + * Format: `projects//locations//agents//testCases/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifiers of the new test cases. + * Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field repeated string names = 1 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNames() + { + return $this->names; + } + + /** + * The unique identifiers of the new test cases. + * Format: `projects//locations//agents//testCases/`. + * + * Generated from protobuf field repeated string names = 1 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->names = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/InlineDestination.php b/DialogflowCx/src/V3/InlineDestination.php new file mode 100644 index 000000000000..7934fa39203a --- /dev/null +++ b/DialogflowCx/src/V3/InlineDestination.php @@ -0,0 +1,72 @@ +google.cloud.dialogflow.cx.v3.InlineDestination + */ +class InlineDestination extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The uncompressed byte content for the objects. + * Only populated in responses. + * + * Generated from protobuf field bytes content = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * Output only. The uncompressed byte content for the objects. + * Only populated in responses. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Inline::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The uncompressed byte content for the objects. + * Only populated in responses. + * + * Generated from protobuf field bytes content = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Output only. The uncompressed byte content for the objects. + * Only populated in responses. + * + * Generated from protobuf field bytes content = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/InlineSource.php b/DialogflowCx/src/V3/InlineSource.php new file mode 100644 index 000000000000..b79064b06e18 --- /dev/null +++ b/DialogflowCx/src/V3/InlineSource.php @@ -0,0 +1,68 @@ +google.cloud.dialogflow.cx.v3.InlineSource + */ +class InlineSource extends \Google\Protobuf\Internal\Message +{ + /** + * The uncompressed byte content for the objects. + * + * Generated from protobuf field bytes content = 1; + */ + protected $content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * The uncompressed byte content for the objects. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Inline::initOnce(); + parent::__construct($data); + } + + /** + * The uncompressed byte content for the objects. + * + * Generated from protobuf field bytes content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * The uncompressed byte content for the objects. + * + * Generated from protobuf field bytes content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, False); + $this->content = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/InputAudioConfig.php b/DialogflowCx/src/V3/InputAudioConfig.php new file mode 100644 index 000000000000..7eb6ddfa3cc9 --- /dev/null +++ b/DialogflowCx/src/V3/InputAudioConfig.php @@ -0,0 +1,415 @@ +google.cloud.dialogflow.cx.v3.InputAudioConfig + */ +class InputAudioConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Audio encoding of the audio content to process. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_encoding = 0; + /** + * Sample rate (in Hertz) of the audio content sent in the query. + * Refer to + * [Cloud Speech API + * documentation](https://cloud.google.com/speech-to-text/docs/basics) for + * more details. + * + * Generated from protobuf field int32 sample_rate_hertz = 2; + */ + protected $sample_rate_hertz = 0; + /** + * Optional. If `true`, Dialogflow returns + * [SpeechWordInfo][google.cloud.dialogflow.cx.v3.SpeechWordInfo] in + * [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3.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. + * + * Generated from protobuf field bool enable_word_info = 13; + */ + protected $enable_word_info = false; + /** + * Optional. A list of strings containing words and phrases that the speech + * recognizer should recognize with higher likelihood. + * See [the Cloud Speech + * documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + * for more details. + * + * Generated from protobuf field repeated string phrase_hints = 4; + */ + private $phrase_hints; + /** + * Optional. 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](https://cloud.google.com/speech-to-text/docs/basics#select-model) + * for more details. + * If you specify a model, the following models typically have the best + * performance: + * - phone_call (best for Agent Assist and telephony) + * - latest_short (best for Dialogflow non-telephony) + * - command_and_search (best for very short utterances and commands) + * + * Generated from protobuf field string model = 7; + */ + protected $model = ''; + /** + * Optional. Which variant of the [Speech + * model][google.cloud.dialogflow.cx.v3.InputAudioConfig.model] to use. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SpeechModelVariant model_variant = 10; + */ + protected $model_variant = 0; + /** + * Optional. 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. + * + * Generated from protobuf field bool single_utterance = 8; + */ + protected $single_utterance = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $audio_encoding + * Required. Audio encoding of the audio content to process. + * @type int $sample_rate_hertz + * Sample rate (in Hertz) of the audio content sent in the query. + * Refer to + * [Cloud Speech API + * documentation](https://cloud.google.com/speech-to-text/docs/basics) for + * more details. + * @type bool $enable_word_info + * Optional. If `true`, Dialogflow returns + * [SpeechWordInfo][google.cloud.dialogflow.cx.v3.SpeechWordInfo] in + * [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3.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. + * @type array|\Google\Protobuf\Internal\RepeatedField $phrase_hints + * Optional. A list of strings containing words and phrases that the speech + * recognizer should recognize with higher likelihood. + * See [the Cloud Speech + * documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + * for more details. + * @type string $model + * Optional. 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](https://cloud.google.com/speech-to-text/docs/basics#select-model) + * for more details. + * If you specify a model, the following models typically have the best + * performance: + * - phone_call (best for Agent Assist and telephony) + * - latest_short (best for Dialogflow non-telephony) + * - command_and_search (best for very short utterances and commands) + * @type int $model_variant + * Optional. Which variant of the [Speech + * model][google.cloud.dialogflow.cx.v3.InputAudioConfig.model] to use. + * @type bool $single_utterance + * Optional. 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\AudioConfig::initOnce(); + parent::__construct($data); + } + + /** + * Required. Audio encoding of the audio content to process. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAudioEncoding() + { + return $this->audio_encoding; + } + + /** + * Required. Audio encoding of the audio content to process. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAudioEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\AudioEncoding::class); + $this->audio_encoding = $var; + + return $this; + } + + /** + * Sample rate (in Hertz) of the audio content sent in the query. + * Refer to + * [Cloud Speech API + * documentation](https://cloud.google.com/speech-to-text/docs/basics) for + * more details. + * + * Generated from protobuf field int32 sample_rate_hertz = 2; + * @return int + */ + public function getSampleRateHertz() + { + return $this->sample_rate_hertz; + } + + /** + * Sample rate (in Hertz) of the audio content sent in the query. + * Refer to + * [Cloud Speech API + * documentation](https://cloud.google.com/speech-to-text/docs/basics) for + * more details. + * + * Generated from protobuf field int32 sample_rate_hertz = 2; + * @param int $var + * @return $this + */ + public function setSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->sample_rate_hertz = $var; + + return $this; + } + + /** + * Optional. If `true`, Dialogflow returns + * [SpeechWordInfo][google.cloud.dialogflow.cx.v3.SpeechWordInfo] in + * [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3.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. + * + * Generated from protobuf field bool enable_word_info = 13; + * @return bool + */ + public function getEnableWordInfo() + { + return $this->enable_word_info; + } + + /** + * Optional. If `true`, Dialogflow returns + * [SpeechWordInfo][google.cloud.dialogflow.cx.v3.SpeechWordInfo] in + * [StreamingRecognitionResult][google.cloud.dialogflow.cx.v3.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. + * + * Generated from protobuf field bool enable_word_info = 13; + * @param bool $var + * @return $this + */ + public function setEnableWordInfo($var) + { + GPBUtil::checkBool($var); + $this->enable_word_info = $var; + + return $this; + } + + /** + * Optional. A list of strings containing words and phrases that the speech + * recognizer should recognize with higher likelihood. + * See [the Cloud Speech + * documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + * for more details. + * + * Generated from protobuf field repeated string phrase_hints = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPhraseHints() + { + return $this->phrase_hints; + } + + /** + * Optional. A list of strings containing words and phrases that the speech + * recognizer should recognize with higher likelihood. + * See [the Cloud Speech + * documentation](https://cloud.google.com/speech-to-text/docs/basics#phrase-hints) + * for more details. + * + * Generated from protobuf field repeated string phrase_hints = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPhraseHints($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->phrase_hints = $arr; + + return $this; + } + + /** + * Optional. 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](https://cloud.google.com/speech-to-text/docs/basics#select-model) + * for more details. + * If you specify a model, the following models typically have the best + * performance: + * - phone_call (best for Agent Assist and telephony) + * - latest_short (best for Dialogflow non-telephony) + * - command_and_search (best for very short utterances and commands) + * + * Generated from protobuf field string model = 7; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * Optional. 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](https://cloud.google.com/speech-to-text/docs/basics#select-model) + * for more details. + * If you specify a model, the following models typically have the best + * performance: + * - phone_call (best for Agent Assist and telephony) + * - latest_short (best for Dialogflow non-telephony) + * - command_and_search (best for very short utterances and commands) + * + * Generated from protobuf field string model = 7; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * Optional. Which variant of the [Speech + * model][google.cloud.dialogflow.cx.v3.InputAudioConfig.model] to use. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SpeechModelVariant model_variant = 10; + * @return int + */ + public function getModelVariant() + { + return $this->model_variant; + } + + /** + * Optional. Which variant of the [Speech + * model][google.cloud.dialogflow.cx.v3.InputAudioConfig.model] to use. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SpeechModelVariant model_variant = 10; + * @param int $var + * @return $this + */ + public function setModelVariant($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\SpeechModelVariant::class); + $this->model_variant = $var; + + return $this; + } + + /** + * Optional. 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. + * + * Generated from protobuf field bool single_utterance = 8; + * @return bool + */ + public function getSingleUtterance() + { + return $this->single_utterance; + } + + /** + * Optional. 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. + * + * Generated from protobuf field bool single_utterance = 8; + * @param bool $var + * @return $this + */ + public function setSingleUtterance($var) + { + GPBUtil::checkBool($var); + $this->single_utterance = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Intent.php b/DialogflowCx/src/V3/Intent.php new file mode 100644 index 000000000000..af2df524d860 --- /dev/null +++ b/DialogflowCx/src/V3/Intent.php @@ -0,0 +1,428 @@ +google.cloud.dialogflow.cx.v3.Intent + */ +class Intent extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the intent. + * Required for the + * [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3.Intents.UpdateIntent] + * method. + * [Intents.CreateIntent][google.cloud.dialogflow.cx.v3.Intents.CreateIntent] + * populates the name automatically. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the intent, unique within the agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * The collection of training phrases the agent is trained on to identify the + * intent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase training_phrases = 3; + */ + private $training_phrases; + /** + * The collection of parameters associated with the intent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.Parameter parameters = 4; + */ + private $parameters; + /** + * 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. + * + * Generated from protobuf field int32 priority = 5; + */ + protected $priority = 0; + /** + * Indicates whether this is a fallback intent. Currently only default + * fallback intent is allowed in the agent, which is added upon agent + * creation. + * Adding training phrases to fallback intent is useful in the case of + * requests that are mistakenly matched, since training phrases assigned to + * fallback intents act as negative examples that triggers no-match event. + * + * Generated from protobuf field bool is_fallback = 6; + */ + protected $is_fallback = false; + /** + * The key/value metadata to label an intent. Labels can contain + * lowercase letters, digits and the symbols '-' and '_'. International + * characters are allowed, including letters from unicase alphabets. Keys must + * start with a letter. Keys and values can be no longer than 63 characters + * and no more than 128 bytes. + * Prefix "sys-" is reserved for Dialogflow defined labels. Currently allowed + * Dialogflow defined labels include: + * * sys-head + * * sys-contextual + * The above labels do not require value. "sys-head" means the intent is a + * head intent. "sys.contextual" means the intent is a contextual intent. + * + * Generated from protobuf field map labels = 7; + */ + private $labels; + /** + * Human readable description for better understanding an intent like its + * scope, content, result etc. Maximum character limit: 140 characters. + * + * Generated from protobuf field string description = 8; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the intent. + * Required for the + * [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3.Intents.UpdateIntent] + * method. + * [Intents.CreateIntent][google.cloud.dialogflow.cx.v3.Intents.CreateIntent] + * populates the name automatically. + * Format: `projects//locations//agents//intents/`. + * @type string $display_name + * Required. The human-readable name of the intent, unique within the agent. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Intent\TrainingPhrase>|\Google\Protobuf\Internal\RepeatedField $training_phrases + * The collection of training phrases the agent is trained on to identify the + * intent. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Intent\Parameter>|\Google\Protobuf\Internal\RepeatedField $parameters + * The collection of parameters associated with the intent. + * @type int $priority + * 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. + * @type bool $is_fallback + * Indicates whether this is a fallback intent. Currently only default + * fallback intent is allowed in the agent, which is added upon agent + * creation. + * Adding training phrases to fallback intent is useful in the case of + * requests that are mistakenly matched, since training phrases assigned to + * fallback intents act as negative examples that triggers no-match event. + * @type array|\Google\Protobuf\Internal\MapField $labels + * The key/value metadata to label an intent. Labels can contain + * lowercase letters, digits and the symbols '-' and '_'. International + * characters are allowed, including letters from unicase alphabets. Keys must + * start with a letter. Keys and values can be no longer than 63 characters + * and no more than 128 bytes. + * Prefix "sys-" is reserved for Dialogflow defined labels. Currently allowed + * Dialogflow defined labels include: + * * sys-head + * * sys-contextual + * The above labels do not require value. "sys-head" means the intent is a + * head intent. "sys.contextual" means the intent is a contextual intent. + * @type string $description + * Human readable description for better understanding an intent like its + * scope, content, result etc. Maximum character limit: 140 characters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the intent. + * Required for the + * [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3.Intents.UpdateIntent] + * method. + * [Intents.CreateIntent][google.cloud.dialogflow.cx.v3.Intents.CreateIntent] + * populates the name automatically. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the intent. + * Required for the + * [Intents.UpdateIntent][google.cloud.dialogflow.cx.v3.Intents.UpdateIntent] + * method. + * [Intents.CreateIntent][google.cloud.dialogflow.cx.v3.Intents.CreateIntent] + * populates the name automatically. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the intent, unique within the agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the intent, unique within the agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The collection of training phrases the agent is trained on to identify the + * intent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase training_phrases = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTrainingPhrases() + { + return $this->training_phrases; + } + + /** + * The collection of training phrases the agent is trained on to identify the + * intent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase training_phrases = 3; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Intent\TrainingPhrase>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTrainingPhrases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Intent\TrainingPhrase::class); + $this->training_phrases = $arr; + + return $this; + } + + /** + * The collection of parameters associated with the intent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.Parameter parameters = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameters() + { + return $this->parameters; + } + + /** + * The collection of parameters associated with the intent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.Parameter parameters = 4; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Intent\Parameter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Intent\Parameter::class); + $this->parameters = $arr; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field int32 priority = 5; + * @return int + */ + public function getPriority() + { + return $this->priority; + } + + /** + * 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. + * + * Generated from protobuf field int32 priority = 5; + * @param int $var + * @return $this + */ + public function setPriority($var) + { + GPBUtil::checkInt32($var); + $this->priority = $var; + + return $this; + } + + /** + * Indicates whether this is a fallback intent. Currently only default + * fallback intent is allowed in the agent, which is added upon agent + * creation. + * Adding training phrases to fallback intent is useful in the case of + * requests that are mistakenly matched, since training phrases assigned to + * fallback intents act as negative examples that triggers no-match event. + * + * Generated from protobuf field bool is_fallback = 6; + * @return bool + */ + public function getIsFallback() + { + return $this->is_fallback; + } + + /** + * Indicates whether this is a fallback intent. Currently only default + * fallback intent is allowed in the agent, which is added upon agent + * creation. + * Adding training phrases to fallback intent is useful in the case of + * requests that are mistakenly matched, since training phrases assigned to + * fallback intents act as negative examples that triggers no-match event. + * + * Generated from protobuf field bool is_fallback = 6; + * @param bool $var + * @return $this + */ + public function setIsFallback($var) + { + GPBUtil::checkBool($var); + $this->is_fallback = $var; + + return $this; + } + + /** + * The key/value metadata to label an intent. Labels can contain + * lowercase letters, digits and the symbols '-' and '_'. International + * characters are allowed, including letters from unicase alphabets. Keys must + * start with a letter. Keys and values can be no longer than 63 characters + * and no more than 128 bytes. + * Prefix "sys-" is reserved for Dialogflow defined labels. Currently allowed + * Dialogflow defined labels include: + * * sys-head + * * sys-contextual + * The above labels do not require value. "sys-head" means the intent is a + * head intent. "sys.contextual" means the intent is a contextual intent. + * + * Generated from protobuf field map labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getLabels() + { + return $this->labels; + } + + /** + * The key/value metadata to label an intent. Labels can contain + * lowercase letters, digits and the symbols '-' and '_'. International + * characters are allowed, including letters from unicase alphabets. Keys must + * start with a letter. Keys and values can be no longer than 63 characters + * and no more than 128 bytes. + * Prefix "sys-" is reserved for Dialogflow defined labels. Currently allowed + * Dialogflow defined labels include: + * * sys-head + * * sys-contextual + * The above labels do not require value. "sys-head" means the intent is a + * head intent. "sys.contextual" means the intent is a contextual intent. + * + * Generated from protobuf field map labels = 7; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->labels = $arr; + + return $this; + } + + /** + * Human readable description for better understanding an intent like its + * scope, content, result etc. Maximum character limit: 140 characters. + * + * Generated from protobuf field string description = 8; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Human readable description for better understanding an intent like its + * scope, content, result etc. Maximum character limit: 140 characters. + * + * Generated from protobuf field string description = 8; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Intent/Parameter.php b/DialogflowCx/src/V3/Intent/Parameter.php new file mode 100644 index 000000000000..64d5747c9a57 --- /dev/null +++ b/DialogflowCx/src/V3/Intent/Parameter.php @@ -0,0 +1,222 @@ +google.cloud.dialogflow.cx.v3.Intent.Parameter + */ +class Parameter extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique identifier of the parameter. This field + * is used by [training + * phrases][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase] to annotate + * their [parts][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part]. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $id = ''; + /** + * Required. The entity type of the parameter. + * Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + * `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + * `projects//locations//agents//entityTypes/` for developer entity types. + * + * Generated from protobuf field string entity_type = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $entity_type = ''; + /** + * Indicates whether the parameter represents a list of values. + * + * Generated from protobuf field bool is_list = 3; + */ + protected $is_list = false; + /** + * Indicates whether the parameter content should be redacted in log. If + * redaction is enabled, the parameter content will be replaced by parameter + * name during logging. + * Note: the parameter content is subject to redaction if either parameter + * level redaction or [entity type level + * redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. + * + * Generated from protobuf field bool redact = 4; + */ + protected $redact = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * Required. The unique identifier of the parameter. This field + * is used by [training + * phrases][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase] to annotate + * their [parts][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part]. + * @type string $entity_type + * Required. The entity type of the parameter. + * Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + * `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + * `projects//locations//agents//entityTypes/` for developer entity types. + * @type bool $is_list + * Indicates whether the parameter represents a list of values. + * @type bool $redact + * Indicates whether the parameter content should be redacted in log. If + * redaction is enabled, the parameter content will be replaced by parameter + * name during logging. + * Note: the parameter content is subject to redaction if either parameter + * level redaction or [entity type level + * redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique identifier of the parameter. This field + * is used by [training + * phrases][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase] to annotate + * their [parts][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part]. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Required. The unique identifier of the parameter. This field + * is used by [training + * phrases][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase] to annotate + * their [parts][google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part]. + * + * Generated from protobuf field string id = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * Required. The entity type of the parameter. + * Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + * `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + * `projects//locations//agents//entityTypes/` for developer entity types. + * + * Generated from protobuf field string entity_type = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getEntityType() + { + return $this->entity_type; + } + + /** + * Required. The entity type of the parameter. + * Format: `projects/-/locations/-/agents/-/entityTypes/` for system entity types (for example, + * `projects/-/locations/-/agents/-/entityTypes/sys.date`), or + * `projects//locations//agents//entityTypes/` for developer entity types. + * + * Generated from protobuf field string entity_type = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEntityType($var) + { + GPBUtil::checkString($var, True); + $this->entity_type = $var; + + return $this; + } + + /** + * Indicates whether the parameter represents a list of values. + * + * Generated from protobuf field bool is_list = 3; + * @return bool + */ + public function getIsList() + { + return $this->is_list; + } + + /** + * Indicates whether the parameter represents a list of values. + * + * Generated from protobuf field bool is_list = 3; + * @param bool $var + * @return $this + */ + public function setIsList($var) + { + GPBUtil::checkBool($var); + $this->is_list = $var; + + return $this; + } + + /** + * Indicates whether the parameter content should be redacted in log. If + * redaction is enabled, the parameter content will be replaced by parameter + * name during logging. + * Note: the parameter content is subject to redaction if either parameter + * level redaction or [entity type level + * redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. + * + * Generated from protobuf field bool redact = 4; + * @return bool + */ + public function getRedact() + { + return $this->redact; + } + + /** + * Indicates whether the parameter content should be redacted in log. If + * redaction is enabled, the parameter content will be replaced by parameter + * name during logging. + * Note: the parameter content is subject to redaction if either parameter + * level redaction or [entity type level + * redaction][google.cloud.dialogflow.cx.v3.EntityType.redact] is enabled. + * + * Generated from protobuf field bool redact = 4; + * @param bool $var + * @return $this + */ + public function setRedact($var) + { + GPBUtil::checkBool($var); + $this->redact = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Intent/TrainingPhrase.php b/DialogflowCx/src/V3/Intent/TrainingPhrase.php new file mode 100644 index 000000000000..a99254dd7815 --- /dev/null +++ b/DialogflowCx/src/V3/Intent/TrainingPhrase.php @@ -0,0 +1,192 @@ +google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase + */ +class TrainingPhrase extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. The unique identifier of the training phrase. + * + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * 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.cx.v3.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 `parameter_id` field is set. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part parts = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $parts; + /** + * Indicates how many times this example was added to the intent. + * + * Generated from protobuf field int32 repeat_count = 3; + */ + protected $repeat_count = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * Output only. The unique identifier of the training phrase. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Intent\TrainingPhrase\Part>|\Google\Protobuf\Internal\RepeatedField $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.dialogflow.cx.v3.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 `parameter_id` field is set. + * @type int $repeat_count + * Indicates how many times this example was added to the intent. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Output only. The unique identifier of the training phrase. + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Output only. The unique identifier of the training phrase. + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * 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.cx.v3.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 `parameter_id` field is set. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part parts = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParts() + { + return $this->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.dialogflow.cx.v3.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 `parameter_id` field is set. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part parts = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Intent\TrainingPhrase\Part>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Intent\TrainingPhrase\Part::class); + $this->parts = $arr; + + return $this; + } + + /** + * Indicates how many times this example was added to the intent. + * + * Generated from protobuf field int32 repeat_count = 3; + * @return int + */ + public function getRepeatCount() + { + return $this->repeat_count; + } + + /** + * Indicates how many times this example was added to the intent. + * + * Generated from protobuf field int32 repeat_count = 3; + * @param int $var + * @return $this + */ + public function setRepeatCount($var) + { + GPBUtil::checkInt32($var); + $this->repeat_count = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Intent/TrainingPhrase/Part.php b/DialogflowCx/src/V3/Intent/TrainingPhrase/Part.php new file mode 100644 index 000000000000..0bae6e88498f --- /dev/null +++ b/DialogflowCx/src/V3/Intent/TrainingPhrase/Part.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.Intent.TrainingPhrase.Part + */ +class Part extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The text for this part. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $text = ''; + /** + * The [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] used to + * annotate this part of the training phrase. This field is required for + * annotated parts of the training phrase. + * + * Generated from protobuf field string parameter_id = 2; + */ + protected $parameter_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * Required. The text for this part. + * @type string $parameter_id + * The [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] used to + * annotate this part of the training phrase. This field is required for + * annotated parts of the training phrase. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The text for this part. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Required. The text for this part. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * The [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] used to + * annotate this part of the training phrase. This field is required for + * annotated parts of the training phrase. + * + * Generated from protobuf field string parameter_id = 2; + * @return string + */ + public function getParameterId() + { + return $this->parameter_id; + } + + /** + * The [parameter][google.cloud.dialogflow.cx.v3.Intent.Parameter] used to + * annotate this part of the training phrase. This field is required for + * annotated parts of the training phrase. + * + * Generated from protobuf field string parameter_id = 2; + * @param string $var + * @return $this + */ + public function setParameterId($var) + { + GPBUtil::checkString($var, True); + $this->parameter_id = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/IntentCoverage.php b/DialogflowCx/src/V3/IntentCoverage.php new file mode 100644 index 000000000000..cb8489e7802a --- /dev/null +++ b/DialogflowCx/src/V3/IntentCoverage.php @@ -0,0 +1,102 @@ +google.cloud.dialogflow.cx.v3.IntentCoverage + */ +class IntentCoverage extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Intents present in the agent + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.IntentCoverage.Intent intents = 1; + */ + private $intents; + /** + * The percent of intents in the agent that are covered. + * + * Generated from protobuf field float coverage_score = 2; + */ + protected $coverage_score = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\IntentCoverage\Intent>|\Google\Protobuf\Internal\RepeatedField $intents + * The list of Intents present in the agent + * @type float $coverage_score + * The percent of intents in the agent that are covered. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The list of Intents present in the agent + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.IntentCoverage.Intent intents = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIntents() + { + return $this->intents; + } + + /** + * The list of Intents present in the agent + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.IntentCoverage.Intent intents = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\IntentCoverage\Intent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIntents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\IntentCoverage\Intent::class); + $this->intents = $arr; + + return $this; + } + + /** + * The percent of intents in the agent that are covered. + * + * Generated from protobuf field float coverage_score = 2; + * @return float + */ + public function getCoverageScore() + { + return $this->coverage_score; + } + + /** + * The percent of intents in the agent that are covered. + * + * Generated from protobuf field float coverage_score = 2; + * @param float $var + * @return $this + */ + public function setCoverageScore($var) + { + GPBUtil::checkFloat($var); + $this->coverage_score = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/IntentCoverage/Intent.php b/DialogflowCx/src/V3/IntentCoverage/Intent.php new file mode 100644 index 000000000000..49bfbb52a372 --- /dev/null +++ b/DialogflowCx/src/V3/IntentCoverage/Intent.php @@ -0,0 +1,106 @@ +google.cloud.dialogflow.cx.v3.IntentCoverage.Intent + */ +class Intent extends \Google\Protobuf\Internal\Message +{ + /** + * The intent full resource name + * + * Generated from protobuf field string intent = 1 [(.google.api.resource_reference) = { + */ + protected $intent = ''; + /** + * Whether the intent is covered by at least one of the agent's + * test cases. + * + * Generated from protobuf field bool covered = 2; + */ + protected $covered = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $intent + * The intent full resource name + * @type bool $covered + * Whether the intent is covered by at least one of the agent's + * test cases. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The intent full resource name + * + * Generated from protobuf field string intent = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getIntent() + { + return $this->intent; + } + + /** + * The intent full resource name + * + * Generated from protobuf field string intent = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setIntent($var) + { + GPBUtil::checkString($var, True); + $this->intent = $var; + + return $this; + } + + /** + * Whether the intent is covered by at least one of the agent's + * test cases. + * + * Generated from protobuf field bool covered = 2; + * @return bool + */ + public function getCovered() + { + return $this->covered; + } + + /** + * Whether the intent is covered by at least one of the agent's + * test cases. + * + * Generated from protobuf field bool covered = 2; + * @param bool $var + * @return $this + */ + public function setCovered($var) + { + GPBUtil::checkBool($var); + $this->covered = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/IntentInput.php b/DialogflowCx/src/V3/IntentInput.php new file mode 100644 index 000000000000..c90f0098146d --- /dev/null +++ b/DialogflowCx/src/V3/IntentInput.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.IntentInput + */ +class IntentInput extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique identifier of the intent. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string intent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $intent = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $intent + * Required. The unique identifier of the intent. + * Format: `projects//locations//agents//intents/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique identifier of the intent. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string intent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getIntent() + { + return $this->intent; + } + + /** + * Required. The unique identifier of the intent. + * Format: `projects//locations//agents//intents/`. + * + * Generated from protobuf field string intent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setIntent($var) + { + GPBUtil::checkString($var, True); + $this->intent = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/IntentView.php b/DialogflowCx/src/V3/IntentView.php new file mode 100644 index 000000000000..371193419657 --- /dev/null +++ b/DialogflowCx/src/V3/IntentView.php @@ -0,0 +1,63 @@ +google.cloud.dialogflow.cx.v3.IntentView + */ +class IntentView +{ + /** + * Not specified. Treated as INTENT_VIEW_FULL. + * + * Generated from protobuf enum INTENT_VIEW_UNSPECIFIED = 0; + */ + const INTENT_VIEW_UNSPECIFIED = 0; + /** + * Training phrases field is not populated in the response. + * + * Generated from protobuf enum INTENT_VIEW_PARTIAL = 1; + */ + const INTENT_VIEW_PARTIAL = 1; + /** + * All fields are populated. + * + * Generated from protobuf enum INTENT_VIEW_FULL = 2; + */ + const INTENT_VIEW_FULL = 2; + + private static $valueToName = [ + self::INTENT_VIEW_UNSPECIFIED => 'INTENT_VIEW_UNSPECIFIED', + self::INTENT_VIEW_PARTIAL => 'INTENT_VIEW_PARTIAL', + self::INTENT_VIEW_FULL => 'INTENT_VIEW_FULL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DialogflowCx/src/V3/IntentsClient.php b/DialogflowCx/src/V3/IntentsClient.php new file mode 100644 index 000000000000..c23267307b87 --- /dev/null +++ b/DialogflowCx/src/V3/IntentsClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.KnowledgeConnectorSettings + */ +class KnowledgeConnectorSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Whether Knowledge Connector is enabled or not. + * + * Generated from protobuf field bool enabled = 1; + */ + protected $enabled = false; + /** + * The fulfillment to be triggered. + * When the answers from the Knowledge Connector are selected by Dialogflow, + * you can utitlize the request scoped parameter `$request.knowledge.answers` + * (contains up to the 5 highest confidence answers) and + * `$request.knowledge.questions` (contains the corresponding questions) to + * construct the fulfillment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment trigger_fulfillment = 3; + */ + protected $trigger_fulfillment = null; + /** + * Optional. List of related data store connections. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.DataStoreConnection data_store_connections = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $data_store_connections; + protected $target; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enabled + * Whether Knowledge Connector is enabled or not. + * @type \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $trigger_fulfillment + * The fulfillment to be triggered. + * When the answers from the Knowledge Connector are selected by Dialogflow, + * you can utitlize the request scoped parameter `$request.knowledge.answers` + * (contains up to the 5 highest confidence answers) and + * `$request.knowledge.questions` (contains the corresponding questions) to + * construct the fulfillment. + * @type string $target_page + * The target page to transition to. + * Format: `projects//locations//agents//flows//pages/`. + * @type string $target_flow + * The target flow to transition to. + * Format: `projects//locations//agents//flows/`. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\DataStoreConnection>|\Google\Protobuf\Internal\RepeatedField $data_store_connections + * Optional. List of related data store connections. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Whether Knowledge Connector is enabled or not. + * + * Generated from protobuf field bool enabled = 1; + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Whether Knowledge Connector is enabled or not. + * + * Generated from protobuf field bool enabled = 1; + * @param bool $var + * @return $this + */ + public function setEnabled($var) + { + GPBUtil::checkBool($var); + $this->enabled = $var; + + return $this; + } + + /** + * The fulfillment to be triggered. + * When the answers from the Knowledge Connector are selected by Dialogflow, + * you can utitlize the request scoped parameter `$request.knowledge.answers` + * (contains up to the 5 highest confidence answers) and + * `$request.knowledge.questions` (contains the corresponding questions) to + * construct the fulfillment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment trigger_fulfillment = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\Fulfillment|null + */ + public function getTriggerFulfillment() + { + return $this->trigger_fulfillment; + } + + public function hasTriggerFulfillment() + { + return isset($this->trigger_fulfillment); + } + + public function clearTriggerFulfillment() + { + unset($this->trigger_fulfillment); + } + + /** + * The fulfillment to be triggered. + * When the answers from the Knowledge Connector are selected by Dialogflow, + * you can utitlize the request scoped parameter `$request.knowledge.answers` + * (contains up to the 5 highest confidence answers) and + * `$request.knowledge.questions` (contains the corresponding questions) to + * construct the fulfillment. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment trigger_fulfillment = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $var + * @return $this + */ + public function setTriggerFulfillment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment::class); + $this->trigger_fulfillment = $var; + + return $this; + } + + /** + * The target page to transition to. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string target_page = 4 [(.google.api.resource_reference) = { + * @return string + */ + public function getTargetPage() + { + return $this->readOneof(4); + } + + public function hasTargetPage() + { + return $this->hasOneof(4); + } + + /** + * The target page to transition to. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string target_page = 4 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetPage($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * The target flow to transition to. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string target_flow = 5 [(.google.api.resource_reference) = { + * @return string + */ + public function getTargetFlow() + { + return $this->readOneof(5); + } + + public function hasTargetFlow() + { + return $this->hasOneof(5); + } + + /** + * The target flow to transition to. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string target_flow = 5 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetFlow($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Optional. List of related data store connections. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.DataStoreConnection data_store_connections = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataStoreConnections() + { + return $this->data_store_connections; + } + + /** + * Optional. List of related data store connections. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.DataStoreConnection data_store_connections = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\DataStoreConnection>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataStoreConnections($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\DataStoreConnection::class); + $this->data_store_connections = $arr; + + return $this; + } + + /** + * @return string + */ + public function getTarget() + { + return $this->whichOneof("target"); + } + +} + diff --git a/DialogflowCx/src/V3/ListAgentsRequest.php b/DialogflowCx/src/V3/ListAgentsRequest.php new file mode 100644 index 000000000000..60cf1c421954 --- /dev/null +++ b/DialogflowCx/src/V3/ListAgentsRequest.php @@ -0,0 +1,144 @@ +google.cloud.dialogflow.cx.v3.ListAgentsRequest + */ +class ListAgentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location to list all agents for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location to list all agents for. + * Format: `projects//locations/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location to list all agents for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The location to list all agents for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListAgentsResponse.php b/DialogflowCx/src/V3/ListAgentsResponse.php new file mode 100644 index 000000000000..6110935c92d1 --- /dev/null +++ b/DialogflowCx/src/V3/ListAgentsResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListAgentsResponse + */ +class ListAgentsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of agents. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Agent agents = 1; + */ + private $agents; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Agent>|\Google\Protobuf\Internal\RepeatedField $agents + * The list of agents. There will be a maximum number of items returned based + * on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * The list of agents. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Agent agents = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAgents() + { + return $this->agents; + } + + /** + * The list of agents. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Agent agents = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Agent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAgents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Agent::class); + $this->agents = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListChangelogsRequest.php b/DialogflowCx/src/V3/ListChangelogsRequest.php new file mode 100644 index 000000000000..a3157a9df961 --- /dev/null +++ b/DialogflowCx/src/V3/ListChangelogsRequest.php @@ -0,0 +1,254 @@ +google.cloud.dialogflow.cx.v3.ListChangelogsRequest + */ +class ListChangelogsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent containing the changelogs. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The filter string. Supports filter by user_email, resource, type and + * create_time. Some examples: + * 1. By user email: + * user_email = "someone@google.com" + * 2. By resource name: + * resource = "projects/123/locations/global/agents/456/flows/789" + * 3. By resource display name: + * display_name = "my agent" + * 4. By action: + * action = "Create" + * 5. By type: + * type = "flows" + * 6. By create time. Currently predicates on `create_time` and + * `create_time_epoch_seconds` are supported: + * create_time_epoch_seconds > 1551790877 AND create_time <= + * 2017-01-15T01:30:15.01Z + * 7. Combination of above filters: + * resource = "projects/123/locations/global/agents/456/flows/789" + * AND user_email = "someone@google.com" + * AND create_time <= 2017-01-15T01:30:15.01Z + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent containing the changelogs. + * Format: `projects//locations//agents/`. + * @type string $filter + * The filter string. Supports filter by user_email, resource, type and + * create_time. Some examples: + * 1. By user email: + * user_email = "someone@google.com" + * 2. By resource name: + * resource = "projects/123/locations/global/agents/456/flows/789" + * 3. By resource display name: + * display_name = "my agent" + * 4. By action: + * action = "Create" + * 5. By type: + * type = "flows" + * 6. By create time. Currently predicates on `create_time` and + * `create_time_epoch_seconds` are supported: + * create_time_epoch_seconds > 1551790877 AND create_time <= + * 2017-01-15T01:30:15.01Z + * 7. Combination of above filters: + * resource = "projects/123/locations/global/agents/456/flows/789" + * AND user_email = "someone@google.com" + * AND create_time <= 2017-01-15T01:30:15.01Z + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Changelog::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent containing the changelogs. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent containing the changelogs. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The filter string. Supports filter by user_email, resource, type and + * create_time. Some examples: + * 1. By user email: + * user_email = "someone@google.com" + * 2. By resource name: + * resource = "projects/123/locations/global/agents/456/flows/789" + * 3. By resource display name: + * display_name = "my agent" + * 4. By action: + * action = "Create" + * 5. By type: + * type = "flows" + * 6. By create time. Currently predicates on `create_time` and + * `create_time_epoch_seconds` are supported: + * create_time_epoch_seconds > 1551790877 AND create_time <= + * 2017-01-15T01:30:15.01Z + * 7. Combination of above filters: + * resource = "projects/123/locations/global/agents/456/flows/789" + * AND user_email = "someone@google.com" + * AND create_time <= 2017-01-15T01:30:15.01Z + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter string. Supports filter by user_email, resource, type and + * create_time. Some examples: + * 1. By user email: + * user_email = "someone@google.com" + * 2. By resource name: + * resource = "projects/123/locations/global/agents/456/flows/789" + * 3. By resource display name: + * display_name = "my agent" + * 4. By action: + * action = "Create" + * 5. By type: + * type = "flows" + * 6. By create time. Currently predicates on `create_time` and + * `create_time_epoch_seconds` are supported: + * create_time_epoch_seconds > 1551790877 AND create_time <= + * 2017-01-15T01:30:15.01Z + * 7. Combination of above filters: + * resource = "projects/123/locations/global/agents/456/flows/789" + * AND user_email = "someone@google.com" + * AND create_time <= 2017-01-15T01:30:15.01Z + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListChangelogsResponse.php b/DialogflowCx/src/V3/ListChangelogsResponse.php new file mode 100644 index 000000000000..f108398b3db7 --- /dev/null +++ b/DialogflowCx/src/V3/ListChangelogsResponse.php @@ -0,0 +1,114 @@ +google.cloud.dialogflow.cx.v3.ListChangelogsResponse + */ +class ListChangelogsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of changelogs. There will be a maximum number of items returned + * based on the page_size field in the request. The changelogs will be ordered + * by timestamp. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Changelog changelogs = 1; + */ + private $changelogs; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Changelog>|\Google\Protobuf\Internal\RepeatedField $changelogs + * The list of changelogs. There will be a maximum number of items returned + * based on the page_size field in the request. The changelogs will be ordered + * by timestamp. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Changelog::initOnce(); + parent::__construct($data); + } + + /** + * The list of changelogs. There will be a maximum number of items returned + * based on the page_size field in the request. The changelogs will be ordered + * by timestamp. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Changelog changelogs = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChangelogs() + { + return $this->changelogs; + } + + /** + * The list of changelogs. There will be a maximum number of items returned + * based on the page_size field in the request. The changelogs will be ordered + * by timestamp. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Changelog changelogs = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Changelog>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChangelogs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Changelog::class); + $this->changelogs = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListContinuousTestResultsRequest.php b/DialogflowCx/src/V3/ListContinuousTestResultsRequest.php new file mode 100644 index 000000000000..d1c19ffbb16f --- /dev/null +++ b/DialogflowCx/src/V3/ListContinuousTestResultsRequest.php @@ -0,0 +1,148 @@ +google.cloud.dialogflow.cx.v3.ListContinuousTestResultsRequest + */ +class ListContinuousTestResultsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The environment to list results for. + * Format: `projects//locations//agents// + * environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The environment to list results for. + * Format: `projects//locations//agents// + * environments/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The environment to list results for. + * Format: `projects//locations//agents// + * environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The environment to list results for. + * Format: `projects//locations//agents// + * environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListContinuousTestResultsResponse.php b/DialogflowCx/src/V3/ListContinuousTestResultsResponse.php new file mode 100644 index 000000000000..71491345e27e --- /dev/null +++ b/DialogflowCx/src/V3/ListContinuousTestResultsResponse.php @@ -0,0 +1,105 @@ +google.cloud.dialogflow.cx.v3.ListContinuousTestResultsResponse + */ +class ListContinuousTestResultsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of continuous test results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ContinuousTestResult continuous_test_results = 1; + */ + private $continuous_test_results; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ContinuousTestResult>|\Google\Protobuf\Internal\RepeatedField $continuous_test_results + * The list of continuous test results. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * The list of continuous test results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ContinuousTestResult continuous_test_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getContinuousTestResults() + { + return $this->continuous_test_results; + } + + /** + * The list of continuous test results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ContinuousTestResult continuous_test_results = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ContinuousTestResult>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setContinuousTestResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ContinuousTestResult::class); + $this->continuous_test_results = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListDeploymentsRequest.php b/DialogflowCx/src/V3/ListDeploymentsRequest.php new file mode 100644 index 000000000000..9122cf75d8f6 --- /dev/null +++ b/DialogflowCx/src/V3/ListDeploymentsRequest.php @@ -0,0 +1,152 @@ +google.cloud.dialogflow.cx.v3.ListDeploymentsRequest + */ +class ListDeploymentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Deployment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListDeploymentsResponse.php b/DialogflowCx/src/V3/ListDeploymentsResponse.php new file mode 100644 index 000000000000..695c12baf8ed --- /dev/null +++ b/DialogflowCx/src/V3/ListDeploymentsResponse.php @@ -0,0 +1,118 @@ +google.cloud.dialogflow.cx.v3.ListDeploymentsResponse + */ +class ListDeploymentsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of deployments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Deployment deployments = 1; + */ + private $deployments; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Deployment>|\Google\Protobuf\Internal\RepeatedField $deployments + * The list of deployments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Deployment::initOnce(); + parent::__construct($data); + } + + /** + * The list of deployments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Deployment deployments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDeployments() + { + return $this->deployments; + } + + /** + * The list of deployments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Deployment deployments = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Deployment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDeployments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Deployment::class); + $this->deployments = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListEntityTypesRequest.php b/DialogflowCx/src/V3/ListEntityTypesRequest.php new file mode 100644 index 000000000000..83a706c66ea0 --- /dev/null +++ b/DialogflowCx/src/V3/ListEntityTypesRequest.php @@ -0,0 +1,214 @@ +google.cloud.dialogflow.cx.v3.ListEntityTypesRequest + */ +class ListEntityTypesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to list all entity types for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The language to list entity types for. The following fields are language + * dependent: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to list all entity types for. + * Format: `projects//locations//agents/`. + * @type string $language_code + * The language to list entity types for. The following fields are language + * dependent: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\EntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to list all entity types for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to list all entity types for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The language to list entity types for. The following fields are language + * dependent: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to list entity types for. The following fields are language + * dependent: + * * `EntityType.entities.value` + * * `EntityType.entities.synonyms` + * * `EntityType.excluded_phrases.value` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListEntityTypesResponse.php b/DialogflowCx/src/V3/ListEntityTypesResponse.php new file mode 100644 index 000000000000..4972de35965a --- /dev/null +++ b/DialogflowCx/src/V3/ListEntityTypesResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListEntityTypesResponse + */ +class ListEntityTypesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of entity types. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType entity_types = 1; + */ + private $entity_types; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\EntityType>|\Google\Protobuf\Internal\RepeatedField $entity_types + * The list of entity types. There will be a maximum number of items returned + * based on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\EntityType::initOnce(); + parent::__construct($data); + } + + /** + * The list of entity types. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType entity_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEntityTypes() + { + return $this->entity_types; + } + + /** + * The list of entity types. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EntityType entity_types = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\EntityType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEntityTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\EntityType::class); + $this->entity_types = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListEnvironmentsRequest.php b/DialogflowCx/src/V3/ListEnvironmentsRequest.php new file mode 100644 index 000000000000..f6de55136e30 --- /dev/null +++ b/DialogflowCx/src/V3/ListEnvironmentsRequest.php @@ -0,0 +1,148 @@ +google.cloud.dialogflow.cx.v3.ListEnvironmentsRequest + */ +class ListEnvironmentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all + * environments for. Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all + * environments for. Format: `projects//locations//agents/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all + * environments for. Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The [Agent][google.cloud.dialogflow.cx.v3.Agent] to list all + * environments for. Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListEnvironmentsResponse.php b/DialogflowCx/src/V3/ListEnvironmentsResponse.php new file mode 100644 index 000000000000..76e3427f307c --- /dev/null +++ b/DialogflowCx/src/V3/ListEnvironmentsResponse.php @@ -0,0 +1,118 @@ +google.cloud.dialogflow.cx.v3.ListEnvironmentsResponse + */ +class ListEnvironmentsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of environments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment environments = 1; + */ + private $environments; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Environment>|\Google\Protobuf\Internal\RepeatedField $environments + * The list of environments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * The list of environments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment environments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnvironments() + { + return $this->environments; + } + + /** + * The list of environments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment environments = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Environment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnvironments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Environment::class); + $this->environments = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListExperimentsRequest.php b/DialogflowCx/src/V3/ListExperimentsRequest.php new file mode 100644 index 000000000000..8ae7c17d9a31 --- /dev/null +++ b/DialogflowCx/src/V3/ListExperimentsRequest.php @@ -0,0 +1,152 @@ +google.cloud.dialogflow.cx.v3.ListExperimentsRequest + */ +class ListExperimentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The [Environment][google.cloud.dialogflow.cx.v3.Environment] to + * list all environments for. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListExperimentsResponse.php b/DialogflowCx/src/V3/ListExperimentsResponse.php new file mode 100644 index 000000000000..f5f66d17c29e --- /dev/null +++ b/DialogflowCx/src/V3/ListExperimentsResponse.php @@ -0,0 +1,118 @@ +google.cloud.dialogflow.cx.v3.ListExperimentsResponse + */ +class ListExperimentsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of experiments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment experiments = 1; + */ + private $experiments; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Experiment>|\Google\Protobuf\Internal\RepeatedField $experiments + * The list of experiments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * The list of experiments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment experiments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExperiments() + { + return $this->experiments; + } + + /** + * The list of experiments. There will be a maximum number of items + * returned based on the page_size field in the request. The list may in some + * cases be empty or contain fewer entries than page_size even if this isn't + * the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Experiment experiments = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Experiment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExperiments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Experiment::class); + $this->experiments = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListFlowsRequest.php b/DialogflowCx/src/V3/ListFlowsRequest.php new file mode 100644 index 000000000000..664175364c1f --- /dev/null +++ b/DialogflowCx/src/V3/ListFlowsRequest.php @@ -0,0 +1,218 @@ +google.cloud.dialogflow.cx.v3.ListFlowsRequest + */ +class ListFlowsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent containing the flows. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The language to list flows for. The following fields are language + * dependent: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent containing the flows. + * Format: `projects//locations//agents/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * @type string $language_code + * The language to list flows for. The following fields are language + * dependent: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent containing the flows. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent containing the flows. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The language to list flows for. The following fields are language + * dependent: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to list flows for. The following fields are language + * dependent: + * * `Flow.event_handlers.trigger_fulfillment.messages` + * * `Flow.event_handlers.trigger_fulfillment.conditional_cases` + * * `Flow.transition_routes.trigger_fulfillment.messages` + * * `Flow.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListFlowsResponse.php b/DialogflowCx/src/V3/ListFlowsResponse.php new file mode 100644 index 000000000000..c38f11694ac4 --- /dev/null +++ b/DialogflowCx/src/V3/ListFlowsResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListFlowsResponse + */ +class ListFlowsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of flows. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Flow flows = 1; + */ + private $flows; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Flow>|\Google\Protobuf\Internal\RepeatedField $flows + * The list of flows. There will be a maximum number of items returned based + * on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * The list of flows. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Flow flows = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFlows() + { + return $this->flows; + } + + /** + * The list of flows. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Flow flows = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Flow>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFlows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Flow::class); + $this->flows = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListIntentsRequest.php b/DialogflowCx/src/V3/ListIntentsRequest.php new file mode 100644 index 000000000000..9d2fbd36c6cd --- /dev/null +++ b/DialogflowCx/src/V3/ListIntentsRequest.php @@ -0,0 +1,240 @@ +google.cloud.dialogflow.cx.v3.ListIntentsRequest + */ +class ListIntentsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to list all intents for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The language to list intents for. The following fields are language + * dependent: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + /** + * The resource view to apply to the returned intent. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.IntentView intent_view = 5; + */ + protected $intent_view = 0; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to list all intents for. + * Format: `projects//locations//agents/`. + * @type string $language_code + * The language to list intents for. The following fields are language + * dependent: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type int $intent_view + * The resource view to apply to the returned intent. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to list all intents for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to list all intents for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The language to list intents for. The following fields are language + * dependent: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to list intents for. The following fields are language + * dependent: + * * `Intent.training_phrases.parts.text` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The resource view to apply to the returned intent. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.IntentView intent_view = 5; + * @return int + */ + public function getIntentView() + { + return $this->intent_view; + } + + /** + * The resource view to apply to the returned intent. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.IntentView intent_view = 5; + * @param int $var + * @return $this + */ + public function setIntentView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\IntentView::class); + $this->intent_view = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListIntentsResponse.php b/DialogflowCx/src/V3/ListIntentsResponse.php new file mode 100644 index 000000000000..f76463fe6a8e --- /dev/null +++ b/DialogflowCx/src/V3/ListIntentsResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListIntentsResponse + */ +class ListIntentsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of intents. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent intents = 1; + */ + private $intents; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Intent>|\Google\Protobuf\Internal\RepeatedField $intents + * The list of intents. There will be a maximum number of items returned based + * on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Intent::initOnce(); + parent::__construct($data); + } + + /** + * The list of intents. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent intents = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getIntents() + { + return $this->intents; + } + + /** + * The list of intents. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Intent intents = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Intent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setIntents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Intent::class); + $this->intents = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListPagesRequest.php b/DialogflowCx/src/V3/ListPagesRequest.php new file mode 100644 index 000000000000..94b774da1e03 --- /dev/null +++ b/DialogflowCx/src/V3/ListPagesRequest.php @@ -0,0 +1,254 @@ +google.cloud.dialogflow.cx.v3.ListPagesRequest + */ +class ListPagesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The flow to list all pages for. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The language to list pages for. The following fields are language + * dependent: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The flow to list all pages for. + * Format: `projects//locations//agents//flows/`. + * @type string $language_code + * The language to list pages for. The following fields are language + * dependent: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * Required. The flow to list all pages for. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The flow to list all pages for. + * Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The language to list pages for. The following fields are language + * dependent: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to list pages for. The following fields are language + * dependent: + * * `Page.entry_fulfillment.messages` + * * `Page.entry_fulfillment.conditional_cases` + * * `Page.event_handlers.trigger_fulfillment.messages` + * * `Page.event_handlers.trigger_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages` + * * + * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases` + * * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages` + * * + * `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases` + * * `Page.transition_routes.trigger_fulfillment.messages` + * * `Page.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 3; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 4; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListPagesResponse.php b/DialogflowCx/src/V3/ListPagesResponse.php new file mode 100644 index 000000000000..ba48419acca6 --- /dev/null +++ b/DialogflowCx/src/V3/ListPagesResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListPagesResponse + */ +class ListPagesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of pages. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Page pages = 1; + */ + private $pages; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Page>|\Google\Protobuf\Internal\RepeatedField $pages + * The list of pages. There will be a maximum number of items returned based + * on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * The list of pages. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Page pages = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPages() + { + return $this->pages; + } + + /** + * The list of pages. There will be a maximum number of items returned based + * on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Page pages = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Page>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Page::class); + $this->pages = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListSecuritySettingsRequest.php b/DialogflowCx/src/V3/ListSecuritySettingsRequest.php new file mode 100644 index 000000000000..3cdcc76f4ee1 --- /dev/null +++ b/DialogflowCx/src/V3/ListSecuritySettingsRequest.php @@ -0,0 +1,143 @@ +google.cloud.dialogflow.cx.v3.ListSecuritySettingsRequest + */ +class ListSecuritySettingsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The location to list all security settings for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The location to list all security settings for. + * Format: `projects//locations/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SecuritySettings::initOnce(); + parent::__construct($data); + } + + /** + * Required. The location to list all security settings for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The location to list all security settings for. + * Format: `projects//locations/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListSecuritySettingsResponse.php b/DialogflowCx/src/V3/ListSecuritySettingsResponse.php new file mode 100644 index 000000000000..082da9d41a95 --- /dev/null +++ b/DialogflowCx/src/V3/ListSecuritySettingsResponse.php @@ -0,0 +1,105 @@ +google.cloud.dialogflow.cx.v3.ListSecuritySettingsResponse + */ +class ListSecuritySettingsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of security settings. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SecuritySettings security_settings = 1; + */ + private $security_settings; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\SecuritySettings>|\Google\Protobuf\Internal\RepeatedField $security_settings + * The list of security settings. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SecuritySettings::initOnce(); + parent::__construct($data); + } + + /** + * The list of security settings. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SecuritySettings security_settings = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSecuritySettings() + { + return $this->security_settings; + } + + /** + * The list of security settings. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SecuritySettings security_settings = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\SecuritySettings>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSecuritySettings($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\SecuritySettings::class); + $this->security_settings = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListSessionEntityTypesRequest.php b/DialogflowCx/src/V3/ListSessionEntityTypesRequest.php new file mode 100644 index 000000000000..5cdc94c98214 --- /dev/null +++ b/DialogflowCx/src/V3/ListSessionEntityTypesRequest.php @@ -0,0 +1,160 @@ +google.cloud.dialogflow.cx.v3.ListSessionEntityTypesRequest + */ +class ListSessionEntityTypesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The session to list all session entity types from. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The session to list all session entity types from. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType::initOnce(); + parent::__construct($data); + } + + /** + * Required. The session to list all session entity types from. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The session to list all session entity types from. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListSessionEntityTypesResponse.php b/DialogflowCx/src/V3/ListSessionEntityTypesResponse.php new file mode 100644 index 000000000000..d351954ac8d6 --- /dev/null +++ b/DialogflowCx/src/V3/ListSessionEntityTypesResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListSessionEntityTypesResponse + */ +class ListSessionEntityTypesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of session entity types. There will be a maximum number of items + * returned based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_types = 1; + */ + private $session_entity_types; + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType>|\Google\Protobuf\Internal\RepeatedField $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. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType::initOnce(); + parent::__construct($data); + } + + /** + * The list of session entity types. There will be a maximum number of items + * returned based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSessionEntityTypes() + { + return $this->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. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_types = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSessionEntityTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType::class); + $this->session_entity_types = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no + * more results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListTestCaseResultsRequest.php b/DialogflowCx/src/V3/ListTestCaseResultsRequest.php new file mode 100644 index 000000000000..ba3f3615fa4f --- /dev/null +++ b/DialogflowCx/src/V3/ListTestCaseResultsRequest.php @@ -0,0 +1,258 @@ +google.cloud.dialogflow.cx.v3.ListTestCaseResultsRequest + */ +class ListTestCaseResultsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The test case to list results for. + * Format: `projects//locations//agents// + * testCases/`. Specify a `-` as a wildcard for TestCase ID to + * list results across multiple test cases. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The filter expression used to filter test case results. See + * [API Filtering](https://aip.dev/160). + * The expression is case insensitive. Only 'AND' is supported for logical + * operators. The supported syntax is listed below in detail: + * [AND ] ... + * [AND latest] + * The supported fields and operators are: + * field operator + * `environment` `=`, `IN` (Use value `draft` for draft environment) + * `test_time` `>`, `<` + * `latest` only returns the latest test result in all results for each test + * case. + * Examples: + * * "environment=draft AND latest" matches the latest test result for each + * test case in the draft environment. + * * "environment IN (e1,e2)" matches any test case results with an + * environment resource name of either "e1" or "e2". + * * "test_time > 1602540713" matches any test case results with test time + * later than a unix timestamp in seconds 1602540713. + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The test case to list results for. + * Format: `projects//locations//agents// + * testCases/`. Specify a `-` as a wildcard for TestCase ID to + * list results across multiple test cases. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * @type string $filter + * The filter expression used to filter test case results. See + * [API Filtering](https://aip.dev/160). + * The expression is case insensitive. Only 'AND' is supported for logical + * operators. The supported syntax is listed below in detail: + * [AND ] ... + * [AND latest] + * The supported fields and operators are: + * field operator + * `environment` `=`, `IN` (Use value `draft` for draft environment) + * `test_time` `>`, `<` + * `latest` only returns the latest test result in all results for each test + * case. + * Examples: + * * "environment=draft AND latest" matches the latest test result for each + * test case in the draft environment. + * * "environment IN (e1,e2)" matches any test case results with an + * environment resource name of either "e1" or "e2". + * * "test_time > 1602540713" matches any test case results with test time + * later than a unix timestamp in seconds 1602540713. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The test case to list results for. + * Format: `projects//locations//agents// + * testCases/`. Specify a `-` as a wildcard for TestCase ID to + * list results across multiple test cases. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The test case to list results for. + * Format: `projects//locations//agents// + * testCases/`. Specify a `-` as a wildcard for TestCase ID to + * list results across multiple test cases. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The filter expression used to filter test case results. See + * [API Filtering](https://aip.dev/160). + * The expression is case insensitive. Only 'AND' is supported for logical + * operators. The supported syntax is listed below in detail: + * [AND ] ... + * [AND latest] + * The supported fields and operators are: + * field operator + * `environment` `=`, `IN` (Use value `draft` for draft environment) + * `test_time` `>`, `<` + * `latest` only returns the latest test result in all results for each test + * case. + * Examples: + * * "environment=draft AND latest" matches the latest test result for each + * test case in the draft environment. + * * "environment IN (e1,e2)" matches any test case results with an + * environment resource name of either "e1" or "e2". + * * "test_time > 1602540713" matches any test case results with test time + * later than a unix timestamp in seconds 1602540713. + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression used to filter test case results. See + * [API Filtering](https://aip.dev/160). + * The expression is case insensitive. Only 'AND' is supported for logical + * operators. The supported syntax is listed below in detail: + * [AND ] ... + * [AND latest] + * The supported fields and operators are: + * field operator + * `environment` `=`, `IN` (Use value `draft` for draft environment) + * `test_time` `>`, `<` + * `latest` only returns the latest test result in all results for each test + * case. + * Examples: + * * "environment=draft AND latest" matches the latest test result for each + * test case in the draft environment. + * * "environment IN (e1,e2)" matches any test case results with an + * environment resource name of either "e1" or "e2". + * * "test_time > 1602540713" matches any test case results with test time + * later than a unix timestamp in seconds 1602540713. + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListTestCaseResultsResponse.php b/DialogflowCx/src/V3/ListTestCaseResultsResponse.php new file mode 100644 index 000000000000..ac6cc938e7db --- /dev/null +++ b/DialogflowCx/src/V3/ListTestCaseResultsResponse.php @@ -0,0 +1,106 @@ +google.cloud.dialogflow.cx.v3.ListTestCaseResultsResponse + */ +class ListTestCaseResultsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of test case results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseResult test_case_results = 1; + */ + private $test_case_results; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TestCaseResult>|\Google\Protobuf\Internal\RepeatedField $test_case_results + * The list of test case results. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The list of test case results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseResult test_case_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTestCaseResults() + { + return $this->test_case_results; + } + + /** + * The list of test case results. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCaseResult test_case_results = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TestCaseResult>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTestCaseResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TestCaseResult::class); + $this->test_case_results = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListTestCasesRequest.php b/DialogflowCx/src/V3/ListTestCasesRequest.php new file mode 100644 index 000000000000..3ee1f6ab5efe --- /dev/null +++ b/DialogflowCx/src/V3/ListTestCasesRequest.php @@ -0,0 +1,182 @@ +google.cloud.dialogflow.cx.v3.ListTestCasesRequest + */ +class ListTestCasesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to list all pages for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 20. + * Note that when TestCaseView = FULL, the maximum page size allowed is 20. + * When TestCaseView = BASIC, the maximum page size allowed is 500. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * Specifies whether response should include all fields or just the metadata. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ListTestCasesRequest.TestCaseView view = 4; + */ + protected $view = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to list all pages for. + * Format: `projects//locations//agents/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 20. + * Note that when TestCaseView = FULL, the maximum page size allowed is 20. + * When TestCaseView = BASIC, the maximum page size allowed is 500. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * @type int $view + * Specifies whether response should include all fields or just the metadata. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to list all pages for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to list all pages for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 20. + * Note that when TestCaseView = FULL, the maximum page size allowed is 20. + * When TestCaseView = BASIC, the maximum page size allowed is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 20. + * Note that when TestCaseView = FULL, the maximum page size allowed is 20. + * When TestCaseView = BASIC, the maximum page size allowed is 500. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Specifies whether response should include all fields or just the metadata. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ListTestCasesRequest.TestCaseView view = 4; + * @return int + */ + public function getView() + { + return $this->view; + } + + /** + * Specifies whether response should include all fields or just the metadata. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ListTestCasesRequest.TestCaseView view = 4; + * @param int $var + * @return $this + */ + public function setView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ListTestCasesRequest\TestCaseView::class); + $this->view = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListTestCasesRequest/TestCaseView.php b/DialogflowCx/src/V3/ListTestCasesRequest/TestCaseView.php new file mode 100644 index 000000000000..1516003cbc13 --- /dev/null +++ b/DialogflowCx/src/V3/ListTestCasesRequest/TestCaseView.php @@ -0,0 +1,64 @@ +google.cloud.dialogflow.cx.v3.ListTestCasesRequest.TestCaseView + */ +class TestCaseView +{ + /** + * The default / unset value. + * The API will default to the BASIC view. + * + * Generated from protobuf enum TEST_CASE_VIEW_UNSPECIFIED = 0; + */ + const TEST_CASE_VIEW_UNSPECIFIED = 0; + /** + * Include basic metadata about the test case, but not the conversation + * turns. This is the default value. + * + * Generated from protobuf enum BASIC = 1; + */ + const BASIC = 1; + /** + * Include everything. + * + * Generated from protobuf enum FULL = 2; + */ + const FULL = 2; + + private static $valueToName = [ + self::TEST_CASE_VIEW_UNSPECIFIED => 'TEST_CASE_VIEW_UNSPECIFIED', + self::BASIC => 'BASIC', + self::FULL => 'FULL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ListTestCasesResponse.php b/DialogflowCx/src/V3/ListTestCasesResponse.php new file mode 100644 index 000000000000..dd24de72146c --- /dev/null +++ b/DialogflowCx/src/V3/ListTestCasesResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListTestCasesResponse + */ +class ListTestCasesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of test cases. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCase test_cases = 1; + */ + private $test_cases; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TestCase>|\Google\Protobuf\Internal\RepeatedField $test_cases + * The list of test cases. There will be a maximum number of items returned + * based on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The list of test cases. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCase test_cases = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTestCases() + { + return $this->test_cases; + } + + /** + * The list of test cases. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestCase test_cases = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TestCase>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTestCases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TestCase::class); + $this->test_cases = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListTransitionRouteGroupsRequest.php b/DialogflowCx/src/V3/ListTransitionRouteGroupsRequest.php new file mode 100644 index 000000000000..a224fd874535 --- /dev/null +++ b/DialogflowCx/src/V3/ListTransitionRouteGroupsRequest.php @@ -0,0 +1,222 @@ +google.cloud.dialogflow.cx.v3.ListTransitionRouteGroupsRequest + */ +class ListTransitionRouteGroupsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The flow to list all transition route groups for. + * Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * The language to list transition route groups for. The following fields are + * language dependent: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The flow to list all transition route groups for. + * Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * @type string $language_code + * The language to list transition route groups for. The following fields are + * language dependent: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup::initOnce(); + parent::__construct($data); + } + + /** + * Required. The flow to list all transition route groups for. + * Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The flow to list all transition route groups for. + * Format: `projects//locations//agents//flows/` + * or `projects//locations//agents/. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * The language to list transition route groups for. The following fields are + * language dependent: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language to list transition route groups for. The following fields are + * language dependent: + * * `TransitionRouteGroup.transition_routes.trigger_fulfillment.messages` + * * + * `TransitionRouteGroup.transition_routes.trigger_fulfillment.conditional_cases` + * If not specified, the agent's default language is used. + * [Many + * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * are supported. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListTransitionRouteGroupsResponse.php b/DialogflowCx/src/V3/ListTransitionRouteGroupsResponse.php new file mode 100644 index 000000000000..1c41c06a2ade --- /dev/null +++ b/DialogflowCx/src/V3/ListTransitionRouteGroupsResponse.php @@ -0,0 +1,118 @@ +google.cloud.dialogflow.cx.v3.ListTransitionRouteGroupsResponse + */ +class ListTransitionRouteGroupsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of transition route groups. There will be a maximum number of + * items returned based on the page_size field in the request. The list may in + * some cases be empty or contain fewer entries than page_size even if this + * isn't the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRouteGroup transition_route_groups = 1; + */ + private $transition_route_groups; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup>|\Google\Protobuf\Internal\RepeatedField $transition_route_groups + * The list of transition route groups. There will be a maximum number of + * items returned based on the page_size field in the request. The list may in + * some cases be empty or contain fewer entries than page_size even if this + * isn't the last page. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup::initOnce(); + parent::__construct($data); + } + + /** + * The list of transition route groups. There will be a maximum number of + * items returned based on the page_size field in the request. The list may in + * some cases be empty or contain fewer entries than page_size even if this + * isn't the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRouteGroup transition_route_groups = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitionRouteGroups() + { + return $this->transition_route_groups; + } + + /** + * The list of transition route groups. There will be a maximum number of + * items returned based on the page_size field in the request. The list may in + * some cases be empty or contain fewer entries than page_size even if this + * isn't the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRouteGroup transition_route_groups = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitionRouteGroups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TransitionRouteGroup::class); + $this->transition_route_groups = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListVersionsRequest.php b/DialogflowCx/src/V3/ListVersionsRequest.php new file mode 100644 index 000000000000..785543b62d2b --- /dev/null +++ b/DialogflowCx/src/V3/ListVersionsRequest.php @@ -0,0 +1,148 @@ +google.cloud.dialogflow.cx.v3.ListVersionsRequest + */ +class ListVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all + * versions for. Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all + * versions for. Format: `projects//locations//agents//flows/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all + * versions for. Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The [Flow][google.cloud.dialogflow.cx.v3.Flow] to list all + * versions for. Format: `projects//locations//agents//flows/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 20 and + * at most 100. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListVersionsResponse.php b/DialogflowCx/src/V3/ListVersionsResponse.php new file mode 100644 index 000000000000..88cbf3ca5a1a --- /dev/null +++ b/DialogflowCx/src/V3/ListVersionsResponse.php @@ -0,0 +1,114 @@ +google.cloud.dialogflow.cx.v3.ListVersionsResponse + */ +class ListVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of versions. There will be a maximum number of items returned based + * on the page_size field in the request. The list may in some cases be empty + * or contain fewer entries than page_size even if this isn't the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Version versions = 1; + */ + private $versions; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Version>|\Google\Protobuf\Internal\RepeatedField $versions + * A list of versions. There will be a maximum number of items returned based + * on the page_size field in the request. The list may in some cases be empty + * or contain fewer entries than page_size even if this isn't the last page. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * A list of versions. There will be a maximum number of items returned based + * on the page_size field in the request. The list may in some cases be empty + * or contain fewer entries than page_size even if this isn't the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Version versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getVersions() + { + return $this->versions; + } + + /** + * A list of versions. There will be a maximum number of items returned based + * on the page_size field in the request. The list may in some cases be empty + * or contain fewer entries than page_size even if this isn't the last page. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Version versions = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Version>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Version::class); + $this->versions = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListWebhooksRequest.php b/DialogflowCx/src/V3/ListWebhooksRequest.php new file mode 100644 index 000000000000..b251c3a83c13 --- /dev/null +++ b/DialogflowCx/src/V3/ListWebhooksRequest.php @@ -0,0 +1,144 @@ +google.cloud.dialogflow.cx.v3.ListWebhooksRequest + */ +class ListWebhooksRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to list all webhooks for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to list all webhooks for. + * Format: `projects//locations//agents/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to list all webhooks for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to list all webhooks for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListWebhooksResponse.php b/DialogflowCx/src/V3/ListWebhooksResponse.php new file mode 100644 index 000000000000..18c66abb5833 --- /dev/null +++ b/DialogflowCx/src/V3/ListWebhooksResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListWebhooksResponse + */ +class ListWebhooksResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of webhooks. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Webhook webhooks = 1; + */ + private $webhooks; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Webhook>|\Google\Protobuf\Internal\RepeatedField $webhooks + * The list of webhooks. There will be a maximum number of items returned + * based on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * The list of webhooks. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Webhook webhooks = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWebhooks() + { + return $this->webhooks; + } + + /** + * The list of webhooks. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Webhook webhooks = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Webhook>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWebhooks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Webhook::class); + $this->webhooks = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/LoadVersionRequest.php b/DialogflowCx/src/V3/LoadVersionRequest.php new file mode 100644 index 000000000000..9183032c53b2 --- /dev/null +++ b/DialogflowCx/src/V3/LoadVersionRequest.php @@ -0,0 +1,122 @@ +google.cloud.dialogflow.cx.v3.LoadVersionRequest + */ +class LoadVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded + * to draft flow. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * This field is used to prevent accidental overwrite of other agent + * resources, which can potentially impact other flow's behavior. If + * `allow_override_agent_resources` is false, conflicted agent-level resources + * will not be overridden (i.e. intents, entities, webhooks). + * + * Generated from protobuf field bool allow_override_agent_resources = 2; + */ + protected $allow_override_agent_resources = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded + * to draft flow. Format: `projects//locations//agents//flows//versions/`. + * @type bool $allow_override_agent_resources + * This field is used to prevent accidental overwrite of other agent + * resources, which can potentially impact other flow's behavior. If + * `allow_override_agent_resources` is false, conflicted agent-level resources + * will not be overridden (i.e. intents, entities, webhooks). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Version::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded + * to draft flow. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The [Version][google.cloud.dialogflow.cx.v3.Version] to be loaded + * to draft flow. Format: `projects//locations//agents//flows//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * This field is used to prevent accidental overwrite of other agent + * resources, which can potentially impact other flow's behavior. If + * `allow_override_agent_resources` is false, conflicted agent-level resources + * will not be overridden (i.e. intents, entities, webhooks). + * + * Generated from protobuf field bool allow_override_agent_resources = 2; + * @return bool + */ + public function getAllowOverrideAgentResources() + { + return $this->allow_override_agent_resources; + } + + /** + * This field is used to prevent accidental overwrite of other agent + * resources, which can potentially impact other flow's behavior. If + * `allow_override_agent_resources` is false, conflicted agent-level resources + * will not be overridden (i.e. intents, entities, webhooks). + * + * Generated from protobuf field bool allow_override_agent_resources = 2; + * @param bool $var + * @return $this + */ + public function setAllowOverrideAgentResources($var) + { + GPBUtil::checkBool($var); + $this->allow_override_agent_resources = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/LookupEnvironmentHistoryRequest.php b/DialogflowCx/src/V3/LookupEnvironmentHistoryRequest.php new file mode 100644 index 000000000000..80c5fd7e5f13 --- /dev/null +++ b/DialogflowCx/src/V3/LookupEnvironmentHistoryRequest.php @@ -0,0 +1,148 @@ +google.cloud.dialogflow.cx.v3.LookupEnvironmentHistoryRequest + */ +class LookupEnvironmentHistoryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Resource name of the environment to look up the history for. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Resource name of the environment to look up the history for. + * Format: `projects//locations//agents//environments/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. Resource name of the environment to look up the history for. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Resource name of the environment to look up the history for. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/LookupEnvironmentHistoryResponse.php b/DialogflowCx/src/V3/LookupEnvironmentHistoryResponse.php new file mode 100644 index 000000000000..67b4ff65d562 --- /dev/null +++ b/DialogflowCx/src/V3/LookupEnvironmentHistoryResponse.php @@ -0,0 +1,114 @@ +google.cloud.dialogflow.cx.v3.LookupEnvironmentHistoryResponse + */ +class LookupEnvironmentHistoryResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Represents a list of snapshots for an environment. Time of the snapshots is + * stored in + * [`update_time`][google.cloud.dialogflow.cx.v3.Environment.update_time]. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment environments = 1; + */ + private $environments; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Environment>|\Google\Protobuf\Internal\RepeatedField $environments + * Represents a list of snapshots for an environment. Time of the snapshots is + * stored in + * [`update_time`][google.cloud.dialogflow.cx.v3.Environment.update_time]. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Represents a list of snapshots for an environment. Time of the snapshots is + * stored in + * [`update_time`][google.cloud.dialogflow.cx.v3.Environment.update_time]. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment environments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEnvironments() + { + return $this->environments; + } + + /** + * Represents a list of snapshots for an environment. Time of the snapshots is + * stored in + * [`update_time`][google.cloud.dialogflow.cx.v3.Environment.update_time]. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Environment environments = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Environment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEnvironments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Environment::class); + $this->environments = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/MatchIntentRequest.php b/DialogflowCx/src/V3/MatchIntentRequest.php new file mode 100644 index 000000000000..ecbbe66b6c0b --- /dev/null +++ b/DialogflowCx/src/V3/MatchIntentRequest.php @@ -0,0 +1,229 @@ +google.cloud.dialogflow.cx.v3.MatchIntentRequest + */ +class MatchIntentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * The parameters of this query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryParameters query_params = 2; + */ + protected $query_params = null; + /** + * Required. The input specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput query_input = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query_input = null; + /** + * Persist session parameter changes from `query_params`. + * + * Generated from protobuf field bool persist_parameter_changes = 5; + */ + protected $persist_parameter_changes = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $session + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * @type \Google\Cloud\Dialogflow\Cx\V3\QueryParameters $query_params + * The parameters of this query. + * @type \Google\Cloud\Dialogflow\Cx\V3\QueryInput $query_input + * Required. The input specification. + * @type bool $persist_parameter_changes + * Persist session parameter changes from `query_params`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * Required. The name of the session this query is sent to. + * Format: `projects//locations//agents//sessions/` or `projects//locations//agents//environments//sessions/`. + * If `Environment ID` is not specified, we assume default 'draft' + * environment. + * It's up to the API caller to choose an appropriate `Session ID`. It can be + * a random number or some type of session identifiers (preferably hashed). + * The length of the `Session ID` must not exceed 36 characters. + * For more information, see the [sessions + * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). + * + * Generated from protobuf field string session = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * The parameters of this query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryParameters query_params = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\QueryParameters|null + */ + public function getQueryParams() + { + return $this->query_params; + } + + public function hasQueryParams() + { + return isset($this->query_params); + } + + public function clearQueryParams() + { + unset($this->query_params); + } + + /** + * The parameters of this query. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryParameters query_params = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\QueryParameters $var + * @return $this + */ + public function setQueryParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\QueryParameters::class); + $this->query_params = $var; + + return $this; + } + + /** + * Required. The input specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput query_input = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\QueryInput|null + */ + public function getQueryInput() + { + return $this->query_input; + } + + public function hasQueryInput() + { + return isset($this->query_input); + } + + public function clearQueryInput() + { + unset($this->query_input); + } + + /** + * Required. The input specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.QueryInput query_input = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\QueryInput $var + * @return $this + */ + public function setQueryInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\QueryInput::class); + $this->query_input = $var; + + return $this; + } + + /** + * Persist session parameter changes from `query_params`. + * + * Generated from protobuf field bool persist_parameter_changes = 5; + * @return bool + */ + public function getPersistParameterChanges() + { + return $this->persist_parameter_changes; + } + + /** + * Persist session parameter changes from `query_params`. + * + * Generated from protobuf field bool persist_parameter_changes = 5; + * @param bool $var + * @return $this + */ + public function setPersistParameterChanges($var) + { + GPBUtil::checkBool($var); + $this->persist_parameter_changes = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/MatchIntentResponse.php b/DialogflowCx/src/V3/MatchIntentResponse.php new file mode 100644 index 000000000000..fec6319524bd --- /dev/null +++ b/DialogflowCx/src/V3/MatchIntentResponse.php @@ -0,0 +1,285 @@ +google.cloud.dialogflow.cx.v3.MatchIntentResponse + */ +class MatchIntentResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Match results, if more than one, ordered descendingly by the confidence + * we have that the particular intent matches the query. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Match matches = 4; + */ + private $matches; + /** + * The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all + * fields are filled in this message, including but not limited to `name` and + * `display_name`. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 5; + */ + protected $current_page = null; + protected $query; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was + * provided as input, this field will contain a copy of the text. + * @type string $trigger_intent + * If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as + * input, this field will contain a copy of the intent identifier. Format: + * `projects//locations//agents//intents/`. + * @type string $transcript + * If [natural language speech + * audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, + * this field will contain the transcript for the audio. + * @type string $trigger_event + * If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as + * input, this field will contain a copy of the event name. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\PBMatch>|\Google\Protobuf\Internal\RepeatedField $matches + * Match results, if more than one, ordered descendingly by the confidence + * we have that the particular intent matches the query. + * @type \Google\Cloud\Dialogflow\Cx\V3\Page $current_page + * The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all + * fields are filled in this message, including but not limited to `name` and + * `display_name`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was + * provided as input, this field will contain a copy of the text. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was + * provided as input, this field will contain a copy of the text. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as + * input, this field will contain a copy of the intent identifier. Format: + * `projects//locations//agents//intents/`. + * + * Generated from protobuf field string trigger_intent = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getTriggerIntent() + { + return $this->readOneof(2); + } + + public function hasTriggerIntent() + { + return $this->hasOneof(2); + } + + /** + * If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as + * input, this field will contain a copy of the intent identifier. Format: + * `projects//locations//agents//intents/`. + * + * Generated from protobuf field string trigger_intent = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTriggerIntent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * If [natural language speech + * audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, + * this field will contain the transcript for the audio. + * + * Generated from protobuf field string transcript = 3; + * @return string + */ + public function getTranscript() + { + return $this->readOneof(3); + } + + public function hasTranscript() + { + return $this->hasOneof(3); + } + + /** + * If [natural language speech + * audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, + * this field will contain the transcript for the audio. + * + * Generated from protobuf field string transcript = 3; + * @param string $var + * @return $this + */ + public function setTranscript($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as + * input, this field will contain a copy of the event name. + * + * Generated from protobuf field string trigger_event = 6; + * @return string + */ + public function getTriggerEvent() + { + return $this->readOneof(6); + } + + public function hasTriggerEvent() + { + return $this->hasOneof(6); + } + + /** + * If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as + * input, this field will contain a copy of the event name. + * + * Generated from protobuf field string trigger_event = 6; + * @param string $var + * @return $this + */ + public function setTriggerEvent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Match results, if more than one, ordered descendingly by the confidence + * we have that the particular intent matches the query. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Match matches = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getMatches() + { + return $this->matches; + } + + /** + * Match results, if more than one, ordered descendingly by the confidence + * we have that the particular intent matches the query. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Match matches = 4; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\PBMatch>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setMatches($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\PBMatch::class); + $this->matches = $arr; + + return $this; + } + + /** + * The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all + * fields are filled in this message, including but not limited to `name` and + * `display_name`. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 5; + * @return \Google\Cloud\Dialogflow\Cx\V3\Page|null + */ + public function getCurrentPage() + { + return $this->current_page; + } + + public function hasCurrentPage() + { + return isset($this->current_page); + } + + public function clearCurrentPage() + { + unset($this->current_page); + } + + /** + * The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all + * fields are filled in this message, including but not limited to `name` and + * `display_name`. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 5; + * @param \Google\Cloud\Dialogflow\Cx\V3\Page $var + * @return $this + */ + public function setCurrentPage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Page::class); + $this->current_page = $var; + + return $this; + } + + /** + * @return string + */ + public function getQuery() + { + return $this->whichOneof("query"); + } + +} + diff --git a/DialogflowCx/src/V3/NluSettings.php b/DialogflowCx/src/V3/NluSettings.php new file mode 100644 index 000000000000..8941c2189aef --- /dev/null +++ b/DialogflowCx/src/V3/NluSettings.php @@ -0,0 +1,155 @@ +google.cloud.dialogflow.cx.v3.NluSettings + */ +class NluSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Indicates the type of NLU model. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings.ModelType model_type = 1; + */ + protected $model_type = 0; + /** + * 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 no-match event 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. + * + * Generated from protobuf field float classification_threshold = 3; + */ + protected $classification_threshold = 0.0; + /** + * Indicates NLU model training mode. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings.ModelTrainingMode model_training_mode = 4; + */ + protected $model_training_mode = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $model_type + * Indicates the type of NLU model. + * @type float $classification_threshold + * 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 no-match event 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. + * @type int $model_training_mode + * Indicates NLU model training mode. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Flow::initOnce(); + parent::__construct($data); + } + + /** + * Indicates the type of NLU model. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings.ModelType model_type = 1; + * @return int + */ + public function getModelType() + { + return $this->model_type; + } + + /** + * Indicates the type of NLU model. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings.ModelType model_type = 1; + * @param int $var + * @return $this + */ + public function setModelType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\NluSettings\ModelType::class); + $this->model_type = $var; + + return $this; + } + + /** + * 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 no-match event 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. + * + * Generated from protobuf field float classification_threshold = 3; + * @return float + */ + public function getClassificationThreshold() + { + return $this->classification_threshold; + } + + /** + * 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 no-match event 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. + * + * Generated from protobuf field float classification_threshold = 3; + * @param float $var + * @return $this + */ + public function setClassificationThreshold($var) + { + GPBUtil::checkFloat($var); + $this->classification_threshold = $var; + + return $this; + } + + /** + * Indicates NLU model training mode. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings.ModelTrainingMode model_training_mode = 4; + * @return int + */ + public function getModelTrainingMode() + { + return $this->model_training_mode; + } + + /** + * Indicates NLU model training mode. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.NluSettings.ModelTrainingMode model_training_mode = 4; + * @param int $var + * @return $this + */ + public function setModelTrainingMode($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\NluSettings\ModelTrainingMode::class); + $this->model_training_mode = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/NluSettings/ModelTrainingMode.php b/DialogflowCx/src/V3/NluSettings/ModelTrainingMode.php new file mode 100644 index 000000000000..15ddfbc6a7b3 --- /dev/null +++ b/DialogflowCx/src/V3/NluSettings/ModelTrainingMode.php @@ -0,0 +1,64 @@ +google.cloud.dialogflow.cx.v3.NluSettings.ModelTrainingMode + */ +class ModelTrainingMode +{ + /** + * Not specified. `MODEL_TRAINING_MODE_AUTOMATIC` will be used. + * + * Generated from protobuf enum MODEL_TRAINING_MODE_UNSPECIFIED = 0; + */ + const MODEL_TRAINING_MODE_UNSPECIFIED = 0; + /** + * NLU model training is automatically triggered when a flow gets modified. + * User can also manually trigger model training in this mode. + * + * Generated from protobuf enum MODEL_TRAINING_MODE_AUTOMATIC = 1; + */ + const MODEL_TRAINING_MODE_AUTOMATIC = 1; + /** + * User needs to manually trigger NLU model training. Best for large flows + * whose models take long time to train. + * + * Generated from protobuf enum MODEL_TRAINING_MODE_MANUAL = 2; + */ + const MODEL_TRAINING_MODE_MANUAL = 2; + + private static $valueToName = [ + self::MODEL_TRAINING_MODE_UNSPECIFIED => 'MODEL_TRAINING_MODE_UNSPECIFIED', + self::MODEL_TRAINING_MODE_AUTOMATIC => 'MODEL_TRAINING_MODE_AUTOMATIC', + self::MODEL_TRAINING_MODE_MANUAL => 'MODEL_TRAINING_MODE_MANUAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/NluSettings/ModelType.php b/DialogflowCx/src/V3/NluSettings/ModelType.php new file mode 100644 index 000000000000..ae6b44f66ae3 --- /dev/null +++ b/DialogflowCx/src/V3/NluSettings/ModelType.php @@ -0,0 +1,62 @@ +google.cloud.dialogflow.cx.v3.NluSettings.ModelType + */ +class ModelType +{ + /** + * Not specified. `MODEL_TYPE_STANDARD` will be used. + * + * Generated from protobuf enum MODEL_TYPE_UNSPECIFIED = 0; + */ + const MODEL_TYPE_UNSPECIFIED = 0; + /** + * Use standard NLU model. + * + * Generated from protobuf enum MODEL_TYPE_STANDARD = 1; + */ + const MODEL_TYPE_STANDARD = 1; + /** + * Use advanced NLU model. + * + * Generated from protobuf enum MODEL_TYPE_ADVANCED = 3; + */ + const MODEL_TYPE_ADVANCED = 3; + + private static $valueToName = [ + self::MODEL_TYPE_UNSPECIFIED => 'MODEL_TYPE_UNSPECIFIED', + self::MODEL_TYPE_STANDARD => 'MODEL_TYPE_STANDARD', + self::MODEL_TYPE_ADVANCED => 'MODEL_TYPE_ADVANCED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/OutputAudioConfig.php b/DialogflowCx/src/V3/OutputAudioConfig.php new file mode 100644 index 000000000000..168224ce7ecf --- /dev/null +++ b/DialogflowCx/src/V3/OutputAudioConfig.php @@ -0,0 +1,173 @@ +google.cloud.dialogflow.cx.v3.OutputAudioConfig + */ +class OutputAudioConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Audio encoding of the synthesized audio content. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_encoding = 0; + /** + * Optional. 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). + * + * Generated from protobuf field int32 sample_rate_hertz = 2; + */ + protected $sample_rate_hertz = 0; + /** + * Optional. Configuration of how speech should be synthesized. + * If not specified, + * [Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings] + * is applied. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SynthesizeSpeechConfig synthesize_speech_config = 3; + */ + protected $synthesize_speech_config = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $audio_encoding + * Required. Audio encoding of the synthesized audio content. + * @type int $sample_rate_hertz + * Optional. 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). + * @type \Google\Cloud\Dialogflow\Cx\V3\SynthesizeSpeechConfig $synthesize_speech_config + * Optional. Configuration of how speech should be synthesized. + * If not specified, + * [Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings] + * is applied. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\AudioConfig::initOnce(); + parent::__construct($data); + } + + /** + * Required. Audio encoding of the synthesized audio content. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getAudioEncoding() + { + return $this->audio_encoding; + } + + /** + * Required. Audio encoding of the synthesized audio content. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioEncoding audio_encoding = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setAudioEncoding($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\OutputAudioEncoding::class); + $this->audio_encoding = $var; + + return $this; + } + + /** + * Optional. 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). + * + * Generated from protobuf field int32 sample_rate_hertz = 2; + * @return int + */ + public function getSampleRateHertz() + { + return $this->sample_rate_hertz; + } + + /** + * Optional. 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). + * + * Generated from protobuf field int32 sample_rate_hertz = 2; + * @param int $var + * @return $this + */ + public function setSampleRateHertz($var) + { + GPBUtil::checkInt32($var); + $this->sample_rate_hertz = $var; + + return $this; + } + + /** + * Optional. Configuration of how speech should be synthesized. + * If not specified, + * [Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings] + * is applied. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SynthesizeSpeechConfig synthesize_speech_config = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\SynthesizeSpeechConfig|null + */ + public function getSynthesizeSpeechConfig() + { + return $this->synthesize_speech_config; + } + + public function hasSynthesizeSpeechConfig() + { + return isset($this->synthesize_speech_config); + } + + public function clearSynthesizeSpeechConfig() + { + unset($this->synthesize_speech_config); + } + + /** + * Optional. Configuration of how speech should be synthesized. + * If not specified, + * [Agent.text_to_speech_settings][google.cloud.dialogflow.cx.v3.Agent.text_to_speech_settings] + * is applied. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SynthesizeSpeechConfig synthesize_speech_config = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\SynthesizeSpeechConfig $var + * @return $this + */ + public function setSynthesizeSpeechConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SynthesizeSpeechConfig::class); + $this->synthesize_speech_config = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/OutputAudioEncoding.php b/DialogflowCx/src/V3/OutputAudioEncoding.php new file mode 100644 index 000000000000..2e80a0f33a21 --- /dev/null +++ b/DialogflowCx/src/V3/OutputAudioEncoding.php @@ -0,0 +1,86 @@ +google.cloud.dialogflow.cx.v3.OutputAudioEncoding + */ +class OutputAudioEncoding +{ + /** + * Not specified. + * + * Generated from protobuf enum OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; + */ + const OUTPUT_AUDIO_ENCODING_UNSPECIFIED = 0; + /** + * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * Audio content returned as LINEAR16 also contains a WAV header. + * + * Generated from protobuf enum OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; + */ + const OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; + /** + * MP3 audio at 32kbps. + * + * Generated from protobuf enum OUTPUT_AUDIO_ENCODING_MP3 = 2; + */ + const OUTPUT_AUDIO_ENCODING_MP3 = 2; + /** + * MP3 audio at 64kbps. + * + * Generated from protobuf enum OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; + */ + const OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; + /** + * 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. + * + * Generated from protobuf enum OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; + */ + const OUTPUT_AUDIO_ENCODING_OGG_OPUS = 3; + /** + * 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. + * + * Generated from protobuf enum OUTPUT_AUDIO_ENCODING_MULAW = 5; + */ + const OUTPUT_AUDIO_ENCODING_MULAW = 5; + + private static $valueToName = [ + self::OUTPUT_AUDIO_ENCODING_UNSPECIFIED => 'OUTPUT_AUDIO_ENCODING_UNSPECIFIED', + self::OUTPUT_AUDIO_ENCODING_LINEAR_16 => 'OUTPUT_AUDIO_ENCODING_LINEAR_16', + self::OUTPUT_AUDIO_ENCODING_MP3 => 'OUTPUT_AUDIO_ENCODING_MP3', + self::OUTPUT_AUDIO_ENCODING_MP3_64_KBPS => 'OUTPUT_AUDIO_ENCODING_MP3_64_KBPS', + self::OUTPUT_AUDIO_ENCODING_OGG_OPUS => 'OUTPUT_AUDIO_ENCODING_OGG_OPUS', + self::OUTPUT_AUDIO_ENCODING_MULAW => 'OUTPUT_AUDIO_ENCODING_MULAW', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DialogflowCx/src/V3/PBMatch.php b/DialogflowCx/src/V3/PBMatch.php new file mode 100644 index 000000000000..f29581dfe795 --- /dev/null +++ b/DialogflowCx/src/V3/PBMatch.php @@ -0,0 +1,353 @@ +google.cloud.dialogflow.cx.v3.Match + */ +class PBMatch extends \Google\Protobuf\Internal\Message +{ + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the query. + * Some, not all fields are filled in this message, including but not limited + * to: `name` and `display_name`. Only filled for + * [`INTENT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 1; + */ + protected $intent = null; + /** + * The event that matched the query. Filled for + * [`EVENT`][google.cloud.dialogflow.cx.v3.Match.MatchType], + * [`NO_MATCH`][google.cloud.dialogflow.cx.v3.Match.MatchType] and + * [`NO_INPUT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match types. + * + * Generated from protobuf field string event = 6; + */ + protected $event = ''; + /** + * The collection of parameters extracted from the query. + * Depending on your protocol or client library language, this is a + * map, associative array, symbol table, dictionary, or JSON object + * composed of a collection of (MapKey, MapValue) pairs: + * * MapKey type: string + * * MapKey value: parameter name + * * MapValue type: If parameter's entity type is a composite entity then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 2; + */ + protected $parameters = null; + /** + * Final text input which was matched during MatchIntent. This value can be + * different from original input sent in request because of spelling + * correction or other processing. + * + * Generated from protobuf field string resolved_input = 3; + */ + protected $resolved_input = ''; + /** + * Type of this [Match][google.cloud.dialogflow.cx.v3.Match]. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match.MatchType match_type = 4; + */ + protected $match_type = 0; + /** + * The confidence of this match. 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. + * + * Generated from protobuf field float confidence = 5; + */ + protected $confidence = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Intent $intent + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the query. + * Some, not all fields are filled in this message, including but not limited + * to: `name` and `display_name`. Only filled for + * [`INTENT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match type. + * @type string $event + * The event that matched the query. Filled for + * [`EVENT`][google.cloud.dialogflow.cx.v3.Match.MatchType], + * [`NO_MATCH`][google.cloud.dialogflow.cx.v3.Match.MatchType] and + * [`NO_INPUT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match types. + * @type \Google\Protobuf\Struct $parameters + * The collection of parameters extracted from the query. + * Depending on your protocol or client library language, this is a + * map, associative array, symbol table, dictionary, or JSON object + * composed of a collection of (MapKey, MapValue) pairs: + * * MapKey type: string + * * MapKey value: parameter name + * * MapValue type: If parameter's entity type is a composite entity then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * @type string $resolved_input + * Final text input which was matched during MatchIntent. This value can be + * different from original input sent in request because of spelling + * correction or other processing. + * @type int $match_type + * Type of this [Match][google.cloud.dialogflow.cx.v3.Match]. + * @type float $confidence + * The confidence of this match. 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the query. + * Some, not all fields are filled in this message, including but not limited + * to: `name` and `display_name`. Only filled for + * [`INTENT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\Intent|null + */ + public function getIntent() + { + return $this->intent; + } + + public function hasIntent() + { + return isset($this->intent); + } + + public function clearIntent() + { + unset($this->intent); + } + + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the query. + * Some, not all fields are filled in this message, including but not limited + * to: `name` and `display_name`. Only filled for + * [`INTENT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\Intent $var + * @return $this + */ + public function setIntent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Intent::class); + $this->intent = $var; + + return $this; + } + + /** + * The event that matched the query. Filled for + * [`EVENT`][google.cloud.dialogflow.cx.v3.Match.MatchType], + * [`NO_MATCH`][google.cloud.dialogflow.cx.v3.Match.MatchType] and + * [`NO_INPUT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match types. + * + * Generated from protobuf field string event = 6; + * @return string + */ + public function getEvent() + { + return $this->event; + } + + /** + * The event that matched the query. Filled for + * [`EVENT`][google.cloud.dialogflow.cx.v3.Match.MatchType], + * [`NO_MATCH`][google.cloud.dialogflow.cx.v3.Match.MatchType] and + * [`NO_INPUT`][google.cloud.dialogflow.cx.v3.Match.MatchType] match types. + * + * Generated from protobuf field string event = 6; + * @param string $var + * @return $this + */ + public function setEvent($var) + { + GPBUtil::checkString($var, True); + $this->event = $var; + + return $this; + } + + /** + * The collection of parameters extracted from the query. + * Depending on your protocol or client library language, this is a + * map, associative array, symbol table, dictionary, or JSON object + * composed of a collection of (MapKey, MapValue) pairs: + * * MapKey type: string + * * MapKey value: parameter name + * * MapValue type: If parameter's entity type is a composite entity then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getParameters() + { + return $this->parameters; + } + + public function hasParameters() + { + return isset($this->parameters); + } + + public function clearParameters() + { + unset($this->parameters); + } + + /** + * The collection of parameters extracted from the query. + * Depending on your protocol or client library language, this is a + * map, associative array, symbol table, dictionary, or JSON object + * composed of a collection of (MapKey, MapValue) pairs: + * * MapKey type: string + * * MapKey value: parameter name + * * MapValue type: If parameter's entity type is a composite entity then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->parameters = $var; + + return $this; + } + + /** + * Final text input which was matched during MatchIntent. This value can be + * different from original input sent in request because of spelling + * correction or other processing. + * + * Generated from protobuf field string resolved_input = 3; + * @return string + */ + public function getResolvedInput() + { + return $this->resolved_input; + } + + /** + * Final text input which was matched during MatchIntent. This value can be + * different from original input sent in request because of spelling + * correction or other processing. + * + * Generated from protobuf field string resolved_input = 3; + * @param string $var + * @return $this + */ + public function setResolvedInput($var) + { + GPBUtil::checkString($var, True); + $this->resolved_input = $var; + + return $this; + } + + /** + * Type of this [Match][google.cloud.dialogflow.cx.v3.Match]. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match.MatchType match_type = 4; + * @return int + */ + public function getMatchType() + { + return $this->match_type; + } + + /** + * Type of this [Match][google.cloud.dialogflow.cx.v3.Match]. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match.MatchType match_type = 4; + * @param int $var + * @return $this + */ + public function setMatchType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\PBMatch\MatchType::class); + $this->match_type = $var; + + return $this; + } + + /** + * The confidence of this match. 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. + * + * Generated from protobuf field float confidence = 5; + * @return float + */ + public function getConfidence() + { + return $this->confidence; + } + + /** + * The confidence of this match. 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. + * + * Generated from protobuf field float confidence = 5; + * @param float $var + * @return $this + */ + public function setConfidence($var) + { + GPBUtil::checkFloat($var); + $this->confidence = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/PBMatch/MatchType.php b/DialogflowCx/src/V3/PBMatch/MatchType.php new file mode 100644 index 000000000000..a74a95feaae3 --- /dev/null +++ b/DialogflowCx/src/V3/PBMatch/MatchType.php @@ -0,0 +1,90 @@ +google.cloud.dialogflow.cx.v3.Match.MatchType + */ +class MatchType +{ + /** + * Not specified. Should never be used. + * + * Generated from protobuf enum MATCH_TYPE_UNSPECIFIED = 0; + */ + const MATCH_TYPE_UNSPECIFIED = 0; + /** + * The query was matched to an intent. + * + * Generated from protobuf enum INTENT = 1; + */ + const INTENT = 1; + /** + * The query directly triggered an intent. + * + * Generated from protobuf enum DIRECT_INTENT = 2; + */ + const DIRECT_INTENT = 2; + /** + * The query was used for parameter filling. + * + * Generated from protobuf enum PARAMETER_FILLING = 3; + */ + const PARAMETER_FILLING = 3; + /** + * No match was found for the query. + * + * Generated from protobuf enum NO_MATCH = 4; + */ + const NO_MATCH = 4; + /** + * Indicates an empty query. + * + * Generated from protobuf enum NO_INPUT = 5; + */ + const NO_INPUT = 5; + /** + * The query directly triggered an event. + * + * Generated from protobuf enum EVENT = 6; + */ + const EVENT = 6; + + private static $valueToName = [ + self::MATCH_TYPE_UNSPECIFIED => 'MATCH_TYPE_UNSPECIFIED', + self::INTENT => 'INTENT', + self::DIRECT_INTENT => 'DIRECT_INTENT', + self::PARAMETER_FILLING => 'PARAMETER_FILLING', + self::NO_MATCH => 'NO_MATCH', + self::NO_INPUT => 'NO_INPUT', + self::EVENT => 'EVENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/Page.php b/DialogflowCx/src/V3/Page.php new file mode 100644 index 000000000000..74248f983bd0 --- /dev/null +++ b/DialogflowCx/src/V3/Page.php @@ -0,0 +1,563 @@ +google.cloud.dialogflow.cx.v3.Page + */ +class Page extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the page. + * Required for the + * [Pages.UpdatePage][google.cloud.dialogflow.cx.v3.Pages.UpdatePage] method. + * [Pages.CreatePage][google.cloud.dialogflow.cx.v3.Pages.CreatePage] + * populates the name automatically. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the page, unique within the flow. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * The fulfillment to call when the session is entering the page. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment entry_fulfillment = 7; + */ + protected $entry_fulfillment = null; + /** + * The form associated with the page, used for collecting parameters + * relevant to the page. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Form form = 4; + */ + protected $form = null; + /** + * Ordered list of + * [`TransitionRouteGroups`][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * added to the page. Transition route groups must be unique within a page. If + * the page links both flow-level transition route groups and agent-level + * transition route groups, the flow-level ones will have higher priority and + * will be put before the agent-level ones. + * * If multiple transition routes within a page scope refer to the same + * intent, then the precedence order is: page's transition route -> page's + * transition route group -> flow's transition routes. + * * If multiple transition route groups within a page contain the same + * intent, then the first group in the ordered list takes precedence. + * Format:`projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/` for agent-level + * groups. + * + * Generated from protobuf field repeated string transition_route_groups = 11 [(.google.api.resource_reference) = { + */ + private $transition_route_groups; + /** + * A list of transitions for the transition rules of this page. + * They route the conversation to another page in the same flow, or another + * flow. + * When we are in a certain page, the TransitionRoutes are evalauted in the + * following order: + * * TransitionRoutes defined in the page with intent specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Page.transition_route_groups] + * with intent specified. + * * TransitionRoutes defined in flow with intent specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Flow.transition_route_groups] + * with intent specified. + * * TransitionRoutes defined in the page with only condition specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Page.transition_route_groups] + * with only condition specified. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRoute transition_routes = 9; + */ + private $transition_routes; + /** + * Handlers associated with the page to handle events such as webhook errors, + * no match or no input. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler event_handlers = 10; + */ + private $event_handlers; + /** + * Hierarchical advanced settings for this page. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 13; + */ + protected $advanced_settings = null; + /** + * Optional. Knowledge connector configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.KnowledgeConnectorSettings knowledge_connector_settings = 18 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $knowledge_connector_settings = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the page. + * Required for the + * [Pages.UpdatePage][google.cloud.dialogflow.cx.v3.Pages.UpdatePage] method. + * [Pages.CreatePage][google.cloud.dialogflow.cx.v3.Pages.CreatePage] + * populates the name automatically. + * Format: `projects//locations//agents//flows//pages/`. + * @type string $display_name + * Required. The human-readable name of the page, unique within the flow. + * @type \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $entry_fulfillment + * The fulfillment to call when the session is entering the page. + * @type \Google\Cloud\Dialogflow\Cx\V3\Form $form + * The form associated with the page, used for collecting parameters + * relevant to the page. + * @type array|\Google\Protobuf\Internal\RepeatedField $transition_route_groups + * Ordered list of + * [`TransitionRouteGroups`][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * added to the page. Transition route groups must be unique within a page. If + * the page links both flow-level transition route groups and agent-level + * transition route groups, the flow-level ones will have higher priority and + * will be put before the agent-level ones. + * * If multiple transition routes within a page scope refer to the same + * intent, then the precedence order is: page's transition route -> page's + * transition route group -> flow's transition routes. + * * If multiple transition route groups within a page contain the same + * intent, then the first group in the ordered list takes precedence. + * Format:`projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/` for agent-level + * groups. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TransitionRoute>|\Google\Protobuf\Internal\RepeatedField $transition_routes + * A list of transitions for the transition rules of this page. + * They route the conversation to another page in the same flow, or another + * flow. + * When we are in a certain page, the TransitionRoutes are evalauted in the + * following order: + * * TransitionRoutes defined in the page with intent specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Page.transition_route_groups] + * with intent specified. + * * TransitionRoutes defined in flow with intent specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Flow.transition_route_groups] + * with intent specified. + * * TransitionRoutes defined in the page with only condition specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Page.transition_route_groups] + * with only condition specified. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\EventHandler>|\Google\Protobuf\Internal\RepeatedField $event_handlers + * Handlers associated with the page to handle events such as webhook errors, + * no match or no input. + * @type \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $advanced_settings + * Hierarchical advanced settings for this page. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * @type \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings $knowledge_connector_settings + * Optional. Knowledge connector configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Page::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the page. + * Required for the + * [Pages.UpdatePage][google.cloud.dialogflow.cx.v3.Pages.UpdatePage] method. + * [Pages.CreatePage][google.cloud.dialogflow.cx.v3.Pages.CreatePage] + * populates the name automatically. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the page. + * Required for the + * [Pages.UpdatePage][google.cloud.dialogflow.cx.v3.Pages.UpdatePage] method. + * [Pages.CreatePage][google.cloud.dialogflow.cx.v3.Pages.CreatePage] + * populates the name automatically. + * Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the page, unique within the flow. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the page, unique within the flow. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The fulfillment to call when the session is entering the page. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment entry_fulfillment = 7; + * @return \Google\Cloud\Dialogflow\Cx\V3\Fulfillment|null + */ + public function getEntryFulfillment() + { + return $this->entry_fulfillment; + } + + public function hasEntryFulfillment() + { + return isset($this->entry_fulfillment); + } + + public function clearEntryFulfillment() + { + unset($this->entry_fulfillment); + } + + /** + * The fulfillment to call when the session is entering the page. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment entry_fulfillment = 7; + * @param \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $var + * @return $this + */ + public function setEntryFulfillment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment::class); + $this->entry_fulfillment = $var; + + return $this; + } + + /** + * The form associated with the page, used for collecting parameters + * relevant to the page. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Form form = 4; + * @return \Google\Cloud\Dialogflow\Cx\V3\Form|null + */ + public function getForm() + { + return $this->form; + } + + public function hasForm() + { + return isset($this->form); + } + + public function clearForm() + { + unset($this->form); + } + + /** + * The form associated with the page, used for collecting parameters + * relevant to the page. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Form form = 4; + * @param \Google\Cloud\Dialogflow\Cx\V3\Form $var + * @return $this + */ + public function setForm($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Form::class); + $this->form = $var; + + return $this; + } + + /** + * Ordered list of + * [`TransitionRouteGroups`][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * added to the page. Transition route groups must be unique within a page. If + * the page links both flow-level transition route groups and agent-level + * transition route groups, the flow-level ones will have higher priority and + * will be put before the agent-level ones. + * * If multiple transition routes within a page scope refer to the same + * intent, then the precedence order is: page's transition route -> page's + * transition route group -> flow's transition routes. + * * If multiple transition route groups within a page contain the same + * intent, then the first group in the ordered list takes precedence. + * Format:`projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/` for agent-level + * groups. + * + * Generated from protobuf field repeated string transition_route_groups = 11 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitionRouteGroups() + { + return $this->transition_route_groups; + } + + /** + * Ordered list of + * [`TransitionRouteGroups`][google.cloud.dialogflow.cx.v3.TransitionRouteGroup] + * added to the page. Transition route groups must be unique within a page. If + * the page links both flow-level transition route groups and agent-level + * transition route groups, the flow-level ones will have higher priority and + * will be put before the agent-level ones. + * * If multiple transition routes within a page scope refer to the same + * intent, then the precedence order is: page's transition route -> page's + * transition route group -> flow's transition routes. + * * If multiple transition route groups within a page contain the same + * intent, then the first group in the ordered list takes precedence. + * Format:`projects//locations//agents//flows//transitionRouteGroups/` + * or `projects//locations//agents//transitionRouteGroups/` for agent-level + * groups. + * + * Generated from protobuf field repeated string transition_route_groups = 11 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitionRouteGroups($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->transition_route_groups = $arr; + + return $this; + } + + /** + * A list of transitions for the transition rules of this page. + * They route the conversation to another page in the same flow, or another + * flow. + * When we are in a certain page, the TransitionRoutes are evalauted in the + * following order: + * * TransitionRoutes defined in the page with intent specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Page.transition_route_groups] + * with intent specified. + * * TransitionRoutes defined in flow with intent specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Flow.transition_route_groups] + * with intent specified. + * * TransitionRoutes defined in the page with only condition specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Page.transition_route_groups] + * with only condition specified. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRoute transition_routes = 9; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTransitionRoutes() + { + return $this->transition_routes; + } + + /** + * A list of transitions for the transition rules of this page. + * They route the conversation to another page in the same flow, or another + * flow. + * When we are in a certain page, the TransitionRoutes are evalauted in the + * following order: + * * TransitionRoutes defined in the page with intent specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Page.transition_route_groups] + * with intent specified. + * * TransitionRoutes defined in flow with intent specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Flow.transition_route_groups] + * with intent specified. + * * TransitionRoutes defined in the page with only condition specified. + * * TransitionRoutes defined in the + * [transition route + * groups][google.cloud.dialogflow.cx.v3.Page.transition_route_groups] + * with only condition specified. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TransitionRoute transition_routes = 9; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TransitionRoute>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTransitionRoutes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TransitionRoute::class); + $this->transition_routes = $arr; + + return $this; + } + + /** + * Handlers associated with the page to handle events such as webhook errors, + * no match or no input. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler event_handlers = 10; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getEventHandlers() + { + return $this->event_handlers; + } + + /** + * Handlers associated with the page to handle events such as webhook errors, + * no match or no input. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.EventHandler event_handlers = 10; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\EventHandler>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setEventHandlers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\EventHandler::class); + $this->event_handlers = $arr; + + return $this; + } + + /** + * Hierarchical advanced settings for this page. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 13; + * @return \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings|null + */ + public function getAdvancedSettings() + { + return $this->advanced_settings; + } + + public function hasAdvancedSettings() + { + return isset($this->advanced_settings); + } + + public function clearAdvancedSettings() + { + unset($this->advanced_settings); + } + + /** + * Hierarchical advanced settings for this page. The settings exposed at the + * lower level overrides the settings exposed at the higher level. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 13; + * @param \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $var + * @return $this + */ + public function setAdvancedSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::class); + $this->advanced_settings = $var; + + return $this; + } + + /** + * Optional. Knowledge connector configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.KnowledgeConnectorSettings knowledge_connector_settings = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings|null + */ + public function getKnowledgeConnectorSettings() + { + return $this->knowledge_connector_settings; + } + + public function hasKnowledgeConnectorSettings() + { + return isset($this->knowledge_connector_settings); + } + + public function clearKnowledgeConnectorSettings() + { + unset($this->knowledge_connector_settings); + } + + /** + * Optional. Knowledge connector configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.KnowledgeConnectorSettings knowledge_connector_settings = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings $var + * @return $this + */ + public function setKnowledgeConnectorSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings::class); + $this->knowledge_connector_settings = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/PageInfo.php b/DialogflowCx/src/V3/PageInfo.php new file mode 100644 index 000000000000..8c9ad6fbebf2 --- /dev/null +++ b/DialogflowCx/src/V3/PageInfo.php @@ -0,0 +1,189 @@ +google.cloud.dialogflow.cx.v3.PageInfo + */ +class PageInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * unique identifier of the current page. Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string current_page = 1 [(.google.api.resource_reference) = { + */ + protected $current_page = ''; + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * display name of the current page. + * + * Generated from protobuf field string display_name = 4; + */ + protected $display_name = ''; + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Information about the form. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo form_info = 3; + */ + protected $form_info = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $current_page + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * unique identifier of the current page. Format: `projects//locations//agents//flows//pages/`. + * @type string $display_name + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * display name of the current page. + * @type \Google\Cloud\Dialogflow\Cx\V3\PageInfo\FormInfo $form_info + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Information about the form. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * unique identifier of the current page. Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string current_page = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getCurrentPage() + { + return $this->current_page; + } + + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * unique identifier of the current page. Format: `projects//locations//agents//flows//pages/`. + * + * Generated from protobuf field string current_page = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCurrentPage($var) + { + GPBUtil::checkString($var, True); + $this->current_page = $var; + + return $this; + } + + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * display name of the current page. + * + * Generated from protobuf field string display_name = 4; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * display name of the current page. + * + * Generated from protobuf field string display_name = 4; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Information about the form. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo form_info = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\PageInfo\FormInfo|null + */ + public function getFormInfo() + { + return $this->form_info; + } + + public function hasFormInfo() + { + return isset($this->form_info); + } + + public function clearFormInfo() + { + unset($this->form_info); + } + + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Information about the form. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo form_info = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\PageInfo\FormInfo $var + * @return $this + */ + public function setFormInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PageInfo\FormInfo::class); + $this->form_info = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/PageInfo/FormInfo.php b/DialogflowCx/src/V3/PageInfo/FormInfo.php new file mode 100644 index 000000000000..9290f4502797 --- /dev/null +++ b/DialogflowCx/src/V3/PageInfo/FormInfo.php @@ -0,0 +1,84 @@ +google.cloud.dialogflow.cx.v3.PageInfo.FormInfo + */ +class FormInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * parameters contained in the form. Note that the webhook cannot add or + * remove any form parameter. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo parameter_info = 2; + */ + private $parameter_info; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\PageInfo\FormInfo\ParameterInfo>|\Google\Protobuf\Internal\RepeatedField $parameter_info + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * parameters contained in the form. Note that the webhook cannot add or + * remove any form parameter. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * parameters contained in the form. Note that the webhook cannot add or + * remove any form parameter. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo parameter_info = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getParameterInfo() + { + return $this->parameter_info; + } + + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * parameters contained in the form. Note that the webhook cannot add or + * remove any form parameter. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo parameter_info = 2; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\PageInfo\FormInfo\ParameterInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setParameterInfo($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\PageInfo\FormInfo\ParameterInfo::class); + $this->parameter_info = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/PageInfo/FormInfo/ParameterInfo.php b/DialogflowCx/src/V3/PageInfo/FormInfo/ParameterInfo.php new file mode 100644 index 000000000000..452753eb00d2 --- /dev/null +++ b/DialogflowCx/src/V3/PageInfo/FormInfo/ParameterInfo.php @@ -0,0 +1,314 @@ +google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo + */ +class ParameterInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + * Required for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * The human-readable name of the parameter, unique within the form. This + * field cannot be modified by the webhook. + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Indicates whether the parameter is required. Optional parameters will + * not trigger prompts; however, they are filled if the user specifies + * them. Required parameters must be filled before form filling concludes. + * + * Generated from protobuf field bool required = 2; + */ + protected $required = false; + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + * Required for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * state of the parameter. This field can be set to + * [INVALID][google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState.INVALID] + * by the webhook to invalidate the parameter; other values set by the + * webhook will be ignored. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState state = 3; + */ + protected $state = 0; + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * value of the parameter. This field can be set by the webhook to change + * the parameter value. + * + * Generated from protobuf field .google.protobuf.Value value = 4; + */ + protected $value = null; + /** + * Optional for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored + * for [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Indicates if the parameter value was just collected on the last + * conversation turn. + * + * Generated from protobuf field bool just_collected = 5; + */ + protected $just_collected = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + * Required for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * The human-readable name of the parameter, unique within the form. This + * field cannot be modified by the webhook. + * @type bool $required + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Indicates whether the parameter is required. Optional parameters will + * not trigger prompts; however, they are filled if the user specifies + * them. Required parameters must be filled before form filling concludes. + * @type int $state + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + * Required for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * state of the parameter. This field can be set to + * [INVALID][google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState.INVALID] + * by the webhook to invalidate the parameter; other values set by the + * webhook will be ignored. + * @type \Google\Protobuf\Value $value + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * value of the parameter. This field can be set by the webhook to change + * the parameter value. + * @type bool $just_collected + * Optional for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored + * for [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Indicates if the parameter value was just collected on the last + * conversation turn. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + * Required for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * The human-readable name of the parameter, unique within the form. This + * field cannot be modified by the webhook. + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + * Required for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * The human-readable name of the parameter, unique within the form. This + * field cannot be modified by the webhook. + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Indicates whether the parameter is required. Optional parameters will + * not trigger prompts; however, they are filled if the user specifies + * them. Required parameters must be filled before form filling concludes. + * + * Generated from protobuf field bool required = 2; + * @return bool + */ + public function getRequired() + { + return $this->required; + } + + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Indicates whether the parameter is required. Optional parameters will + * not trigger prompts; however, they are filled if the user specifies + * them. Required parameters must be filled before form filling concludes. + * + * Generated from protobuf field bool required = 2; + * @param bool $var + * @return $this + */ + public function setRequired($var) + { + GPBUtil::checkBool($var); + $this->required = $var; + + return $this; + } + + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + * Required for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * state of the parameter. This field can be set to + * [INVALID][google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState.INVALID] + * by the webhook to invalidate the parameter; other values set by the + * webhook will be ignored. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState state = 3; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Always present for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. + * Required for + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * state of the parameter. This field can be set to + * [INVALID][google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState.INVALID] + * by the webhook to invalidate the parameter; other values set by the + * webhook will be ignored. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState state = 3; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\PageInfo\FormInfo\ParameterInfo\ParameterState::class); + $this->state = $var; + + return $this; + } + + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * value of the parameter. This field can be set by the webhook to change + * the parameter value. + * + * Generated from protobuf field .google.protobuf.Value value = 4; + * @return \Google\Protobuf\Value|null + */ + public function getValue() + { + return $this->value; + } + + public function hasValue() + { + return isset($this->value); + } + + public function clearValue() + { + unset($this->value); + } + + /** + * Optional for both + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest] and + * [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. The + * value of the parameter. This field can be set by the webhook to change + * the parameter value. + * + * Generated from protobuf field .google.protobuf.Value value = 4; + * @param \Google\Protobuf\Value $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Value::class); + $this->value = $var; + + return $this; + } + + /** + * Optional for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored + * for [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Indicates if the parameter value was just collected on the last + * conversation turn. + * + * Generated from protobuf field bool just_collected = 5; + * @return bool + */ + public function getJustCollected() + { + return $this->just_collected; + } + + /** + * Optional for + * [WebhookRequest][google.cloud.dialogflow.cx.v3.WebhookRequest]. Ignored + * for [WebhookResponse][google.cloud.dialogflow.cx.v3.WebhookResponse]. + * Indicates if the parameter value was just collected on the last + * conversation turn. + * + * Generated from protobuf field bool just_collected = 5; + * @param bool $var + * @return $this + */ + public function setJustCollected($var) + { + GPBUtil::checkBool($var); + $this->just_collected = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/PageInfo/FormInfo/ParameterInfo/ParameterState.php b/DialogflowCx/src/V3/PageInfo/FormInfo/ParameterInfo/ParameterState.php new file mode 100644 index 000000000000..f45308399516 --- /dev/null +++ b/DialogflowCx/src/V3/PageInfo/FormInfo/ParameterInfo/ParameterState.php @@ -0,0 +1,75 @@ +google.cloud.dialogflow.cx.v3.PageInfo.FormInfo.ParameterInfo.ParameterState + */ +class ParameterState +{ + /** + * Not specified. This value should be never used. + * + * Generated from protobuf enum PARAMETER_STATE_UNSPECIFIED = 0; + */ + const PARAMETER_STATE_UNSPECIFIED = 0; + /** + * Indicates that the parameter does not have a value. + * + * Generated from protobuf enum EMPTY = 1; + */ + const PBEMPTY = 1; + /** + * Indicates that the parameter value is invalid. This field can be used + * by the webhook to invalidate the parameter and ask the server to + * collect it from the user again. + * + * Generated from protobuf enum INVALID = 2; + */ + const INVALID = 2; + /** + * Indicates that the parameter has a value. + * + * Generated from protobuf enum FILLED = 3; + */ + const FILLED = 3; + + private static $valueToName = [ + self::PARAMETER_STATE_UNSPECIFIED => 'PARAMETER_STATE_UNSPECIFIED', + self::PBEMPTY => 'EMPTY', + self::INVALID => 'INVALID', + self::FILLED => 'FILLED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/PagesClient.php b/DialogflowCx/src/V3/PagesClient.php new file mode 100644 index 000000000000..fac3beb52315 --- /dev/null +++ b/DialogflowCx/src/V3/PagesClient.php @@ -0,0 +1,34 @@ +google.cloud.dialogflow.cx.v3.QueryInput + */ +class QueryInput extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The language of the input. See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * 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. + * + * Generated from protobuf field string language_code = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $language_code = ''; + protected $input; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\TextInput $text + * The natural language text to be processed. + * @type \Google\Cloud\Dialogflow\Cx\V3\IntentInput $intent + * The intent to be triggered. + * @type \Google\Cloud\Dialogflow\Cx\V3\AudioInput $audio + * The natural language speech audio to be processed. + * @type \Google\Cloud\Dialogflow\Cx\V3\EventInput $event + * The event to be triggered. + * @type \Google\Cloud\Dialogflow\Cx\V3\DtmfInput $dtmf + * The DTMF event to be handled. + * @type string $language_code + * Required. The language of the input. See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * 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. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * The natural language text to be processed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TextInput text = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\TextInput|null + */ + public function getText() + { + return $this->readOneof(2); + } + + public function hasText() + { + return $this->hasOneof(2); + } + + /** + * The natural language text to be processed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TextInput text = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\TextInput $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TextInput::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * The intent to be triggered. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.IntentInput intent = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\IntentInput|null + */ + public function getIntent() + { + return $this->readOneof(3); + } + + public function hasIntent() + { + return $this->hasOneof(3); + } + + /** + * The intent to be triggered. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.IntentInput intent = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\IntentInput $var + * @return $this + */ + public function setIntent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\IntentInput::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The natural language speech audio to be processed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AudioInput audio = 5; + * @return \Google\Cloud\Dialogflow\Cx\V3\AudioInput|null + */ + public function getAudio() + { + return $this->readOneof(5); + } + + public function hasAudio() + { + return $this->hasOneof(5); + } + + /** + * The natural language speech audio to be processed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AudioInput audio = 5; + * @param \Google\Cloud\Dialogflow\Cx\V3\AudioInput $var + * @return $this + */ + public function setAudio($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AudioInput::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * The event to be triggered. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EventInput event = 6; + * @return \Google\Cloud\Dialogflow\Cx\V3\EventInput|null + */ + public function getEvent() + { + return $this->readOneof(6); + } + + public function hasEvent() + { + return $this->hasOneof(6); + } + + /** + * The event to be triggered. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.EventInput event = 6; + * @param \Google\Cloud\Dialogflow\Cx\V3\EventInput $var + * @return $this + */ + public function setEvent($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\EventInput::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * The DTMF event to be handled. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DtmfInput dtmf = 7; + * @return \Google\Cloud\Dialogflow\Cx\V3\DtmfInput|null + */ + public function getDtmf() + { + return $this->readOneof(7); + } + + public function hasDtmf() + { + return $this->hasOneof(7); + } + + /** + * The DTMF event to be handled. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DtmfInput dtmf = 7; + * @param \Google\Cloud\Dialogflow\Cx\V3\DtmfInput $var + * @return $this + */ + public function setDtmf($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\DtmfInput::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Required. The language of the input. See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * 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. + * + * Generated from protobuf field string language_code = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Required. The language of the input. See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * 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. + * + * Generated from protobuf field string language_code = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * @return string + */ + public function getInput() + { + return $this->whichOneof("input"); + } + +} + diff --git a/DialogflowCx/src/V3/QueryParameters.php b/DialogflowCx/src/V3/QueryParameters.php new file mode 100644 index 000000000000..238b2eda2a52 --- /dev/null +++ b/DialogflowCx/src/V3/QueryParameters.php @@ -0,0 +1,765 @@ +google.cloud.dialogflow.cx.v3.QueryParameters + */ +class QueryParameters extends \Google\Protobuf\Internal\Message +{ + /** + * The time zone of this conversational query from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. If not provided, the time zone specified in the agent is + * used. + * + * Generated from protobuf field string time_zone = 1; + */ + protected $time_zone = ''; + /** + * The geo location of this conversational query. + * + * Generated from protobuf field .google.type.LatLng geo_location = 2; + */ + protected $geo_location = null; + /** + * 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. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_types = 3; + */ + private $session_entity_types; + /** + * This field can be used to pass custom data into the webhook associated with + * the agent. Arbitrary JSON objects are supported. + * 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: + * ``` + * { + * "telephony": { + * "caller_id": "+18558363987" + * } + * } + * ``` + * + * Generated from protobuf field .google.protobuf.Struct payload = 4; + */ + protected $payload = null; + /** + * Additional parameters to be put into [session + * parameters][SessionInfo.parameters]. To remove a + * parameter from the session, clients should explicitly set the parameter + * value to null. + * You can reference the session parameters in the agent with the following + * format: $session.params.parameter-id. + * 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 then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 5; + */ + protected $parameters = null; + /** + * The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to + * override the [current page][QueryResult.current_page] in the session. + * Format: `projects//locations//agents//flows//pages/`. + * If `current_page` is specified, the previous state of the session will be + * ignored by Dialogflow, including the [previous + * page][QueryResult.current_page] and the [previous session + * parameters][QueryResult.parameters]. + * In most cases, + * [current_page][google.cloud.dialogflow.cx.v3.QueryParameters.current_page] + * and [parameters][google.cloud.dialogflow.cx.v3.QueryParameters.parameters] + * should be configured together to direct a session to a specific state. + * + * Generated from protobuf field string current_page = 6 [(.google.api.resource_reference) = { + */ + protected $current_page = ''; + /** + * Whether to disable webhook calls for this request. + * + * Generated from protobuf field bool disable_webhook = 7; + */ + protected $disable_webhook = false; + /** + * Configures whether sentiment analysis should be performed. If not + * provided, sentiment analysis is not performed. + * + * Generated from protobuf field bool analyze_query_text_sentiment = 8; + */ + protected $analyze_query_text_sentiment = false; + /** + * 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. + * + * Generated from protobuf field map webhook_headers = 10; + */ + private $webhook_headers; + /** + * A list of flow versions to override for the request. + * Format: `projects//locations//agents//flows//versions/`. + * If version 1 of flow X is included in this list, the traffic of + * flow X will go through version 1 regardless of the version configuration in + * the environment. Each flow can have at most one version specified in this + * list. + * + * Generated from protobuf field repeated string flow_versions = 14 [(.google.api.resource_reference) = { + */ + private $flow_versions; + /** + * The channel which this query is for. + * If specified, only the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] associated + * with the channel will be returned. If no + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] is + * associated with the channel, it falls back to the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with + * unspecified channel. + * If unspecified, the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with + * unspecified channel will be returned. + * + * Generated from protobuf field string channel = 15; + */ + protected $channel = ''; + /** + * Optional. Sets Dialogflow session life time. + * By default, a Dialogflow session remains active and its data is stored for + * 30 minutes after the last request is sent for the session. + * This value should be no longer than 1 day. + * + * Generated from protobuf field .google.protobuf.Duration session_ttl = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $session_ttl = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $time_zone + * The time zone of this conversational query from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. If not provided, the time zone specified in the agent is + * used. + * @type \Google\Type\LatLng $geo_location + * The geo location of this conversational query. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType>|\Google\Protobuf\Internal\RepeatedField $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. + * @type \Google\Protobuf\Struct $payload + * This field can be used to pass custom data into the webhook associated with + * the agent. Arbitrary JSON objects are supported. + * 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: + * ``` + * { + * "telephony": { + * "caller_id": "+18558363987" + * } + * } + * ``` + * @type \Google\Protobuf\Struct $parameters + * Additional parameters to be put into [session + * parameters][SessionInfo.parameters]. To remove a + * parameter from the session, clients should explicitly set the parameter + * value to null. + * You can reference the session parameters in the agent with the following + * format: $session.params.parameter-id. + * 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 then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * @type string $current_page + * The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to + * override the [current page][QueryResult.current_page] in the session. + * Format: `projects//locations//agents//flows//pages/`. + * If `current_page` is specified, the previous state of the session will be + * ignored by Dialogflow, including the [previous + * page][QueryResult.current_page] and the [previous session + * parameters][QueryResult.parameters]. + * In most cases, + * [current_page][google.cloud.dialogflow.cx.v3.QueryParameters.current_page] + * and [parameters][google.cloud.dialogflow.cx.v3.QueryParameters.parameters] + * should be configured together to direct a session to a specific state. + * @type bool $disable_webhook + * Whether to disable webhook calls for this request. + * @type bool $analyze_query_text_sentiment + * Configures whether sentiment analysis should be performed. If not + * provided, sentiment analysis is not performed. + * @type array|\Google\Protobuf\Internal\MapField $webhook_headers + * 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. + * @type array|\Google\Protobuf\Internal\RepeatedField $flow_versions + * A list of flow versions to override for the request. + * Format: `projects//locations//agents//flows//versions/`. + * If version 1 of flow X is included in this list, the traffic of + * flow X will go through version 1 regardless of the version configuration in + * the environment. Each flow can have at most one version specified in this + * list. + * @type string $channel + * The channel which this query is for. + * If specified, only the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] associated + * with the channel will be returned. If no + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] is + * associated with the channel, it falls back to the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with + * unspecified channel. + * If unspecified, the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with + * unspecified channel will be returned. + * @type \Google\Protobuf\Duration $session_ttl + * Optional. Sets Dialogflow session life time. + * By default, a Dialogflow session remains active and its data is stored for + * 30 minutes after the last request is sent for the session. + * This value should be no longer than 1 day. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * The time zone of this conversational query from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. If not provided, the time zone specified in the agent is + * used. + * + * Generated from protobuf field string time_zone = 1; + * @return string + */ + public function getTimeZone() + { + return $this->time_zone; + } + + /** + * The time zone of this conversational query from the [time zone + * database](https://www.iana.org/time-zones), e.g., America/New_York, + * Europe/Paris. If not provided, the time zone specified in the agent is + * used. + * + * Generated from protobuf field string time_zone = 1; + * @param string $var + * @return $this + */ + public function setTimeZone($var) + { + GPBUtil::checkString($var, True); + $this->time_zone = $var; + + return $this; + } + + /** + * The geo location of this conversational query. + * + * Generated from protobuf field .google.type.LatLng geo_location = 2; + * @return \Google\Type\LatLng|null + */ + public function getGeoLocation() + { + return $this->geo_location; + } + + public function hasGeoLocation() + { + return isset($this->geo_location); + } + + public function clearGeoLocation() + { + unset($this->geo_location); + } + + /** + * The geo location of this conversational query. + * + * Generated from protobuf field .google.type.LatLng geo_location = 2; + * @param \Google\Type\LatLng $var + * @return $this + */ + public function setGeoLocation($var) + { + GPBUtil::checkMessage($var, \Google\Type\LatLng::class); + $this->geo_location = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_types = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSessionEntityTypes() + { + return $this->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. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SessionEntityType session_entity_types = 3; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\SessionEntityType>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSessionEntityTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\SessionEntityType::class); + $this->session_entity_types = $arr; + + return $this; + } + + /** + * This field can be used to pass custom data into the webhook associated with + * the agent. Arbitrary JSON objects are supported. + * 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: + * ``` + * { + * "telephony": { + * "caller_id": "+18558363987" + * } + * } + * ``` + * + * Generated from protobuf field .google.protobuf.Struct payload = 4; + * @return \Google\Protobuf\Struct|null + */ + public function getPayload() + { + return $this->payload; + } + + public function hasPayload() + { + return isset($this->payload); + } + + public function clearPayload() + { + unset($this->payload); + } + + /** + * This field can be used to pass custom data into the webhook associated with + * the agent. Arbitrary JSON objects are supported. + * 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: + * ``` + * { + * "telephony": { + * "caller_id": "+18558363987" + * } + * } + * ``` + * + * Generated from protobuf field .google.protobuf.Struct payload = 4; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->payload = $var; + + return $this; + } + + /** + * Additional parameters to be put into [session + * parameters][SessionInfo.parameters]. To remove a + * parameter from the session, clients should explicitly set the parameter + * value to null. + * You can reference the session parameters in the agent with the following + * format: $session.params.parameter-id. + * 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 then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 5; + * @return \Google\Protobuf\Struct|null + */ + public function getParameters() + { + return $this->parameters; + } + + public function hasParameters() + { + return isset($this->parameters); + } + + public function clearParameters() + { + unset($this->parameters); + } + + /** + * Additional parameters to be put into [session + * parameters][SessionInfo.parameters]. To remove a + * parameter from the session, clients should explicitly set the parameter + * value to null. + * You can reference the session parameters in the agent with the following + * format: $session.params.parameter-id. + * 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 then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 5; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->parameters = $var; + + return $this; + } + + /** + * The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to + * override the [current page][QueryResult.current_page] in the session. + * Format: `projects//locations//agents//flows//pages/`. + * If `current_page` is specified, the previous state of the session will be + * ignored by Dialogflow, including the [previous + * page][QueryResult.current_page] and the [previous session + * parameters][QueryResult.parameters]. + * In most cases, + * [current_page][google.cloud.dialogflow.cx.v3.QueryParameters.current_page] + * and [parameters][google.cloud.dialogflow.cx.v3.QueryParameters.parameters] + * should be configured together to direct a session to a specific state. + * + * Generated from protobuf field string current_page = 6 [(.google.api.resource_reference) = { + * @return string + */ + public function getCurrentPage() + { + return $this->current_page; + } + + /** + * The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to + * override the [current page][QueryResult.current_page] in the session. + * Format: `projects//locations//agents//flows//pages/`. + * If `current_page` is specified, the previous state of the session will be + * ignored by Dialogflow, including the [previous + * page][QueryResult.current_page] and the [previous session + * parameters][QueryResult.parameters]. + * In most cases, + * [current_page][google.cloud.dialogflow.cx.v3.QueryParameters.current_page] + * and [parameters][google.cloud.dialogflow.cx.v3.QueryParameters.parameters] + * should be configured together to direct a session to a specific state. + * + * Generated from protobuf field string current_page = 6 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCurrentPage($var) + { + GPBUtil::checkString($var, True); + $this->current_page = $var; + + return $this; + } + + /** + * Whether to disable webhook calls for this request. + * + * Generated from protobuf field bool disable_webhook = 7; + * @return bool + */ + public function getDisableWebhook() + { + return $this->disable_webhook; + } + + /** + * Whether to disable webhook calls for this request. + * + * Generated from protobuf field bool disable_webhook = 7; + * @param bool $var + * @return $this + */ + public function setDisableWebhook($var) + { + GPBUtil::checkBool($var); + $this->disable_webhook = $var; + + return $this; + } + + /** + * Configures whether sentiment analysis should be performed. If not + * provided, sentiment analysis is not performed. + * + * Generated from protobuf field bool analyze_query_text_sentiment = 8; + * @return bool + */ + public function getAnalyzeQueryTextSentiment() + { + return $this->analyze_query_text_sentiment; + } + + /** + * Configures whether sentiment analysis should be performed. If not + * provided, sentiment analysis is not performed. + * + * Generated from protobuf field bool analyze_query_text_sentiment = 8; + * @param bool $var + * @return $this + */ + public function setAnalyzeQueryTextSentiment($var) + { + GPBUtil::checkBool($var); + $this->analyze_query_text_sentiment = $var; + + return $this; + } + + /** + * 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. + * + * Generated from protobuf field map webhook_headers = 10; + * @return \Google\Protobuf\Internal\MapField + */ + public function getWebhookHeaders() + { + return $this->webhook_headers; + } + + /** + * 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. + * + * Generated from protobuf field map webhook_headers = 10; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setWebhookHeaders($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->webhook_headers = $arr; + + return $this; + } + + /** + * A list of flow versions to override for the request. + * Format: `projects//locations//agents//flows//versions/`. + * If version 1 of flow X is included in this list, the traffic of + * flow X will go through version 1 regardless of the version configuration in + * the environment. Each flow can have at most one version specified in this + * list. + * + * Generated from protobuf field repeated string flow_versions = 14 [(.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFlowVersions() + { + return $this->flow_versions; + } + + /** + * A list of flow versions to override for the request. + * Format: `projects//locations//agents//flows//versions/`. + * If version 1 of flow X is included in this list, the traffic of + * flow X will go through version 1 regardless of the version configuration in + * the environment. Each flow can have at most one version specified in this + * list. + * + * Generated from protobuf field repeated string flow_versions = 14 [(.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFlowVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->flow_versions = $arr; + + return $this; + } + + /** + * The channel which this query is for. + * If specified, only the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] associated + * with the channel will be returned. If no + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] is + * associated with the channel, it falls back to the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with + * unspecified channel. + * If unspecified, the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with + * unspecified channel will be returned. + * + * Generated from protobuf field string channel = 15; + * @return string + */ + public function getChannel() + { + return $this->channel; + } + + /** + * The channel which this query is for. + * If specified, only the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] associated + * with the channel will be returned. If no + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] is + * associated with the channel, it falls back to the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with + * unspecified channel. + * If unspecified, the + * [ResponseMessage][google.cloud.dialogflow.cx.v3.ResponseMessage] with + * unspecified channel will be returned. + * + * Generated from protobuf field string channel = 15; + * @param string $var + * @return $this + */ + public function setChannel($var) + { + GPBUtil::checkString($var, True); + $this->channel = $var; + + return $this; + } + + /** + * Optional. Sets Dialogflow session life time. + * By default, a Dialogflow session remains active and its data is stored for + * 30 minutes after the last request is sent for the session. + * This value should be no longer than 1 day. + * + * Generated from protobuf field .google.protobuf.Duration session_ttl = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Duration|null + */ + public function getSessionTtl() + { + return $this->session_ttl; + } + + public function hasSessionTtl() + { + return isset($this->session_ttl); + } + + public function clearSessionTtl() + { + unset($this->session_ttl); + } + + /** + * Optional. Sets Dialogflow session life time. + * By default, a Dialogflow session remains active and its data is stored for + * 30 minutes after the last request is sent for the session. + * This value should be no longer than 1 day. + * + * Generated from protobuf field .google.protobuf.Duration session_ttl = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setSessionTtl($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->session_ttl = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/QueryResult.php b/DialogflowCx/src/V3/QueryResult.php new file mode 100644 index 000000000000..7a4ab40c86b2 --- /dev/null +++ b/DialogflowCx/src/V3/QueryResult.php @@ -0,0 +1,948 @@ +google.cloud.dialogflow.cx.v3.QueryResult + */ +class QueryResult extends \Google\Protobuf\Internal\Message +{ + /** + * The language that was triggered during intent detection. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * + * Generated from protobuf field string language_code = 2; + */ + protected $language_code = ''; + /** + * The collected [session + * parameters][google.cloud.dialogflow.cx.v3.SessionInfo.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 then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 3; + */ + protected $parameters = null; + /** + * The list of rich messages returned to the client. Responses vary from + * simple text messages to more sophisticated, structured payloads used + * to drive complex logic. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage response_messages = 4; + */ + private $response_messages; + /** + * The list of webhook call status in the order of call sequence. + * + * Generated from protobuf field repeated .google.rpc.Status webhook_statuses = 13; + */ + private $webhook_statuses; + /** + * The list of webhook payload in + * [WebhookResponse.payload][google.cloud.dialogflow.cx.v3.WebhookResponse.payload], + * in the order of call sequence. If some webhook call fails or doesn't return + * any payload, an empty `Struct` would be used instead. + * + * Generated from protobuf field repeated .google.protobuf.Struct webhook_payloads = 6; + */ + private $webhook_payloads; + /** + * The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all + * fields are filled in this message, including but not limited to `name` and + * `display_name`. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 7; + */ + protected $current_page = null; + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the + * conversational query. Some, not all fields are filled in this message, + * including but not limited to: `name` and `display_name`. This field is + * deprecated, please use + * [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] + * instead. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 8 [deprecated = true]; + * @deprecated + */ + protected $intent = null; + /** + * 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. + * This field is deprecated, please use + * [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] + * instead. + * + * Generated from protobuf field float intent_detection_confidence = 9 [deprecated = true]; + * @deprecated + */ + protected $intent_detection_confidence = 0.0; + /** + * Intent match result, could be an intent or an event. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match match = 15; + */ + protected $match = null; + /** + * The free-form diagnostic info. For example, this field could contain + * webhook call latency. The fields of this data can change without notice, + * so you should not write code that depends on its structure. + * One of the fields is called "Alternative Matched Intents", which may + * aid with debugging. The following describes these intent results: + * - The list is empty if no intent was matched to end-user input. + * - Only intents that are referenced in the currently active flow are + * included. + * - The matched intent is included. + * - Other intents that could have matched end-user input, but did not match + * because they are referenced by intent routes that are out of + * [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), + * are included. + * - Other intents referenced by intent routes in scope that matched end-user + * input, but had a lower confidence score. + * + * Generated from protobuf field .google.protobuf.Struct diagnostic_info = 10; + */ + protected $diagnostic_info = null; + /** + * The sentiment analyss result, which depends on + * [`analyze_query_text_sentiment`] + * [google.cloud.dialogflow.cx.v3.QueryParameters.analyze_query_text_sentiment], + * specified in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SentimentAnalysisResult sentiment_analysis_result = 17; + */ + protected $sentiment_analysis_result = null; + /** + * Returns the current advanced settings including IVR settings. Even though + * the operations configured by these settings are performed by Dialogflow, + * the client may need to perform special logic at the moment. For example, if + * Dialogflow exports audio to Google Cloud Storage, then the client may need + * to wait for the resulting object to appear in the bucket before proceeding. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 21; + */ + protected $advanced_settings = null; + protected $query; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was + * provided as input, this field will contain a copy of the text. + * @type string $trigger_intent + * If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as + * input, this field will contain a copy of the intent identifier. Format: + * `projects//locations//agents//intents/`. + * @type string $transcript + * If [natural language speech + * audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, + * this field will contain the transcript for the audio. + * @type string $trigger_event + * If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as + * input, this field will contain the name of the event. + * @type \Google\Cloud\Dialogflow\Cx\V3\DtmfInput $dtmf + * If a [DTMF][google.cloud.dialogflow.cx.v3.DtmfInput] was provided as + * input, this field will contain a copy of the + * [DtmfInput][google.cloud.dialogflow.cx.v3.DtmfInput]. + * @type string $language_code + * The language that was triggered during intent detection. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * @type \Google\Protobuf\Struct $parameters + * The collected [session + * parameters][google.cloud.dialogflow.cx.v3.SessionInfo.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 then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage>|\Google\Protobuf\Internal\RepeatedField $response_messages + * The list of rich messages returned to the client. Responses vary from + * simple text messages to more sophisticated, structured payloads used + * to drive complex logic. + * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $webhook_statuses + * The list of webhook call status in the order of call sequence. + * @type array<\Google\Protobuf\Struct>|\Google\Protobuf\Internal\RepeatedField $webhook_payloads + * The list of webhook payload in + * [WebhookResponse.payload][google.cloud.dialogflow.cx.v3.WebhookResponse.payload], + * in the order of call sequence. If some webhook call fails or doesn't return + * any payload, an empty `Struct` would be used instead. + * @type \Google\Cloud\Dialogflow\Cx\V3\Page $current_page + * The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all + * fields are filled in this message, including but not limited to `name` and + * `display_name`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Intent $intent + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the + * conversational query. Some, not all fields are filled in this message, + * including but not limited to: `name` and `display_name`. This field is + * deprecated, please use + * [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] + * instead. + * @type float $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. + * This field is deprecated, please use + * [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] + * instead. + * @type \Google\Cloud\Dialogflow\Cx\V3\PBMatch $match + * Intent match result, could be an intent or an event. + * @type \Google\Protobuf\Struct $diagnostic_info + * The free-form diagnostic info. For example, this field could contain + * webhook call latency. The fields of this data can change without notice, + * so you should not write code that depends on its structure. + * One of the fields is called "Alternative Matched Intents", which may + * aid with debugging. The following describes these intent results: + * - The list is empty if no intent was matched to end-user input. + * - Only intents that are referenced in the currently active flow are + * included. + * - The matched intent is included. + * - Other intents that could have matched end-user input, but did not match + * because they are referenced by intent routes that are out of + * [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), + * are included. + * - Other intents referenced by intent routes in scope that matched end-user + * input, but had a lower confidence score. + * @type \Google\Cloud\Dialogflow\Cx\V3\SentimentAnalysisResult $sentiment_analysis_result + * The sentiment analyss result, which depends on + * [`analyze_query_text_sentiment`] + * [google.cloud.dialogflow.cx.v3.QueryParameters.analyze_query_text_sentiment], + * specified in the request. + * @type \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $advanced_settings + * Returns the current advanced settings including IVR settings. Even though + * the operations configured by these settings are performed by Dialogflow, + * the client may need to perform special logic at the moment. For example, if + * Dialogflow exports audio to Google Cloud Storage, then the client may need + * to wait for the resulting object to appear in the bucket before proceeding. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Session::initOnce(); + parent::__construct($data); + } + + /** + * If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was + * provided as input, this field will contain a copy of the text. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * If [natural language text][google.cloud.dialogflow.cx.v3.TextInput] was + * provided as input, this field will contain a copy of the text. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as + * input, this field will contain a copy of the intent identifier. Format: + * `projects//locations//agents//intents/`. + * + * Generated from protobuf field string trigger_intent = 11 [(.google.api.resource_reference) = { + * @return string + */ + public function getTriggerIntent() + { + return $this->readOneof(11); + } + + public function hasTriggerIntent() + { + return $this->hasOneof(11); + } + + /** + * If an [intent][google.cloud.dialogflow.cx.v3.IntentInput] was provided as + * input, this field will contain a copy of the intent identifier. Format: + * `projects//locations//agents//intents/`. + * + * Generated from protobuf field string trigger_intent = 11 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTriggerIntent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * If [natural language speech + * audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, + * this field will contain the transcript for the audio. + * + * Generated from protobuf field string transcript = 12; + * @return string + */ + public function getTranscript() + { + return $this->readOneof(12); + } + + public function hasTranscript() + { + return $this->hasOneof(12); + } + + /** + * If [natural language speech + * audio][google.cloud.dialogflow.cx.v3.AudioInput] was provided as input, + * this field will contain the transcript for the audio. + * + * Generated from protobuf field string transcript = 12; + * @param string $var + * @return $this + */ + public function setTranscript($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as + * input, this field will contain the name of the event. + * + * Generated from protobuf field string trigger_event = 14; + * @return string + */ + public function getTriggerEvent() + { + return $this->readOneof(14); + } + + public function hasTriggerEvent() + { + return $this->hasOneof(14); + } + + /** + * If an [event][google.cloud.dialogflow.cx.v3.EventInput] was provided as + * input, this field will contain the name of the event. + * + * Generated from protobuf field string trigger_event = 14; + * @param string $var + * @return $this + */ + public function setTriggerEvent($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(14, $var); + + return $this; + } + + /** + * If a [DTMF][google.cloud.dialogflow.cx.v3.DtmfInput] was provided as + * input, this field will contain a copy of the + * [DtmfInput][google.cloud.dialogflow.cx.v3.DtmfInput]. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DtmfInput dtmf = 23; + * @return \Google\Cloud\Dialogflow\Cx\V3\DtmfInput|null + */ + public function getDtmf() + { + return $this->readOneof(23); + } + + public function hasDtmf() + { + return $this->hasOneof(23); + } + + /** + * If a [DTMF][google.cloud.dialogflow.cx.v3.DtmfInput] was provided as + * input, this field will contain a copy of the + * [DtmfInput][google.cloud.dialogflow.cx.v3.DtmfInput]. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DtmfInput dtmf = 23; + * @param \Google\Cloud\Dialogflow\Cx\V3\DtmfInput $var + * @return $this + */ + public function setDtmf($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\DtmfInput::class); + $this->writeOneof(23, $var); + + return $this; + } + + /** + * The language that was triggered during intent detection. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * + * Generated from protobuf field string language_code = 2; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * The language that was triggered during intent detection. + * See [Language + * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) + * for a list of the currently supported language codes. + * + * Generated from protobuf field string language_code = 2; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + + /** + * The collected [session + * parameters][google.cloud.dialogflow.cx.v3.SessionInfo.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 then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 3; + * @return \Google\Protobuf\Struct|null + */ + public function getParameters() + { + return $this->parameters; + } + + public function hasParameters() + { + return isset($this->parameters); + } + + public function clearParameters() + { + unset($this->parameters); + } + + /** + * The collected [session + * parameters][google.cloud.dialogflow.cx.v3.SessionInfo.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 then use + * map, otherwise, depending on the parameter value type, it could be one of + * string, number, boolean, null, list or map. + * * MapValue value: If parameter's entity type is a composite entity then use + * map from composite entity property names to property values, otherwise, + * use parameter value. + * + * Generated from protobuf field .google.protobuf.Struct parameters = 3; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->parameters = $var; + + return $this; + } + + /** + * The list of rich messages returned to the client. Responses vary from + * simple text messages to more sophisticated, structured payloads used + * to drive complex logic. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage response_messages = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getResponseMessages() + { + return $this->response_messages; + } + + /** + * The list of rich messages returned to the client. Responses vary from + * simple text messages to more sophisticated, structured payloads used + * to drive complex logic. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage response_messages = 4; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setResponseMessages($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::class); + $this->response_messages = $arr; + + return $this; + } + + /** + * The list of webhook call status in the order of call sequence. + * + * Generated from protobuf field repeated .google.rpc.Status webhook_statuses = 13; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWebhookStatuses() + { + return $this->webhook_statuses; + } + + /** + * The list of webhook call status in the order of call sequence. + * + * Generated from protobuf field repeated .google.rpc.Status webhook_statuses = 13; + * @param array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWebhookStatuses($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Rpc\Status::class); + $this->webhook_statuses = $arr; + + return $this; + } + + /** + * The list of webhook payload in + * [WebhookResponse.payload][google.cloud.dialogflow.cx.v3.WebhookResponse.payload], + * in the order of call sequence. If some webhook call fails or doesn't return + * any payload, an empty `Struct` would be used instead. + * + * Generated from protobuf field repeated .google.protobuf.Struct webhook_payloads = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getWebhookPayloads() + { + return $this->webhook_payloads; + } + + /** + * The list of webhook payload in + * [WebhookResponse.payload][google.cloud.dialogflow.cx.v3.WebhookResponse.payload], + * in the order of call sequence. If some webhook call fails or doesn't return + * any payload, an empty `Struct` would be used instead. + * + * Generated from protobuf field repeated .google.protobuf.Struct webhook_payloads = 6; + * @param array<\Google\Protobuf\Struct>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setWebhookPayloads($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Struct::class); + $this->webhook_payloads = $arr; + + return $this; + } + + /** + * The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all + * fields are filled in this message, including but not limited to `name` and + * `display_name`. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 7; + * @return \Google\Cloud\Dialogflow\Cx\V3\Page|null + */ + public function getCurrentPage() + { + return $this->current_page; + } + + public function hasCurrentPage() + { + return isset($this->current_page); + } + + public function clearCurrentPage() + { + unset($this->current_page); + } + + /** + * The current [Page][google.cloud.dialogflow.cx.v3.Page]. Some, not all + * fields are filled in this message, including but not limited to `name` and + * `display_name`. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Page current_page = 7; + * @param \Google\Cloud\Dialogflow\Cx\V3\Page $var + * @return $this + */ + public function setCurrentPage($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Page::class); + $this->current_page = $var; + + return $this; + } + + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the + * conversational query. Some, not all fields are filled in this message, + * including but not limited to: `name` and `display_name`. This field is + * deprecated, please use + * [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] + * instead. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 8 [deprecated = true]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Intent|null + * @deprecated + */ + public function getIntent() + { + @trigger_error('intent is deprecated.', E_USER_DEPRECATED); + return $this->intent; + } + + public function hasIntent() + { + @trigger_error('intent is deprecated.', E_USER_DEPRECATED); + return isset($this->intent); + } + + public function clearIntent() + { + @trigger_error('intent is deprecated.', E_USER_DEPRECATED); + unset($this->intent); + } + + /** + * The [Intent][google.cloud.dialogflow.cx.v3.Intent] that matched the + * conversational query. Some, not all fields are filled in this message, + * including but not limited to: `name` and `display_name`. This field is + * deprecated, please use + * [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] + * instead. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Intent intent = 8 [deprecated = true]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Intent $var + * @return $this + * @deprecated + */ + public function setIntent($var) + { + @trigger_error('intent is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Intent::class); + $this->intent = $var; + + return $this; + } + + /** + * 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. + * This field is deprecated, please use + * [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] + * instead. + * + * Generated from protobuf field float intent_detection_confidence = 9 [deprecated = true]; + * @return float + * @deprecated + */ + public function getIntentDetectionConfidence() + { + @trigger_error('intent_detection_confidence is deprecated.', E_USER_DEPRECATED); + return $this->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. + * This field is deprecated, please use + * [QueryResult.match][google.cloud.dialogflow.cx.v3.QueryResult.match] + * instead. + * + * Generated from protobuf field float intent_detection_confidence = 9 [deprecated = true]; + * @param float $var + * @return $this + * @deprecated + */ + public function setIntentDetectionConfidence($var) + { + @trigger_error('intent_detection_confidence is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkFloat($var); + $this->intent_detection_confidence = $var; + + return $this; + } + + /** + * Intent match result, could be an intent or an event. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match match = 15; + * @return \Google\Cloud\Dialogflow\Cx\V3\PBMatch|null + */ + public function getMatch() + { + return $this->match; + } + + public function hasMatch() + { + return isset($this->match); + } + + public function clearMatch() + { + unset($this->match); + } + + /** + * Intent match result, could be an intent or an event. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Match match = 15; + * @param \Google\Cloud\Dialogflow\Cx\V3\PBMatch $var + * @return $this + */ + public function setMatch($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PBMatch::class); + $this->match = $var; + + return $this; + } + + /** + * The free-form diagnostic info. For example, this field could contain + * webhook call latency. The fields of this data can change without notice, + * so you should not write code that depends on its structure. + * One of the fields is called "Alternative Matched Intents", which may + * aid with debugging. The following describes these intent results: + * - The list is empty if no intent was matched to end-user input. + * - Only intents that are referenced in the currently active flow are + * included. + * - The matched intent is included. + * - Other intents that could have matched end-user input, but did not match + * because they are referenced by intent routes that are out of + * [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), + * are included. + * - Other intents referenced by intent routes in scope that matched end-user + * input, but had a lower confidence score. + * + * Generated from protobuf field .google.protobuf.Struct diagnostic_info = 10; + * @return \Google\Protobuf\Struct|null + */ + public function getDiagnosticInfo() + { + return $this->diagnostic_info; + } + + public function hasDiagnosticInfo() + { + return isset($this->diagnostic_info); + } + + public function clearDiagnosticInfo() + { + unset($this->diagnostic_info); + } + + /** + * The free-form diagnostic info. For example, this field could contain + * webhook call latency. The fields of this data can change without notice, + * so you should not write code that depends on its structure. + * One of the fields is called "Alternative Matched Intents", which may + * aid with debugging. The following describes these intent results: + * - The list is empty if no intent was matched to end-user input. + * - Only intents that are referenced in the currently active flow are + * included. + * - The matched intent is included. + * - Other intents that could have matched end-user input, but did not match + * because they are referenced by intent routes that are out of + * [scope](https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope), + * are included. + * - Other intents referenced by intent routes in scope that matched end-user + * input, but had a lower confidence score. + * + * Generated from protobuf field .google.protobuf.Struct diagnostic_info = 10; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setDiagnosticInfo($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->diagnostic_info = $var; + + return $this; + } + + /** + * The sentiment analyss result, which depends on + * [`analyze_query_text_sentiment`] + * [google.cloud.dialogflow.cx.v3.QueryParameters.analyze_query_text_sentiment], + * specified in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SentimentAnalysisResult sentiment_analysis_result = 17; + * @return \Google\Cloud\Dialogflow\Cx\V3\SentimentAnalysisResult|null + */ + public function getSentimentAnalysisResult() + { + return $this->sentiment_analysis_result; + } + + public function hasSentimentAnalysisResult() + { + return isset($this->sentiment_analysis_result); + } + + public function clearSentimentAnalysisResult() + { + unset($this->sentiment_analysis_result); + } + + /** + * The sentiment analyss result, which depends on + * [`analyze_query_text_sentiment`] + * [google.cloud.dialogflow.cx.v3.QueryParameters.analyze_query_text_sentiment], + * specified in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SentimentAnalysisResult sentiment_analysis_result = 17; + * @param \Google\Cloud\Dialogflow\Cx\V3\SentimentAnalysisResult $var + * @return $this + */ + public function setSentimentAnalysisResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SentimentAnalysisResult::class); + $this->sentiment_analysis_result = $var; + + return $this; + } + + /** + * Returns the current advanced settings including IVR settings. Even though + * the operations configured by these settings are performed by Dialogflow, + * the client may need to perform special logic at the moment. For example, if + * Dialogflow exports audio to Google Cloud Storage, then the client may need + * to wait for the resulting object to appear in the bucket before proceeding. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 21; + * @return \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings|null + */ + public function getAdvancedSettings() + { + return $this->advanced_settings; + } + + public function hasAdvancedSettings() + { + return isset($this->advanced_settings); + } + + public function clearAdvancedSettings() + { + unset($this->advanced_settings); + } + + /** + * Returns the current advanced settings including IVR settings. Even though + * the operations configured by these settings are performed by Dialogflow, + * the client may need to perform special logic at the moment. For example, if + * Dialogflow exports audio to Google Cloud Storage, then the client may need + * to wait for the resulting object to appear in the bucket before proceeding. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AdvancedSettings advanced_settings = 21; + * @param \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings $var + * @return $this + */ + public function setAdvancedSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AdvancedSettings::class); + $this->advanced_settings = $var; + + return $this; + } + + /** + * @return string + */ + public function getQuery() + { + return $this->whichOneof("query"); + } + +} + diff --git a/DialogflowCx/src/V3/ResourceName.php b/DialogflowCx/src/V3/ResourceName.php new file mode 100644 index 000000000000..0e78c780b799 --- /dev/null +++ b/DialogflowCx/src/V3/ResourceName.php @@ -0,0 +1,101 @@ +google.cloud.dialogflow.cx.v3.ResourceName + */ +class ResourceName extends \Google\Protobuf\Internal\Message +{ + /** + * Name. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Display name. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Name. + * @type string $display_name + * Display name. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ValidationMessage::initOnce(); + parent::__construct($data); + } + + /** + * Name. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Name. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Display name. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Display name. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ResponseMessage.php b/DialogflowCx/src/V3/ResponseMessage.php new file mode 100644 index 000000000000..d580b0250e4d --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage.php @@ -0,0 +1,510 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage + */ +class ResponseMessage extends \Google\Protobuf\Internal\Message +{ + /** + * Response type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.ResponseType response_type = 4; + */ + protected $response_type = 0; + /** + * The channel which the response is associated with. Clients can specify the + * channel via + * [QueryParameters.channel][google.cloud.dialogflow.cx.v3.QueryParameters.channel], + * and only associated channel response will be returned. + * + * Generated from protobuf field string channel = 19; + */ + protected $channel = ''; + protected $message; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\Text $text + * Returns a text response. + * @type \Google\Protobuf\Struct $payload + * Returns a response containing a custom, platform-specific payload. + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\ConversationSuccess $conversation_success + * Indicates that the conversation succeeded. + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\OutputAudioText $output_audio_text + * A text or ssml response that is preferentially used for TTS output audio + * synthesis, as described in the comment on the ResponseMessage message. + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\LiveAgentHandoff $live_agent_handoff + * Hands off conversation to a human agent. + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\EndInteraction $end_interaction + * Output only. A signal that indicates the interaction with the Dialogflow + * agent has ended. This message is generated by Dialogflow only when the + * conversation reaches `END_SESSION` page. It is not supposed to be defined + * by the user. + * It's guaranteed that there is at most one such message in each response. + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\PlayAudio $play_audio + * Signal that the client should play an audio clip hosted at a + * client-specific URI. Dialogflow uses this to construct + * [mixed_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.mixed_audio]. + * However, Dialogflow itself does not try to read or process the URI in any + * way. + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\MixedAudio $mixed_audio + * Output only. An audio response message composed of both the synthesized + * Dialogflow agent responses and responses defined via + * [play_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.play_audio]. + * This message is generated by Dialogflow only and not supposed to be + * defined by the user. + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\TelephonyTransferCall $telephony_transfer_call + * A signal that the client should transfer the phone call connected to + * this agent to a third-party endpoint. + * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\KnowledgeInfoCard $knowledge_info_card + * Represents info card for knowledge answers, to be better rendered in + * Dialogflow Messenger. + * @type int $response_type + * Response type. + * @type string $channel + * The channel which the response is associated with. Clients can specify the + * channel via + * [QueryParameters.channel][google.cloud.dialogflow.cx.v3.QueryParameters.channel], + * and only associated channel response will be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * Returns a text response. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.Text text = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\Text|null + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * Returns a text response. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.Text text = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\Text $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\Text::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Returns a response containing a custom, platform-specific payload. + * + * Generated from protobuf field .google.protobuf.Struct payload = 2; + * @return \Google\Protobuf\Struct|null + */ + public function getPayload() + { + return $this->readOneof(2); + } + + public function hasPayload() + { + return $this->hasOneof(2); + } + + /** + * Returns a response containing a custom, platform-specific payload. + * + * Generated from protobuf field .google.protobuf.Struct payload = 2; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setPayload($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Indicates that the conversation succeeded. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.ConversationSuccess conversation_success = 9; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\ConversationSuccess|null + */ + public function getConversationSuccess() + { + return $this->readOneof(9); + } + + public function hasConversationSuccess() + { + return $this->hasOneof(9); + } + + /** + * Indicates that the conversation succeeded. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.ConversationSuccess conversation_success = 9; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\ConversationSuccess $var + * @return $this + */ + public function setConversationSuccess($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\ConversationSuccess::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * A text or ssml response that is preferentially used for TTS output audio + * synthesis, as described in the comment on the ResponseMessage message. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.OutputAudioText output_audio_text = 8; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\OutputAudioText|null + */ + public function getOutputAudioText() + { + return $this->readOneof(8); + } + + public function hasOutputAudioText() + { + return $this->hasOneof(8); + } + + /** + * A text or ssml response that is preferentially used for TTS output audio + * synthesis, as described in the comment on the ResponseMessage message. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.OutputAudioText output_audio_text = 8; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\OutputAudioText $var + * @return $this + */ + public function setOutputAudioText($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\OutputAudioText::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Hands off conversation to a human agent. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.LiveAgentHandoff live_agent_handoff = 10; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\LiveAgentHandoff|null + */ + public function getLiveAgentHandoff() + { + return $this->readOneof(10); + } + + public function hasLiveAgentHandoff() + { + return $this->hasOneof(10); + } + + /** + * Hands off conversation to a human agent. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.LiveAgentHandoff live_agent_handoff = 10; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\LiveAgentHandoff $var + * @return $this + */ + public function setLiveAgentHandoff($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\LiveAgentHandoff::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Output only. A signal that indicates the interaction with the Dialogflow + * agent has ended. This message is generated by Dialogflow only when the + * conversation reaches `END_SESSION` page. It is not supposed to be defined + * by the user. + * It's guaranteed that there is at most one such message in each response. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.EndInteraction end_interaction = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\EndInteraction|null + */ + public function getEndInteraction() + { + return $this->readOneof(11); + } + + public function hasEndInteraction() + { + return $this->hasOneof(11); + } + + /** + * Output only. A signal that indicates the interaction with the Dialogflow + * agent has ended. This message is generated by Dialogflow only when the + * conversation reaches `END_SESSION` page. It is not supposed to be defined + * by the user. + * It's guaranteed that there is at most one such message in each response. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.EndInteraction end_interaction = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\EndInteraction $var + * @return $this + */ + public function setEndInteraction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\EndInteraction::class); + $this->writeOneof(11, $var); + + return $this; + } + + /** + * Signal that the client should play an audio clip hosted at a + * client-specific URI. Dialogflow uses this to construct + * [mixed_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.mixed_audio]. + * However, Dialogflow itself does not try to read or process the URI in any + * way. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.PlayAudio play_audio = 12; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\PlayAudio|null + */ + public function getPlayAudio() + { + return $this->readOneof(12); + } + + public function hasPlayAudio() + { + return $this->hasOneof(12); + } + + /** + * Signal that the client should play an audio clip hosted at a + * client-specific URI. Dialogflow uses this to construct + * [mixed_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.mixed_audio]. + * However, Dialogflow itself does not try to read or process the URI in any + * way. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.PlayAudio play_audio = 12; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\PlayAudio $var + * @return $this + */ + public function setPlayAudio($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\PlayAudio::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Output only. An audio response message composed of both the synthesized + * Dialogflow agent responses and responses defined via + * [play_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.play_audio]. + * This message is generated by Dialogflow only and not supposed to be + * defined by the user. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.MixedAudio mixed_audio = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\MixedAudio|null + */ + public function getMixedAudio() + { + return $this->readOneof(13); + } + + public function hasMixedAudio() + { + return $this->hasOneof(13); + } + + /** + * Output only. An audio response message composed of both the synthesized + * Dialogflow agent responses and responses defined via + * [play_audio][google.cloud.dialogflow.cx.v3.ResponseMessage.play_audio]. + * This message is generated by Dialogflow only and not supposed to be + * defined by the user. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.MixedAudio mixed_audio = 13 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\MixedAudio $var + * @return $this + */ + public function setMixedAudio($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\MixedAudio::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * A signal that the client should transfer the phone call connected to + * this agent to a third-party endpoint. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.TelephonyTransferCall telephony_transfer_call = 18; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\TelephonyTransferCall|null + */ + public function getTelephonyTransferCall() + { + return $this->readOneof(18); + } + + public function hasTelephonyTransferCall() + { + return $this->hasOneof(18); + } + + /** + * A signal that the client should transfer the phone call connected to + * this agent to a third-party endpoint. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.TelephonyTransferCall telephony_transfer_call = 18; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\TelephonyTransferCall $var + * @return $this + */ + public function setTelephonyTransferCall($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\TelephonyTransferCall::class); + $this->writeOneof(18, $var); + + return $this; + } + + /** + * Represents info card for knowledge answers, to be better rendered in + * Dialogflow Messenger. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.KnowledgeInfoCard knowledge_info_card = 20; + * @return \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\KnowledgeInfoCard|null + */ + public function getKnowledgeInfoCard() + { + return $this->readOneof(20); + } + + public function hasKnowledgeInfoCard() + { + return $this->hasOneof(20); + } + + /** + * Represents info card for knowledge answers, to be better rendered in + * Dialogflow Messenger. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.KnowledgeInfoCard knowledge_info_card = 20; + * @param \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\KnowledgeInfoCard $var + * @return $this + */ + public function setKnowledgeInfoCard($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\KnowledgeInfoCard::class); + $this->writeOneof(20, $var); + + return $this; + } + + /** + * Response type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.ResponseType response_type = 4; + * @return int + */ + public function getResponseType() + { + return $this->response_type; + } + + /** + * Response type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ResponseMessage.ResponseType response_type = 4; + * @param int $var + * @return $this + */ + public function setResponseType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\ResponseType::class); + $this->response_type = $var; + + return $this; + } + + /** + * The channel which the response is associated with. Clients can specify the + * channel via + * [QueryParameters.channel][google.cloud.dialogflow.cx.v3.QueryParameters.channel], + * and only associated channel response will be returned. + * + * Generated from protobuf field string channel = 19; + * @return string + */ + public function getChannel() + { + return $this->channel; + } + + /** + * The channel which the response is associated with. Clients can specify the + * channel via + * [QueryParameters.channel][google.cloud.dialogflow.cx.v3.QueryParameters.channel], + * and only associated channel response will be returned. + * + * Generated from protobuf field string channel = 19; + * @param string $var + * @return $this + */ + public function setChannel($var) + { + GPBUtil::checkString($var, True); + $this->channel = $var; + + return $this; + } + + /** + * @return string + */ + public function getMessage() + { + return $this->whichOneof("message"); + } + +} + diff --git a/DialogflowCx/src/V3/ResponseMessage/ConversationSuccess.php b/DialogflowCx/src/V3/ResponseMessage/ConversationSuccess.php new file mode 100644 index 000000000000..94ba2caacc74 --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/ConversationSuccess.php @@ -0,0 +1,91 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.ConversationSuccess + */ +class ConversationSuccess extends \Google\Protobuf\Internal\Message +{ + /** + * Custom metadata. Dialogflow doesn't impose any structure on this. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 1; + */ + protected $metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $metadata + * Custom metadata. Dialogflow doesn't impose any structure on this. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * Custom metadata. Dialogflow doesn't impose any structure on this. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 1; + * @return \Google\Protobuf\Struct|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Custom metadata. Dialogflow doesn't impose any structure on this. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 1; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->metadata = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/EndInteraction.php b/DialogflowCx/src/V3/ResponseMessage/EndInteraction.php new file mode 100644 index 000000000000..5a8095c0cdd5 --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/EndInteraction.php @@ -0,0 +1,36 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.EndInteraction + */ +class EndInteraction extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/KnowledgeInfoCard.php b/DialogflowCx/src/V3/ResponseMessage/KnowledgeInfoCard.php new file mode 100644 index 000000000000..15002548b03b --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/KnowledgeInfoCard.php @@ -0,0 +1,37 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.KnowledgeInfoCard + */ +class KnowledgeInfoCard extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/LiveAgentHandoff.php b/DialogflowCx/src/V3/ResponseMessage/LiveAgentHandoff.php new file mode 100644 index 000000000000..ce5da7b2e43a --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/LiveAgentHandoff.php @@ -0,0 +1,93 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.LiveAgentHandoff + */ +class LiveAgentHandoff extends \Google\Protobuf\Internal\Message +{ + /** + * Custom metadata for your handoff procedure. Dialogflow doesn't impose + * any structure on this. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 1; + */ + protected $metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $metadata + * Custom metadata for your handoff procedure. Dialogflow doesn't impose + * any structure on this. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * Custom metadata for your handoff procedure. Dialogflow doesn't impose + * any structure on this. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 1; + * @return \Google\Protobuf\Struct|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Custom metadata for your handoff procedure. Dialogflow doesn't impose + * any structure on this. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 1; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->metadata = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/MixedAudio.php b/DialogflowCx/src/V3/ResponseMessage/MixedAudio.php new file mode 100644 index 000000000000..ad01b0538124 --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/MixedAudio.php @@ -0,0 +1,74 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.MixedAudio + */ +class MixedAudio extends \Google\Protobuf\Internal\Message +{ + /** + * Segments this audio response is composed of. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage.MixedAudio.Segment segments = 1; + */ + private $segments; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\MixedAudio\Segment>|\Google\Protobuf\Internal\RepeatedField $segments + * Segments this audio response is composed of. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * Segments this audio response is composed of. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage.MixedAudio.Segment segments = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSegments() + { + return $this->segments; + } + + /** + * Segments this audio response is composed of. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage.MixedAudio.Segment segments = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\MixedAudio\Segment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\MixedAudio\Segment::class); + $this->segments = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/MixedAudio/Segment.php b/DialogflowCx/src/V3/ResponseMessage/MixedAudio/Segment.php new file mode 100644 index 000000000000..fe4e6ca6fbf7 --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/MixedAudio/Segment.php @@ -0,0 +1,157 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.MixedAudio.Segment + */ +class Segment extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Whether the playback of this segment can be interrupted by + * the end user's speech and the client should then start the next + * Dialogflow request. + * + * Generated from protobuf field bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $allow_playback_interruption = false; + protected $content; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $audio + * Raw audio synthesized from the Dialogflow agent's response using + * the output config specified in the request. + * @type string $uri + * Client-specific URI that points to an audio clip accessible to the + * client. Dialogflow does not impose any validation on it. + * @type bool $allow_playback_interruption + * Output only. Whether the playback of this segment can be interrupted by + * the end user's speech and the client should then start the next + * Dialogflow request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * Raw audio synthesized from the Dialogflow agent's response using + * the output config specified in the request. + * + * Generated from protobuf field bytes audio = 1; + * @return string + */ + public function getAudio() + { + return $this->readOneof(1); + } + + public function hasAudio() + { + return $this->hasOneof(1); + } + + /** + * Raw audio synthesized from the Dialogflow agent's response using + * the output config specified in the request. + * + * Generated from protobuf field bytes audio = 1; + * @param string $var + * @return $this + */ + public function setAudio($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Client-specific URI that points to an audio clip accessible to the + * client. Dialogflow does not impose any validation on it. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->readOneof(2); + } + + public function hasUri() + { + return $this->hasOneof(2); + } + + /** + * Client-specific URI that points to an audio clip accessible to the + * client. Dialogflow does not impose any validation on it. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Output only. Whether the playback of this segment can be interrupted by + * the end user's speech and the client should then start the next + * Dialogflow request. + * + * Generated from protobuf field bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getAllowPlaybackInterruption() + { + return $this->allow_playback_interruption; + } + + /** + * Output only. Whether the playback of this segment can be interrupted by + * the end user's speech and the client should then start the next + * Dialogflow request. + * + * Generated from protobuf field bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setAllowPlaybackInterruption($var) + { + GPBUtil::checkBool($var); + $this->allow_playback_interruption = $var; + + return $this; + } + + /** + * @return string + */ + public function getContent() + { + return $this->whichOneof("content"); + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/OutputAudioText.php b/DialogflowCx/src/V3/ResponseMessage/OutputAudioText.php new file mode 100644 index 000000000000..dc2ea4a47cdf --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/OutputAudioText.php @@ -0,0 +1,155 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.OutputAudioText + */ +class OutputAudioText extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $allow_playback_interruption = false; + protected $source; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * The raw text to be synthesized. + * @type string $ssml + * The SSML text to be synthesized. For more information, see + * [SSML](/speech/text-to-speech/docs/ssml). + * @type bool $allow_playback_interruption + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * The raw text to be synthesized. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * The raw text to be synthesized. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * The SSML text to be synthesized. For more information, see + * [SSML](/speech/text-to-speech/docs/ssml). + * + * Generated from protobuf field string ssml = 2; + * @return string + */ + public function getSsml() + { + return $this->readOneof(2); + } + + public function hasSsml() + { + return $this->hasOneof(2); + } + + /** + * The SSML text to be synthesized. For more information, see + * [SSML](/speech/text-to-speech/docs/ssml). + * + * Generated from protobuf field string ssml = 2; + * @param string $var + * @return $this + */ + public function setSsml($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getAllowPlaybackInterruption() + { + return $this->allow_playback_interruption; + } + + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setAllowPlaybackInterruption($var) + { + GPBUtil::checkBool($var); + $this->allow_playback_interruption = $var; + + return $this; + } + + /** + * @return string + */ + public function getSource() + { + return $this->whichOneof("source"); + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/PlayAudio.php b/DialogflowCx/src/V3/ResponseMessage/PlayAudio.php new file mode 100644 index 000000000000..344669242ddd --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/PlayAudio.php @@ -0,0 +1,114 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.PlayAudio + */ +class PlayAudio extends \Google\Protobuf\Internal\Message +{ + /** + * Required. URI of the audio clip. Dialogflow does not impose any + * validation on this value. It is specific to the client that reads it. + * + * Generated from protobuf field string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $audio_uri = ''; + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $allow_playback_interruption = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $audio_uri + * Required. URI of the audio clip. Dialogflow does not impose any + * validation on this value. It is specific to the client that reads it. + * @type bool $allow_playback_interruption + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * Required. URI of the audio clip. Dialogflow does not impose any + * validation on this value. It is specific to the client that reads it. + * + * Generated from protobuf field string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAudioUri() + { + return $this->audio_uri; + } + + /** + * Required. URI of the audio clip. Dialogflow does not impose any + * validation on this value. It is specific to the client that reads it. + * + * Generated from protobuf field string audio_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAudioUri($var) + { + GPBUtil::checkString($var, True); + $this->audio_uri = $var; + + return $this; + } + + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getAllowPlaybackInterruption() + { + return $this->allow_playback_interruption; + } + + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setAllowPlaybackInterruption($var) + { + GPBUtil::checkBool($var); + $this->allow_playback_interruption = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/ResponseType.php b/DialogflowCx/src/V3/ResponseMessage/ResponseType.php new file mode 100644 index 000000000000..37d8acb3c404 --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/ResponseType.php @@ -0,0 +1,75 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.ResponseType + */ +class ResponseType +{ + /** + * Not specified. + * + * Generated from protobuf enum RESPONSE_TYPE_UNSPECIFIED = 0; + */ + const RESPONSE_TYPE_UNSPECIFIED = 0; + /** + * The response is from an [entry + * prompt][google.cloud.dialogflow.cx.v3.Page.entry_fulfillment] in the + * page. + * + * Generated from protobuf enum ENTRY_PROMPT = 1; + */ + const ENTRY_PROMPT = 1; + /** + * The response is from [form-filling + * prompt][google.cloud.dialogflow.cx.v3.Form.Parameter.fill_behavior] in + * the page. + * + * Generated from protobuf enum PARAMETER_PROMPT = 2; + */ + const PARAMETER_PROMPT = 2; + /** + * The response is from a [transition + * route][google.cloud.dialogflow.cx.v3.TransitionRoute] or an [event + * handler][EventHandler] in the page or flow or transition route group. + * + * Generated from protobuf enum HANDLER_PROMPT = 3; + */ + const HANDLER_PROMPT = 3; + + private static $valueToName = [ + self::RESPONSE_TYPE_UNSPECIFIED => 'RESPONSE_TYPE_UNSPECIFIED', + self::ENTRY_PROMPT => 'ENTRY_PROMPT', + self::PARAMETER_PROMPT => 'PARAMETER_PROMPT', + self::HANDLER_PROMPT => 'HANDLER_PROMPT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/TelephonyTransferCall.php b/DialogflowCx/src/V3/ResponseMessage/TelephonyTransferCall.php new file mode 100644 index 000000000000..956e78d32d14 --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/TelephonyTransferCall.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.TelephonyTransferCall + */ +class TelephonyTransferCall extends \Google\Protobuf\Internal\Message +{ + protected $endpoint; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $phone_number + * Transfer the call to a phone number + * in [E.164 format](https://en.wikipedia.org/wiki/E.164). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * Transfer the call to a phone number + * in [E.164 format](https://en.wikipedia.org/wiki/E.164). + * + * Generated from protobuf field string phone_number = 1; + * @return string + */ + public function getPhoneNumber() + { + return $this->readOneof(1); + } + + public function hasPhoneNumber() + { + return $this->hasOneof(1); + } + + /** + * Transfer the call to a phone number + * in [E.164 format](https://en.wikipedia.org/wiki/E.164). + * + * Generated from protobuf field string phone_number = 1; + * @param string $var + * @return $this + */ + public function setPhoneNumber($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * @return string + */ + public function getEndpoint() + { + return $this->whichOneof("endpoint"); + } + +} + + diff --git a/DialogflowCx/src/V3/ResponseMessage/Text.php b/DialogflowCx/src/V3/ResponseMessage/Text.php new file mode 100644 index 000000000000..deb8af9c8ea1 --- /dev/null +++ b/DialogflowCx/src/V3/ResponseMessage/Text.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ResponseMessage.Text + */ +class Text extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A collection of text responses. + * + * Generated from protobuf field repeated string text = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $text; + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $allow_playback_interruption = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $text + * Required. A collection of text responses. + * @type bool $allow_playback_interruption + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ResponseMessage::initOnce(); + parent::__construct($data); + } + + /** + * Required. A collection of text responses. + * + * Generated from protobuf field repeated string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getText() + { + return $this->text; + } + + /** + * Required. A collection of text responses. + * + * Generated from protobuf field repeated string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setText($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->text = $arr; + + return $this; + } + + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return bool + */ + public function getAllowPlaybackInterruption() + { + return $this->allow_playback_interruption; + } + + /** + * Output only. Whether the playback of this message can be interrupted by + * the end user's speech and the client can then starts the next Dialogflow + * request. + * + * Generated from protobuf field bool allow_playback_interruption = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param bool $var + * @return $this + */ + public function setAllowPlaybackInterruption($var) + { + GPBUtil::checkBool($var); + $this->allow_playback_interruption = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/RestoreAgentRequest.php b/DialogflowCx/src/V3/RestoreAgentRequest.php new file mode 100644 index 000000000000..00e8e68ed169 --- /dev/null +++ b/DialogflowCx/src/V3/RestoreAgentRequest.php @@ -0,0 +1,235 @@ +google.cloud.dialogflow.cx.v3.RestoreAgentRequest + */ +class RestoreAgentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the agent to restore into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Agent restore mode. If not specified, `KEEP` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RestoreAgentRequest.RestoreOption restore_option = 5; + */ + protected $restore_option = 0; + protected $agent; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the agent to restore into. + * Format: `projects//locations//agents/`. + * @type string $agent_uri + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to restore agent from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type string $agent_content + * Uncompressed raw byte content for agent. + * @type \Google\Cloud\Dialogflow\Cx\V3\RestoreAgentRequest\GitSource $git_source + * Setting for restoring from a git branch + * @type int $restore_option + * Agent restore mode. If not specified, `KEEP` is assumed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the agent to restore into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the agent to restore into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to restore agent from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string agent_uri = 2; + * @return string + */ + public function getAgentUri() + { + return $this->readOneof(2); + } + + public function hasAgentUri() + { + return $this->hasOneof(2); + } + + /** + * The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI + * to restore agent from. The format of this URI must be + * `gs:///`. + * Dialogflow performs a read operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have read permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string agent_uri = 2; + * @param string $var + * @return $this + */ + public function setAgentUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Uncompressed raw byte content for agent. + * + * Generated from protobuf field bytes agent_content = 3; + * @return string + */ + public function getAgentContent() + { + return $this->readOneof(3); + } + + public function hasAgentContent() + { + return $this->hasOneof(3); + } + + /** + * Uncompressed raw byte content for agent. + * + * Generated from protobuf field bytes agent_content = 3; + * @param string $var + * @return $this + */ + public function setAgentContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Setting for restoring from a git branch + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RestoreAgentRequest.GitSource git_source = 6; + * @return \Google\Cloud\Dialogflow\Cx\V3\RestoreAgentRequest\GitSource|null + */ + public function getGitSource() + { + return $this->readOneof(6); + } + + public function hasGitSource() + { + return $this->hasOneof(6); + } + + /** + * Setting for restoring from a git branch + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RestoreAgentRequest.GitSource git_source = 6; + * @param \Google\Cloud\Dialogflow\Cx\V3\RestoreAgentRequest\GitSource $var + * @return $this + */ + public function setGitSource($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\RestoreAgentRequest\GitSource::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Agent restore mode. If not specified, `KEEP` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RestoreAgentRequest.RestoreOption restore_option = 5; + * @return int + */ + public function getRestoreOption() + { + return $this->restore_option; + } + + /** + * Agent restore mode. If not specified, `KEEP` is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.RestoreAgentRequest.RestoreOption restore_option = 5; + * @param int $var + * @return $this + */ + public function setRestoreOption($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\RestoreAgentRequest\RestoreOption::class); + $this->restore_option = $var; + + return $this; + } + + /** + * @return string + */ + public function getAgent() + { + return $this->whichOneof("agent"); + } + +} + diff --git a/DialogflowCx/src/V3/RestoreAgentRequest/GitSource.php b/DialogflowCx/src/V3/RestoreAgentRequest/GitSource.php new file mode 100644 index 000000000000..58b44cc28f54 --- /dev/null +++ b/DialogflowCx/src/V3/RestoreAgentRequest/GitSource.php @@ -0,0 +1,68 @@ +google.cloud.dialogflow.cx.v3.RestoreAgentRequest.GitSource + */ +class GitSource extends \Google\Protobuf\Internal\Message +{ + /** + * tracking branch for the git pull + * + * Generated from protobuf field string tracking_branch = 1; + */ + protected $tracking_branch = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $tracking_branch + * tracking branch for the git pull + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Agent::initOnce(); + parent::__construct($data); + } + + /** + * tracking branch for the git pull + * + * Generated from protobuf field string tracking_branch = 1; + * @return string + */ + public function getTrackingBranch() + { + return $this->tracking_branch; + } + + /** + * tracking branch for the git pull + * + * Generated from protobuf field string tracking_branch = 1; + * @param string $var + * @return $this + */ + public function setTrackingBranch($var) + { + GPBUtil::checkString($var, True); + $this->tracking_branch = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/RestoreAgentRequest/RestoreOption.php b/DialogflowCx/src/V3/RestoreAgentRequest/RestoreOption.php new file mode 100644 index 000000000000..83c973a842f2 --- /dev/null +++ b/DialogflowCx/src/V3/RestoreAgentRequest/RestoreOption.php @@ -0,0 +1,65 @@ +google.cloud.dialogflow.cx.v3.RestoreAgentRequest.RestoreOption + */ +class RestoreOption +{ + /** + * Unspecified. Treated as KEEP. + * + * Generated from protobuf enum RESTORE_OPTION_UNSPECIFIED = 0; + */ + const RESTORE_OPTION_UNSPECIFIED = 0; + /** + * Always respect the settings from the exported agent file. It may cause + * a restoration failure if some settings (e.g. model type) are not + * supported in the target agent. + * + * Generated from protobuf enum KEEP = 1; + */ + const KEEP = 1; + /** + * Fallback to default settings if some settings are not supported in the + * target agent. + * + * Generated from protobuf enum FALLBACK = 2; + */ + const FALLBACK = 2; + + private static $valueToName = [ + self::RESTORE_OPTION_UNSPECIFIED => 'RESTORE_OPTION_UNSPECIFIED', + self::KEEP => 'KEEP', + self::FALLBACK => 'FALLBACK', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/RolloutConfig.php b/DialogflowCx/src/V3/RolloutConfig.php new file mode 100644 index 000000000000..d493c3933674 --- /dev/null +++ b/DialogflowCx/src/V3/RolloutConfig.php @@ -0,0 +1,167 @@ +google.cloud.dialogflow.cx.v3.RolloutConfig + */ +class RolloutConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Steps to roll out a flow version. Steps should be sorted by percentage in + * ascending order. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.RolloutConfig.RolloutStep rollout_steps = 1; + */ + private $rollout_steps; + /** + * The conditions that are used to evaluate the success of a rollout + * step. If not specified, all rollout steps will proceed to the next one + * unless failure conditions are met. E.g. "containment_rate > 60% AND + * callback_rate < 20%". See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string rollout_condition = 2; + */ + protected $rollout_condition = ''; + /** + * The conditions that are used to evaluate the failure of a rollout + * step. If not specified, no rollout steps will fail. E.g. "containment_rate + * < 10% OR average_turn_count < 3". See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string failure_condition = 3; + */ + protected $failure_condition = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\RolloutConfig\RolloutStep>|\Google\Protobuf\Internal\RepeatedField $rollout_steps + * Steps to roll out a flow version. Steps should be sorted by percentage in + * ascending order. + * @type string $rollout_condition + * The conditions that are used to evaluate the success of a rollout + * step. If not specified, all rollout steps will proceed to the next one + * unless failure conditions are met. E.g. "containment_rate > 60% AND + * callback_rate < 20%". See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * @type string $failure_condition + * The conditions that are used to evaluate the failure of a rollout + * step. If not specified, no rollout steps will fail. E.g. "containment_rate + * < 10% OR average_turn_count < 3". See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * Steps to roll out a flow version. Steps should be sorted by percentage in + * ascending order. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.RolloutConfig.RolloutStep rollout_steps = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRolloutSteps() + { + return $this->rollout_steps; + } + + /** + * Steps to roll out a flow version. Steps should be sorted by percentage in + * ascending order. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.RolloutConfig.RolloutStep rollout_steps = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\RolloutConfig\RolloutStep>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRolloutSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\RolloutConfig\RolloutStep::class); + $this->rollout_steps = $arr; + + return $this; + } + + /** + * The conditions that are used to evaluate the success of a rollout + * step. If not specified, all rollout steps will proceed to the next one + * unless failure conditions are met. E.g. "containment_rate > 60% AND + * callback_rate < 20%". See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string rollout_condition = 2; + * @return string + */ + public function getRolloutCondition() + { + return $this->rollout_condition; + } + + /** + * The conditions that are used to evaluate the success of a rollout + * step. If not specified, all rollout steps will proceed to the next one + * unless failure conditions are met. E.g. "containment_rate > 60% AND + * callback_rate < 20%". See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string rollout_condition = 2; + * @param string $var + * @return $this + */ + public function setRolloutCondition($var) + { + GPBUtil::checkString($var, True); + $this->rollout_condition = $var; + + return $this; + } + + /** + * The conditions that are used to evaluate the failure of a rollout + * step. If not specified, no rollout steps will fail. E.g. "containment_rate + * < 10% OR average_turn_count < 3". See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string failure_condition = 3; + * @return string + */ + public function getFailureCondition() + { + return $this->failure_condition; + } + + /** + * The conditions that are used to evaluate the failure of a rollout + * step. If not specified, no rollout steps will fail. E.g. "containment_rate + * < 10% OR average_turn_count < 3". See the [conditions + * reference](https://cloud.google.com/dialogflow/cx/docs/reference/condition). + * + * Generated from protobuf field string failure_condition = 3; + * @param string $var + * @return $this + */ + public function setFailureCondition($var) + { + GPBUtil::checkString($var, True); + $this->failure_condition = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RolloutConfig/RolloutStep.php b/DialogflowCx/src/V3/RolloutConfig/RolloutStep.php new file mode 100644 index 000000000000..46e7227b67fb --- /dev/null +++ b/DialogflowCx/src/V3/RolloutConfig/RolloutStep.php @@ -0,0 +1,158 @@ +google.cloud.dialogflow.cx.v3.RolloutConfig.RolloutStep + */ +class RolloutStep extends \Google\Protobuf\Internal\Message +{ + /** + * The name of the rollout step; + * + * Generated from protobuf field string display_name = 1; + */ + protected $display_name = ''; + /** + * The percentage of traffic allocated to the flow version of this rollout + * step. (0%, 100%]. + * + * Generated from protobuf field int32 traffic_percent = 2; + */ + protected $traffic_percent = 0; + /** + * The minimum time that this step should last. Should be longer than 1 + * hour. If not set, the default minimum duration for each step will be 1 + * hour. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3; + */ + protected $min_duration = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * The name of the rollout step; + * @type int $traffic_percent + * The percentage of traffic allocated to the flow version of this rollout + * step. (0%, 100%]. + * @type \Google\Protobuf\Duration $min_duration + * The minimum time that this step should last. Should be longer than 1 + * hour. If not set, the default minimum duration for each step will be 1 + * hour. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * The name of the rollout step; + * + * Generated from protobuf field string display_name = 1; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The name of the rollout step; + * + * Generated from protobuf field string display_name = 1; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The percentage of traffic allocated to the flow version of this rollout + * step. (0%, 100%]. + * + * Generated from protobuf field int32 traffic_percent = 2; + * @return int + */ + public function getTrafficPercent() + { + return $this->traffic_percent; + } + + /** + * The percentage of traffic allocated to the flow version of this rollout + * step. (0%, 100%]. + * + * Generated from protobuf field int32 traffic_percent = 2; + * @param int $var + * @return $this + */ + public function setTrafficPercent($var) + { + GPBUtil::checkInt32($var); + $this->traffic_percent = $var; + + return $this; + } + + /** + * The minimum time that this step should last. Should be longer than 1 + * hour. If not set, the default minimum duration for each step will be 1 + * hour. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3; + * @return \Google\Protobuf\Duration|null + */ + public function getMinDuration() + { + return $this->min_duration; + } + + public function hasMinDuration() + { + return isset($this->min_duration); + } + + public function clearMinDuration() + { + unset($this->min_duration); + } + + /** + * The minimum time that this step should last. Should be longer than 1 + * hour. If not set, the default minimum duration for each step will be 1 + * hour. + * + * Generated from protobuf field .google.protobuf.Duration min_duration = 3; + * @param \Google\Protobuf\Duration $var + * @return $this + */ + public function setMinDuration($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Duration::class); + $this->min_duration = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/RolloutState.php b/DialogflowCx/src/V3/RolloutState.php new file mode 100644 index 000000000000..b8f796e8b78e --- /dev/null +++ b/DialogflowCx/src/V3/RolloutState.php @@ -0,0 +1,145 @@ +google.cloud.dialogflow.cx.v3.RolloutState + */ +class RolloutState extends \Google\Protobuf\Internal\Message +{ + /** + * Display name of the current auto rollout step. + * + * Generated from protobuf field string step = 1; + */ + protected $step = ''; + /** + * Index of the current step in the auto rollout steps list. + * + * Generated from protobuf field int32 step_index = 3; + */ + protected $step_index = 0; + /** + * Start time of the current step. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + */ + protected $start_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $step + * Display name of the current auto rollout step. + * @type int $step_index + * Index of the current step in the auto rollout steps list. + * @type \Google\Protobuf\Timestamp $start_time + * Start time of the current step. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Experiment::initOnce(); + parent::__construct($data); + } + + /** + * Display name of the current auto rollout step. + * + * Generated from protobuf field string step = 1; + * @return string + */ + public function getStep() + { + return $this->step; + } + + /** + * Display name of the current auto rollout step. + * + * Generated from protobuf field string step = 1; + * @param string $var + * @return $this + */ + public function setStep($var) + { + GPBUtil::checkString($var, True); + $this->step = $var; + + return $this; + } + + /** + * Index of the current step in the auto rollout steps list. + * + * Generated from protobuf field int32 step_index = 3; + * @return int + */ + public function getStepIndex() + { + return $this->step_index; + } + + /** + * Index of the current step in the auto rollout steps list. + * + * Generated from protobuf field int32 step_index = 3; + * @param int $var + * @return $this + */ + public function setStepIndex($var) + { + GPBUtil::checkInt32($var); + $this->step_index = $var; + + return $this; + } + + /** + * Start time of the current step. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start time of the current step. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RunContinuousTestMetadata.php b/DialogflowCx/src/V3/RunContinuousTestMetadata.php new file mode 100644 index 000000000000..5268445090ca --- /dev/null +++ b/DialogflowCx/src/V3/RunContinuousTestMetadata.php @@ -0,0 +1,69 @@ +google.cloud.dialogflow.cx.v3.RunContinuousTestMetadata + */ +class RunContinuousTestMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * The test errors. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError errors = 1; + */ + private $errors; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\TestError>|\Google\Protobuf\Internal\RepeatedField $errors + * The test errors. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * The test errors. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError errors = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getErrors() + { + return $this->errors; + } + + /** + * The test errors. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.TestError errors = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\TestError>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setErrors($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\TestError::class); + $this->errors = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RunContinuousTestRequest.php b/DialogflowCx/src/V3/RunContinuousTestRequest.php new file mode 100644 index 000000000000..8758231500cf --- /dev/null +++ b/DialogflowCx/src/V3/RunContinuousTestRequest.php @@ -0,0 +1,72 @@ +google.cloud.dialogflow.cx.v3.RunContinuousTestRequest + */ +class RunContinuousTestRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $environment = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $environment + * Required. Format: `projects//locations//agents//environments/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Required. Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkString($var, True); + $this->environment = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RunContinuousTestResponse.php b/DialogflowCx/src/V3/RunContinuousTestResponse.php new file mode 100644 index 000000000000..73ac7c3a10e2 --- /dev/null +++ b/DialogflowCx/src/V3/RunContinuousTestResponse.php @@ -0,0 +1,78 @@ +google.cloud.dialogflow.cx.v3.RunContinuousTestResponse + */ +class RunContinuousTestResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The result for a continuous test run. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ContinuousTestResult continuous_test_result = 1; + */ + protected $continuous_test_result = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\ContinuousTestResult $continuous_test_result + * The result for a continuous test run. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Environment::initOnce(); + parent::__construct($data); + } + + /** + * The result for a continuous test run. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ContinuousTestResult continuous_test_result = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\ContinuousTestResult|null + */ + public function getContinuousTestResult() + { + return $this->continuous_test_result; + } + + public function hasContinuousTestResult() + { + return isset($this->continuous_test_result); + } + + public function clearContinuousTestResult() + { + unset($this->continuous_test_result); + } + + /** + * The result for a continuous test run. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ContinuousTestResult continuous_test_result = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\ContinuousTestResult $var + * @return $this + */ + public function setContinuousTestResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ContinuousTestResult::class); + $this->continuous_test_result = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RunTestCaseMetadata.php b/DialogflowCx/src/V3/RunTestCaseMetadata.php new file mode 100644 index 000000000000..911a4f3537e9 --- /dev/null +++ b/DialogflowCx/src/V3/RunTestCaseMetadata.php @@ -0,0 +1,35 @@ +google.cloud.dialogflow.cx.v3.RunTestCaseMetadata + */ +class RunTestCaseMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + +} + diff --git a/DialogflowCx/src/V3/RunTestCaseRequest.php b/DialogflowCx/src/V3/RunTestCaseRequest.php new file mode 100644 index 000000000000..f0257812b66a --- /dev/null +++ b/DialogflowCx/src/V3/RunTestCaseRequest.php @@ -0,0 +1,114 @@ +google.cloud.dialogflow.cx.v3.RunTestCaseRequest + */ +class RunTestCaseRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Format of test case name to run: `projects//locations/ /agents//testCases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $environment = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Format of test case name to run: `projects//locations/ /agents//testCases/`. + * @type string $environment + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * Required. Format of test case name to run: `projects//locations/ /agents//testCases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Format of test case name to run: `projects//locations/ /agents//testCases/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getEnvironment() + { + return $this->environment; + } + + /** + * Optional. Environment name. If not set, draft environment is assumed. + * Format: `projects//locations//agents//environments/`. + * + * Generated from protobuf field string environment = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEnvironment($var) + { + GPBUtil::checkString($var, True); + $this->environment = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RunTestCaseResponse.php b/DialogflowCx/src/V3/RunTestCaseResponse.php new file mode 100644 index 000000000000..5dee95f93f91 --- /dev/null +++ b/DialogflowCx/src/V3/RunTestCaseResponse.php @@ -0,0 +1,78 @@ +google.cloud.dialogflow.cx.v3.RunTestCaseResponse + */ +class RunTestCaseResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The result. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TestCaseResult result = 2; + */ + protected $result = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\TestCaseResult $result + * The result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\TestCase::initOnce(); + parent::__construct($data); + } + + /** + * The result. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TestCaseResult result = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\TestCaseResult|null + */ + public function getResult() + { + return $this->result; + } + + public function hasResult() + { + return isset($this->result); + } + + public function clearResult() + { + unset($this->result); + } + + /** + * The result. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TestCaseResult result = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\TestCaseResult $var + * @return $this + */ + public function setResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TestCaseResult::class); + $this->result = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/SafetySettings.php b/DialogflowCx/src/V3/SafetySettings.php new file mode 100644 index 000000000000..0f5f366bfe5d --- /dev/null +++ b/DialogflowCx/src/V3/SafetySettings.php @@ -0,0 +1,67 @@ +google.cloud.dialogflow.cx.v3.SafetySettings + */ +class SafetySettings extends \Google\Protobuf\Internal\Message +{ + /** + * Banned phrases for generated text. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SafetySettings.Phrase banned_phrases = 1; + */ + private $banned_phrases; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\SafetySettings\Phrase>|\Google\Protobuf\Internal\RepeatedField $banned_phrases + * Banned phrases for generated text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SafetySettings::initOnce(); + parent::__construct($data); + } + + /** + * Banned phrases for generated text. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SafetySettings.Phrase banned_phrases = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getBannedPhrases() + { + return $this->banned_phrases; + } + + /** + * Banned phrases for generated text. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SafetySettings.Phrase banned_phrases = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\SafetySettings\Phrase>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setBannedPhrases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\Phrase::class); + $this->banned_phrases = $arr; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/SafetySettings/Phrase.php b/DialogflowCx/src/V3/SafetySettings/Phrase.php new file mode 100644 index 000000000000..dd675edc669c --- /dev/null +++ b/DialogflowCx/src/V3/SafetySettings/Phrase.php @@ -0,0 +1,102 @@ +google.cloud.dialogflow.cx.v3.SafetySettings.Phrase + */ +class Phrase extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Text input which can be used for prompt or banned phrases. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $text = ''; + /** + * Required. Language code of the phrase. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * Required. Text input which can be used for prompt or banned phrases. + * @type string $language_code + * Required. Language code of the phrase. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SafetySettings::initOnce(); + parent::__construct($data); + } + + /** + * Required. Text input which can be used for prompt or banned phrases. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Required. Text input which can be used for prompt or banned phrases. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + + /** + * Required. Language code of the phrase. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Required. Language code of the phrase. + * + * Generated from protobuf field string language_code = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/SecuritySettings.php b/DialogflowCx/src/V3/SecuritySettings.php new file mode 100644 index 000000000000..59d7042162c8 --- /dev/null +++ b/DialogflowCx/src/V3/SecuritySettings.php @@ -0,0 +1,655 @@ +google.cloud.dialogflow.cx.v3.SecuritySettings + */ +class SecuritySettings extends \Google\Protobuf\Internal\Message +{ + /** + * Resource name of the settings. + * Required for the + * [SecuritySettingsService.UpdateSecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettingsService.UpdateSecuritySettings] + * method. + * [SecuritySettingsService.CreateSecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettingsService.CreateSecuritySettings] + * populates the name automatically. Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the security settings, unique within + * the location. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Strategy that defines how we do redaction. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SecuritySettings.RedactionStrategy redaction_strategy = 3; + */ + protected $redaction_strategy = 0; + /** + * Defines the data for which Dialogflow applies redaction. Dialogflow does + * not redact data that it does not have access to – for example, Cloud + * logging. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SecuritySettings.RedactionScope redaction_scope = 4; + */ + protected $redaction_scope = 0; + /** + * [DLP](https://cloud.google.com/dlp/docs) inspect template name. Use this + * template to define inspect base settings. + * The `DLP Inspect Templates Reader` role is needed on the Dialogflow + * service identity service account (has the form + * `service-PROJECT_NUMBER@gcp-sa-dialogflow.iam.gserviceaccount.com`) + * for your agent's project. + * If empty, we use the default DLP inspect config. + * The template name will have one of the following formats: + * `projects//locations//inspectTemplates/