diff --git a/Dialogflow/metadata/V2/Agent.php b/Dialogflow/metadata/V2/Agent.php index db8d50a08c1c..caa3694defb3 100644 Binary files a/Dialogflow/metadata/V2/Agent.php and b/Dialogflow/metadata/V2/Agent.php differ diff --git a/Dialogflow/metadata/V2/AudioConfig.php b/Dialogflow/metadata/V2/AudioConfig.php index db7d22f851b5..eb04db8a7dd9 100644 Binary files a/Dialogflow/metadata/V2/AudioConfig.php and b/Dialogflow/metadata/V2/AudioConfig.php differ diff --git a/Dialogflow/metadata/V2/ConversationProfile.php b/Dialogflow/metadata/V2/ConversationProfile.php index 477defaf3812..94323012be69 100644 Binary files a/Dialogflow/metadata/V2/ConversationProfile.php and b/Dialogflow/metadata/V2/ConversationProfile.php differ diff --git a/Dialogflow/metadata/V2/Document.php b/Dialogflow/metadata/V2/Document.php index 1639bd663685..b9304035c058 100644 Binary files a/Dialogflow/metadata/V2/Document.php and b/Dialogflow/metadata/V2/Document.php differ diff --git a/Dialogflow/metadata/V2/Gcs.php b/Dialogflow/metadata/V2/Gcs.php index 898d10eb399f..3af9c2d4a8c4 100644 --- a/Dialogflow/metadata/V2/Gcs.php +++ b/Dialogflow/metadata/V2/Gcs.php @@ -18,8 +18,10 @@ public static function initOnce() { \GPBMetadata\Google\Api\Annotations::initOnce(); $pool->internalAddGeneratedFile( ' -‚ -$google/cloud/dialogflow/v2/gcs.protogoogle.cloud.dialogflow.v2google/api/annotations.protoB— +¡ +$google/cloud/dialogflow/v2/gcs.protogoogle.cloud.dialogflow.v2google/api/annotations.proto" +GcsDestination +uri ( B— com.google.cloud.dialogflow.v2BGcsProtoPZDgoogle.golang.org/genproto/googleapis/cloud/dialogflow/v2;dialogflowø¢DFªGoogle.Cloud.Dialogflow.V2bproto3' , true); diff --git a/Dialogflow/metadata/V2/KnowledgeBase.php b/Dialogflow/metadata/V2/KnowledgeBase.php index a44291d5b7d8..67114270329e 100644 --- a/Dialogflow/metadata/V2/KnowledgeBase.php +++ b/Dialogflow/metadata/V2/KnowledgeBase.php @@ -22,18 +22,19 @@ public static function initOnce() { \GPBMetadata\Google\Protobuf\FieldMask::initOnce(); $pool->internalAddGeneratedFile( ' -Ô +ä /google/cloud/dialogflow/v2/knowledge_base.protogoogle.cloud.dialogflow.v2google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto"ü KnowledgeBase name (  display_name ( BàA language_code ( :ªêA¦ -\'dialogflow.googleapis.com/KnowledgeBase2projects/{project}/knowledgeBases/{knowledge_base}Gprojects/{project}/locations/{location}/knowledgeBases/{knowledge_base}"ƒ +\'dialogflow.googleapis.com/KnowledgeBase2projects/{project}/knowledgeBases/{knowledge_base}Gprojects/{project}/locations/{location}/knowledgeBases/{knowledge_base}"“ ListKnowledgeBasesRequest? parent ( B/àAúA)\'dialogflow.googleapis.com/KnowledgeBase page_size ( -page_token ( "y +page_token (  +filter ( "y ListKnowledgeBasesResponseB knowledge_bases ( 2).google.cloud.dialogflow.v2.KnowledgeBase next_page_token ( "X diff --git a/Dialogflow/metadata/V2/Participant.php b/Dialogflow/metadata/V2/Participant.php index 17a46bb9ae55..9e4bf1b4ec30 100644 Binary files a/Dialogflow/metadata/V2/Participant.php and b/Dialogflow/metadata/V2/Participant.php differ diff --git a/Dialogflow/metadata/V2/Session.php b/Dialogflow/metadata/V2/Session.php index 6fa4b55aa0c0..7a8f058b1972 100644 Binary files a/Dialogflow/metadata/V2/Session.php and b/Dialogflow/metadata/V2/Session.php differ diff --git a/Dialogflow/src/V2/Agent/Tier.php b/Dialogflow/src/V2/Agent/Tier.php index a0cd18f299c9..c20b42316e00 100644 --- a/Dialogflow/src/V2/Agent/Tier.php +++ b/Dialogflow/src/V2/Agent/Tier.php @@ -20,21 +20,22 @@ class Tier */ const TIER_UNSPECIFIED = 0; /** - * Standard tier. + * Trial Edition, previously known as Standard Edition. * * Generated from protobuf enum TIER_STANDARD = 1; */ const TIER_STANDARD = 1; /** - * Enterprise tier (Essentials). + * Essentials Edition, previously known as Enterprise Essential Edition. * * Generated from protobuf enum TIER_ENTERPRISE = 2; */ const TIER_ENTERPRISE = 2; /** - * Enterprise tier (Plus). + * Essentials Edition (same as TIER_ENTERPRISE), previously known as + * Enterprise Plus Edition. * - * Generated from protobuf enum TIER_ENTERPRISE_PLUS = 3; + * Generated from protobuf enum TIER_ENTERPRISE_PLUS = 3 [deprecated = true]; */ const TIER_ENTERPRISE_PLUS = 3; diff --git a/Dialogflow/src/V2/AgentsClient.php b/Dialogflow/src/V2/AgentsClient.php index 2e0908551d25..c57a606e0167 100644 --- a/Dialogflow/src/V2/AgentsClient.php +++ b/Dialogflow/src/V2/AgentsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/agent.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/agent.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/AnalyzeContentRequest.php b/Dialogflow/src/V2/AnalyzeContentRequest.php index a4dcda38bad2..132c4f28ef8d 100644 --- a/Dialogflow/src/V2/AnalyzeContentRequest.php +++ b/Dialogflow/src/V2/AnalyzeContentRequest.php @@ -39,6 +39,12 @@ class AnalyzeContentRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.dialogflow.v2.QueryParameters query_params = 9; */ private $query_params = null; + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 14; + */ + private $assist_query_params = null; /** * A unique identifier for this request. Restricted to 36 ASCII characters. * A random UUID is recommended. @@ -71,6 +77,8 @@ class AnalyzeContentRequest extends \Google\Protobuf\Internal\Message * is disabled. * @type \Google\Cloud\Dialogflow\V2\QueryParameters $query_params * Parameters for a Dialogflow virtual-agent query. + * @type \Google\Cloud\Dialogflow\V2\AssistQueryParameters $assist_query_params + * Parameters for a human assist query. * @type string $request_id * A unique identifier for this request. Restricted to 36 ASCII characters. * A random UUID is recommended. @@ -254,6 +262,42 @@ public function setQueryParams($var) return $this; } + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 14; + * @return \Google\Cloud\Dialogflow\V2\AssistQueryParameters|null + */ + public function getAssistQueryParams() + { + return $this->assist_query_params; + } + + public function hasAssistQueryParams() + { + return isset($this->assist_query_params); + } + + public function clearAssistQueryParams() + { + unset($this->assist_query_params); + } + + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 14; + * @param \Google\Cloud\Dialogflow\V2\AssistQueryParameters $var + * @return $this + */ + public function setAssistQueryParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\AssistQueryParameters::class); + $this->assist_query_params = $var; + + return $this; + } + /** * A unique identifier for this request. Restricted to 36 ASCII characters. * A random UUID is recommended. diff --git a/Dialogflow/src/V2/AnswerRecordsClient.php b/Dialogflow/src/V2/AnswerRecordsClient.php index cc64babbe572..f04815446e5a 100644 --- a/Dialogflow/src/V2/AnswerRecordsClient.php +++ b/Dialogflow/src/V2/AnswerRecordsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/answer_record.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/answer_record.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/AssistQueryParameters.php b/Dialogflow/src/V2/AssistQueryParameters.php new file mode 100644 index 000000000000..d526ca6b4d6a --- /dev/null +++ b/Dialogflow/src/V2/AssistQueryParameters.php @@ -0,0 +1,127 @@ +google.cloud.dialogflow.v2.AssistQueryParameters + */ +class AssistQueryParameters extends \Google\Protobuf\Internal\Message +{ + /** + * Key-value filters on the metadata of documents returned by article + * suggestion. If specified, article suggestion only returns suggested + * documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + * values for a metadata key should be concatenated by comma. For example, + * filters to match all documents that have 'US' or 'CA' in their market + * metadata values and 'agent' in their user metadata values will be + * ``` + * documents_metadata_filters { + * key: "market" + * value: "US,CA" + * } + * documents_metadata_filters { + * key: "user" + * value: "agent" + * } + * ``` + * + * Generated from protobuf field map documents_metadata_filters = 1; + */ + private $documents_metadata_filters; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\MapField $documents_metadata_filters + * Key-value filters on the metadata of documents returned by article + * suggestion. If specified, article suggestion only returns suggested + * documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + * values for a metadata key should be concatenated by comma. For example, + * filters to match all documents that have 'US' or 'CA' in their market + * metadata values and 'agent' in their user metadata values will be + * ``` + * documents_metadata_filters { + * key: "market" + * value: "US,CA" + * } + * documents_metadata_filters { + * key: "user" + * value: "agent" + * } + * ``` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Participant::initOnce(); + parent::__construct($data); + } + + /** + * Key-value filters on the metadata of documents returned by article + * suggestion. If specified, article suggestion only returns suggested + * documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + * values for a metadata key should be concatenated by comma. For example, + * filters to match all documents that have 'US' or 'CA' in their market + * metadata values and 'agent' in their user metadata values will be + * ``` + * documents_metadata_filters { + * key: "market" + * value: "US,CA" + * } + * documents_metadata_filters { + * key: "user" + * value: "agent" + * } + * ``` + * + * Generated from protobuf field map documents_metadata_filters = 1; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDocumentsMetadataFilters() + { + return $this->documents_metadata_filters; + } + + /** + * Key-value filters on the metadata of documents returned by article + * suggestion. If specified, article suggestion only returns suggested + * documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + * values for a metadata key should be concatenated by comma. For example, + * filters to match all documents that have 'US' or 'CA' in their market + * metadata values and 'agent' in their user metadata values will be + * ``` + * documents_metadata_filters { + * key: "market" + * value: "US,CA" + * } + * documents_metadata_filters { + * key: "user" + * value: "agent" + * } + * ``` + * + * Generated from protobuf field map documents_metadata_filters = 1; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDocumentsMetadataFilters($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->documents_metadata_filters = $arr; + + return $this; + } + +} + diff --git a/Dialogflow/src/V2/AutomatedAgentConfig.php b/Dialogflow/src/V2/AutomatedAgentConfig.php index eea8d047cb6d..edad6765081f 100644 --- a/Dialogflow/src/V2/AutomatedAgentConfig.php +++ b/Dialogflow/src/V2/AutomatedAgentConfig.php @@ -21,11 +21,15 @@ class AutomatedAgentConfig extends \Google\Protobuf\Internal\Message * need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API * Service Agent` role in this project. - * Format: `projects//locations//locations//agent/environments/`. If environment is not * specified, the default `draft` environment is used. Refer to * [DetectIntentRequest](https://cloud.google.com/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest) * for more details. + * - For CX agents, use format `projects//locations//agents//environments/`. If environment is not specified, the default `draft` environment + * is used. * * Generated from protobuf field string agent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -43,11 +47,15 @@ class AutomatedAgentConfig extends \Google\Protobuf\Internal\Message * need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API * Service Agent` role in this project. - * Format: `projects//locations//locations//agent/environments/`. If environment is not * specified, the default `draft` environment is used. Refer to * [DetectIntentRequest](https://cloud.google.com/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest) * for more details. + * - For CX agents, use format `projects//locations//agents//environments/`. If environment is not specified, the default `draft` environment + * is used. * } */ public function __construct($data = NULL) { @@ -61,11 +69,15 @@ public function __construct($data = NULL) { * need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API * Service Agent` role in this project. - * Format: `projects//locations//locations//agent/environments/`. If environment is not * specified, the default `draft` environment is used. Refer to * [DetectIntentRequest](https://cloud.google.com/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest) * for more details. + * - For CX agents, use format `projects//locations//agents//environments/`. If environment is not specified, the default `draft` environment + * is used. * * Generated from protobuf field string agent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -81,11 +93,15 @@ public function getAgent() * need to grant `service-@gcp-sa-dialogflow.iam.gserviceaccount.com` the `Dialogflow API * Service Agent` role in this project. - * Format: `projects//locations//locations//agent/environments/`. If environment is not * specified, the default `draft` environment is used. Refer to * [DetectIntentRequest](https://cloud.google.com/dialogflow/docs/reference/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.DetectIntentRequest) * for more details. + * - For CX agents, use format `projects//locations//agents//environments/`. If environment is not specified, the default `draft` environment + * is used. * * Generated from protobuf field string agent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/Dialogflow/src/V2/ContextsClient.php b/Dialogflow/src/V2/ContextsClient.php index bf11f23988c4..248297bec6bf 100644 --- a/Dialogflow/src/V2/ContextsClient.php +++ b/Dialogflow/src/V2/ContextsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/context.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/context.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/ConversationProfile.php b/Dialogflow/src/V2/ConversationProfile.php index 02c9eaa09ca4..d2ed7afc19cc 100644 --- a/Dialogflow/src/V2/ConversationProfile.php +++ b/Dialogflow/src/V2/ConversationProfile.php @@ -87,13 +87,31 @@ class ConversationProfile extends \Google\Protobuf\Internal\Message */ private $stt_config = null; /** - * Language which represents the conversationProfile. - * If unspecified, the default language code en-us applies. Users need to - * create a ConversationProfile for each language they want to support. + * Language code for the conversation profile. If not specified, the language + * is en-US. Language at ConversationProfile should be set for all non en-US + * languages. + * This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag. Example: "en-US". * * Generated from protobuf field string language_code = 10; */ private $language_code = ''; + /** + * The time zone of this conversational profile from the + * [time zone database](https://www.iana.org/time-zones), e.g., + * America/New_York, Europe/Paris. Defaults to America/New_York. + * + * Generated from protobuf field string time_zone = 14; + */ + private $time_zone = ''; + /** + * Name of the CX SecuritySettings reference for the agent. + * Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string security_settings = 13 [(.google.api.resource_reference) = { + */ + private $security_settings = ''; /** * Constructor. @@ -129,9 +147,19 @@ class ConversationProfile extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Dialogflow\V2\SpeechToTextConfig $stt_config * Settings for speech transcription. * @type string $language_code - * Language which represents the conversationProfile. - * If unspecified, the default language code en-us applies. Users need to - * create a ConversationProfile for each language they want to support. + * Language code for the conversation profile. If not specified, the language + * is en-US. Language at ConversationProfile should be set for all non en-US + * languages. + * This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag. Example: "en-US". + * @type string $time_zone + * The time zone of this conversational profile from the + * [time zone database](https://www.iana.org/time-zones), e.g., + * America/New_York, Europe/Paris. Defaults to America/New_York. + * @type string $security_settings + * Name of the CX SecuritySettings reference for the agent. + * Format: `projects//locations//securitySettings/`. * } */ public function __construct($data = NULL) { @@ -526,9 +554,11 @@ public function setSttConfig($var) } /** - * Language which represents the conversationProfile. - * If unspecified, the default language code en-us applies. Users need to - * create a ConversationProfile for each language they want to support. + * Language code for the conversation profile. If not specified, the language + * is en-US. Language at ConversationProfile should be set for all non en-US + * languages. + * This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag. Example: "en-US". * * Generated from protobuf field string language_code = 10; * @return string @@ -539,9 +569,11 @@ public function getLanguageCode() } /** - * Language which represents the conversationProfile. - * If unspecified, the default language code en-us applies. Users need to - * create a ConversationProfile for each language they want to support. + * Language code for the conversation profile. If not specified, the language + * is en-US. Language at ConversationProfile should be set for all non en-US + * languages. + * This should be a [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) + * language tag. Example: "en-US". * * Generated from protobuf field string language_code = 10; * @param string $var @@ -555,5 +587,65 @@ public function setLanguageCode($var) return $this; } + /** + * The time zone of this conversational profile from the + * [time zone database](https://www.iana.org/time-zones), e.g., + * America/New_York, Europe/Paris. Defaults to America/New_York. + * + * Generated from protobuf field string time_zone = 14; + * @return string + */ + public function getTimeZone() + { + return $this->time_zone; + } + + /** + * The time zone of this conversational profile from the + * [time zone database](https://www.iana.org/time-zones), e.g., + * America/New_York, Europe/Paris. Defaults to America/New_York. + * + * Generated from protobuf field string time_zone = 14; + * @param string $var + * @return $this + */ + public function setTimeZone($var) + { + GPBUtil::checkString($var, True); + $this->time_zone = $var; + + return $this; + } + + /** + * Name of the CX SecuritySettings reference for the agent. + * Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string security_settings = 13 [(.google.api.resource_reference) = { + * @return string + */ + public function getSecuritySettings() + { + return $this->security_settings; + } + + /** + * Name of the CX SecuritySettings reference for the agent. + * Format: `projects//locations//securitySettings/`. + * + * Generated from protobuf field string security_settings = 13 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecuritySettings($var) + { + GPBUtil::checkString($var, True); + $this->security_settings = $var; + + return $this; + } + } diff --git a/Dialogflow/src/V2/ConversationProfilesClient.php b/Dialogflow/src/V2/ConversationProfilesClient.php index c58761004749..a7d521124b7e 100644 --- a/Dialogflow/src/V2/ConversationProfilesClient.php +++ b/Dialogflow/src/V2/ConversationProfilesClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/conversation_profile.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/conversation_profile.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/ConversationsClient.php b/Dialogflow/src/V2/ConversationsClient.php index 203bbea2dacb..9adedcffad46 100644 --- a/Dialogflow/src/V2/ConversationsClient.php +++ b/Dialogflow/src/V2/ConversationsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/conversation.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/conversation.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/DocumentsClient.php b/Dialogflow/src/V2/DocumentsClient.php index 939e859ce976..7ea2ed99e947 100644 --- a/Dialogflow/src/V2/DocumentsClient.php +++ b/Dialogflow/src/V2/DocumentsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/document.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/document.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/DocumentsGrpcClient.php b/Dialogflow/src/V2/DocumentsGrpcClient.php index efdec54015c6..ae624b1234c3 100644 --- a/Dialogflow/src/V2/DocumentsGrpcClient.php +++ b/Dialogflow/src/V2/DocumentsGrpcClient.php @@ -157,4 +157,27 @@ public function ReloadDocument(\Google\Cloud\Dialogflow\V2\ReloadDocumentRequest $metadata, $options); } + /** + * Exports a smart messaging candidate document into the specified + * destination. + * + * 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`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + * - `response`: [Document][google.cloud.dialogflow.v2.Document] + * @param \Google\Cloud\Dialogflow\V2\ExportDocumentRequest $argument input argument + * @param array $metadata metadata + * @param array $options call options + * @return \Grpc\UnaryCall + */ + public function ExportDocument(\Google\Cloud\Dialogflow\V2\ExportDocumentRequest $argument, + $metadata = [], $options = []) { + return $this->_simpleRequest('/google.cloud.dialogflow.v2.Documents/ExportDocument', + $argument, + ['\Google\LongRunning\Operation', 'decode'], + $metadata, $options); + } + } diff --git a/Dialogflow/src/V2/EntityTypesClient.php b/Dialogflow/src/V2/EntityTypesClient.php index 5aa2cae3c128..ed8c7d7bec47 100644 --- a/Dialogflow/src/V2/EntityTypesClient.php +++ b/Dialogflow/src/V2/EntityTypesClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/entity_type.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/entity_type.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/EnvironmentsClient.php b/Dialogflow/src/V2/EnvironmentsClient.php index efd206f0c88d..836604915871 100644 --- a/Dialogflow/src/V2/EnvironmentsClient.php +++ b/Dialogflow/src/V2/EnvironmentsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/environment.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/environment.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/ExportDocumentRequest.php b/Dialogflow/src/V2/ExportDocumentRequest.php new file mode 100644 index 000000000000..e0c7abc11235 --- /dev/null +++ b/Dialogflow/src/V2/ExportDocumentRequest.php @@ -0,0 +1,193 @@ +google.cloud.dialogflow.v2.ExportDocumentRequest + */ +class ExportDocumentRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + private $name = ''; + /** + * When enabled, export the full content of the document including empirical + * probability. + * + * Generated from protobuf field bool export_full_content = 3; + */ + private $export_full_content = false; + /** + * When enabled, export the smart messaging allowlist document for partial + * update. + * + * Generated from protobuf field bool smart_messaging_partial_update = 5; + */ + private $smart_messaging_partial_update = false; + protected $destination; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + * @type \Google\Cloud\Dialogflow\V2\GcsDestination $gcs_destination + * Cloud Storage file path to export the document. + * @type bool $export_full_content + * When enabled, export the full content of the document including empirical + * probability. + * @type bool $smart_messaging_partial_update + * When enabled, export the smart messaging allowlist document for partial + * update. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Document::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + * + * 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 document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + * + * 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; + } + + /** + * Cloud Storage file path to export the document. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.GcsDestination gcs_destination = 2; + * @return \Google\Cloud\Dialogflow\V2\GcsDestination|null + */ + public function getGcsDestination() + { + return $this->readOneof(2); + } + + public function hasGcsDestination() + { + return $this->hasOneof(2); + } + + /** + * Cloud Storage file path to export the document. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.GcsDestination gcs_destination = 2; + * @param \Google\Cloud\Dialogflow\V2\GcsDestination $var + * @return $this + */ + public function setGcsDestination($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\GcsDestination::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * When enabled, export the full content of the document including empirical + * probability. + * + * Generated from protobuf field bool export_full_content = 3; + * @return bool + */ + public function getExportFullContent() + { + return $this->export_full_content; + } + + /** + * When enabled, export the full content of the document including empirical + * probability. + * + * Generated from protobuf field bool export_full_content = 3; + * @param bool $var + * @return $this + */ + public function setExportFullContent($var) + { + GPBUtil::checkBool($var); + $this->export_full_content = $var; + + return $this; + } + + /** + * When enabled, export the smart messaging allowlist document for partial + * update. + * + * Generated from protobuf field bool smart_messaging_partial_update = 5; + * @return bool + */ + public function getSmartMessagingPartialUpdate() + { + return $this->smart_messaging_partial_update; + } + + /** + * When enabled, export the smart messaging allowlist document for partial + * update. + * + * Generated from protobuf field bool smart_messaging_partial_update = 5; + * @param bool $var + * @return $this + */ + public function setSmartMessagingPartialUpdate($var) + { + GPBUtil::checkBool($var); + $this->smart_messaging_partial_update = $var; + + return $this; + } + + /** + * @return string + */ + public function getDestination() + { + return $this->whichOneof("destination"); + } + +} + diff --git a/Dialogflow/src/V2/FulfillmentsClient.php b/Dialogflow/src/V2/FulfillmentsClient.php index 8a8cedd5f5b4..d47655e931ea 100644 --- a/Dialogflow/src/V2/FulfillmentsClient.php +++ b/Dialogflow/src/V2/FulfillmentsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/fulfillment.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/fulfillment.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/AgentsGapicClient.php b/Dialogflow/src/V2/Gapic/AgentsGapicClient.php index a3296bdbd69b..eb17cd8d7037 100644 --- a/Dialogflow/src/V2/Gapic/AgentsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/AgentsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/agent.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/agent.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/AnswerRecordsGapicClient.php b/Dialogflow/src/V2/Gapic/AnswerRecordsGapicClient.php index 93ab3b8c3370..9fc350914932 100644 --- a/Dialogflow/src/V2/Gapic/AnswerRecordsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/AnswerRecordsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/answer_record.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/answer_record.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/ContextsGapicClient.php b/Dialogflow/src/V2/Gapic/ContextsGapicClient.php index b411916f4e5c..d044bb06e287 100644 --- a/Dialogflow/src/V2/Gapic/ContextsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/ContextsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/context.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/context.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/ConversationProfilesGapicClient.php b/Dialogflow/src/V2/Gapic/ConversationProfilesGapicClient.php index 9def5568d67a..ff09a69e1fad 100644 --- a/Dialogflow/src/V2/Gapic/ConversationProfilesGapicClient.php +++ b/Dialogflow/src/V2/Gapic/ConversationProfilesGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/conversation_profile.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/conversation_profile.proto * Updates to the above are reflected here through a refresh process. */ @@ -98,6 +98,8 @@ class ConversationProfilesGapicClient 'https://www.googleapis.com/auth/dialogflow', ]; + private static $cXSecuritySettingsNameTemplate; + private static $conversationProfileNameTemplate; private static $locationNameTemplate; @@ -129,6 +131,15 @@ private static function getClientDefaults() ]; } + private static function getCXSecuritySettingsNameTemplate() + { + if (self::$cXSecuritySettingsNameTemplate == null) { + self::$cXSecuritySettingsNameTemplate = new PathTemplate('projects/{project}/locations/{location}/securitySettings/{security_settings}'); + } + + return self::$cXSecuritySettingsNameTemplate; + } + private static function getConversationProfileNameTemplate() { if (self::$conversationProfileNameTemplate == null) { @@ -178,6 +189,7 @@ private static function getPathTemplateMap() { if (self::$pathTemplateMap == null) { self::$pathTemplateMap = [ + 'cXSecuritySettings' => self::getCXSecuritySettingsNameTemplate(), 'conversationProfile' => self::getConversationProfileNameTemplate(), 'location' => self::getLocationNameTemplate(), 'project' => self::getProjectNameTemplate(), @@ -189,6 +201,25 @@ private static function getPathTemplateMap() return self::$pathTemplateMap; } + /** + * Formats a string containing the fully-qualified path to represent a + * cx_security_settings resource. + * + * @param string $project + * @param string $location + * @param string $securitySettings + * + * @return string The formatted cx_security_settings resource. + */ + public static function cXSecuritySettingsName($project, $location, $securitySettings) + { + return self::getCXSecuritySettingsNameTemplate()->render([ + 'project' => $project, + 'location' => $location, + 'security_settings' => $securitySettings, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * conversation_profile resource. @@ -278,6 +309,7 @@ public static function projectLocationConversationProfileName($project, $locatio * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - cXSecuritySettings: projects/{project}/locations/{location}/securitySettings/{security_settings} * - conversationProfile: projects/{project}/conversationProfiles/{conversation_profile} * - location: projects/{project}/locations/{location} * - project: projects/{project} diff --git a/Dialogflow/src/V2/Gapic/ConversationsGapicClient.php b/Dialogflow/src/V2/Gapic/ConversationsGapicClient.php index 7206657b1d43..afaaf8cd1ac5 100644 --- a/Dialogflow/src/V2/Gapic/ConversationsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/ConversationsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/conversation.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/conversation.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/DocumentsGapicClient.php b/Dialogflow/src/V2/Gapic/DocumentsGapicClient.php index 86a3a1a42bab..3d44096c92df 100644 --- a/Dialogflow/src/V2/Gapic/DocumentsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/DocumentsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/document.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/document.proto * Updates to the above are reflected here through a refresh process. */ @@ -40,6 +40,8 @@ use Google\Cloud\Dialogflow\V2\CreateDocumentRequest; use Google\Cloud\Dialogflow\V2\DeleteDocumentRequest; use Google\Cloud\Dialogflow\V2\Document; +use Google\Cloud\Dialogflow\V2\ExportDocumentRequest; +use Google\Cloud\Dialogflow\V2\GcsDestination; use Google\Cloud\Dialogflow\V2\GetDocumentRequest; use Google\Cloud\Dialogflow\V2\KnowledgeOperationMetadata; use Google\Cloud\Dialogflow\V2\ListDocumentsRequest; @@ -634,6 +636,101 @@ public function deleteDocument($name, array $optionalArgs = []) return $this->startOperationsCall('DeleteDocument', $optionalArgs, $request, $this->getOperationsClient())->wait(); } + /** + * Exports a smart messaging candidate document into the specified + * destination. + * + * 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`: [KnowledgeOperationMetadata][google.cloud.dialogflow.v2.KnowledgeOperationMetadata] + * - `response`: [Document][google.cloud.dialogflow.v2.Document] + * + * Sample code: + * ``` + * $documentsClient = new DocumentsClient(); + * try { + * $formattedName = $documentsClient->documentName('[PROJECT]', '[KNOWLEDGE_BASE]', '[DOCUMENT]'); + * $operationResponse = $documentsClient->exportDocument($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 = $documentsClient->exportDocument($formattedName); + * $operationName = $operationResponse->getName(); + * // ... do other work + * $newOperationResponse = $documentsClient->resumeOperation($operationName, 'exportDocument'); + * while (!$newOperationResponse->isDone()) { + * // ... do other work + * $newOperationResponse->reload(); + * } + * if ($newOperationResponse->operationSucceeded()) { + * $result = $newOperationResponse->getResult(); + * // doSomethingWith($result) + * } else { + * $error = $newOperationResponse->getError(); + * // handleError($error) + * } + * } finally { + * $documentsClient->close(); + * } + * ``` + * + * @param string $name Required. The name of the document to export. + * Format: `projects//locations//knowledgeBases//documents/`. + * @param array $optionalArgs { + * Optional. + * + * @type GcsDestination $gcsDestination + * Cloud Storage file path to export the document. + * @type bool $exportFullContent + * When enabled, export the full content of the document including empirical + * probability. + * @type bool $smartMessagingPartialUpdate + * When enabled, export the smart messaging allowlist document for partial + * update. + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a + * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry + * settings parameters. See the documentation on + * {@see Google\ApiCore\RetrySettings} for example usage. + * } + * + * @return \Google\ApiCore\OperationResponse + * + * @throws ApiException if the remote call fails + */ + public function exportDocument($name, array $optionalArgs = []) + { + $request = new ExportDocumentRequest(); + $requestParamHeaders = []; + $request->setName($name); + $requestParamHeaders['name'] = $name; + if (isset($optionalArgs['gcsDestination'])) { + $request->setGcsDestination($optionalArgs['gcsDestination']); + } + + if (isset($optionalArgs['exportFullContent'])) { + $request->setExportFullContent($optionalArgs['exportFullContent']); + } + + if (isset($optionalArgs['smartMessagingPartialUpdate'])) { + $request->setSmartMessagingPartialUpdate($optionalArgs['smartMessagingPartialUpdate']); + } + + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); + $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); + return $this->startOperationsCall('ExportDocument', $optionalArgs, $request, $this->getOperationsClient())->wait(); + } + /** * Retrieves the specified document. * @@ -717,6 +814,28 @@ public function getDocument($name, array $optionalArgs = []) * 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 documents returned by the list method. + * The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * + * Examples: + * + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry @@ -742,6 +861,10 @@ public function listDocuments($parent, array $optionalArgs = []) $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('ListDocuments', $optionalArgs, ListDocumentsResponse::class, $request); @@ -811,6 +934,12 @@ public function listDocuments($parent, array $optionalArgs = []) * * For documents stored in Google Cloud Storage, these URIs must have * the form `gs:///`. + * @type bool $importGcsCustomMetadata + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @type bool $smartMessagingPartialUpdate + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry @@ -832,6 +961,14 @@ public function reloadDocument($name, array $optionalArgs = []) $request->setContentUri($optionalArgs['contentUri']); } + if (isset($optionalArgs['importGcsCustomMetadata'])) { + $request->setImportGcsCustomMetadata($optionalArgs['importGcsCustomMetadata']); + } + + if (isset($optionalArgs['smartMessagingPartialUpdate'])) { + $request->setSmartMessagingPartialUpdate($optionalArgs['smartMessagingPartialUpdate']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startOperationsCall('ReloadDocument', $optionalArgs, $request, $this->getOperationsClient())->wait(); diff --git a/Dialogflow/src/V2/Gapic/EntityTypesGapicClient.php b/Dialogflow/src/V2/Gapic/EntityTypesGapicClient.php index cae3b5624a6a..13f155e2db06 100644 --- a/Dialogflow/src/V2/Gapic/EntityTypesGapicClient.php +++ b/Dialogflow/src/V2/Gapic/EntityTypesGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/entity_type.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/entity_type.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/EnvironmentsGapicClient.php b/Dialogflow/src/V2/Gapic/EnvironmentsGapicClient.php index 91354dd1d08e..0bf17a0e76b7 100644 --- a/Dialogflow/src/V2/Gapic/EnvironmentsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/EnvironmentsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/environment.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/environment.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/FulfillmentsGapicClient.php b/Dialogflow/src/V2/Gapic/FulfillmentsGapicClient.php index 2a1639d1a35e..a07552f953b8 100644 --- a/Dialogflow/src/V2/Gapic/FulfillmentsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/FulfillmentsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/fulfillment.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/fulfillment.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/IntentsGapicClient.php b/Dialogflow/src/V2/Gapic/IntentsGapicClient.php index a0f2af7d93de..d882291ece4b 100644 --- a/Dialogflow/src/V2/Gapic/IntentsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/IntentsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/intent.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/intent.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/KnowledgeBasesGapicClient.php b/Dialogflow/src/V2/Gapic/KnowledgeBasesGapicClient.php index 0f4e3857cd4d..3b0ee39d7f09 100644 --- a/Dialogflow/src/V2/Gapic/KnowledgeBasesGapicClient.php +++ b/Dialogflow/src/V2/Gapic/KnowledgeBasesGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/knowledge_base.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/knowledge_base.proto * Updates to the above are reflected here through a refresh process. */ @@ -555,6 +555,33 @@ public function getKnowledgeBase($name, array $optionalArgs = []) * 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 knowledge bases returned by the list + * method. The expression has the following syntax: + * + * [AND ] ... + * + * The following fields and operators are supported: + * + * * display_name with has(:) operator + * * language_code with equals(=) operator + * + * Examples: + * + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry @@ -580,6 +607,10 @@ public function listKnowledgeBases($parent, array $optionalArgs = []) $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('ListKnowledgeBases', $optionalArgs, ListKnowledgeBasesResponse::class, $request); diff --git a/Dialogflow/src/V2/Gapic/ParticipantsGapicClient.php b/Dialogflow/src/V2/Gapic/ParticipantsGapicClient.php index ffe75d71d79c..7e5d1f4b94ea 100644 --- a/Dialogflow/src/V2/Gapic/ParticipantsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/ParticipantsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/participant.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/participant.proto * Updates to the above are reflected here through a refresh process. */ @@ -36,6 +36,7 @@ use Google\Auth\FetchAuthTokenInterface; use Google\Cloud\Dialogflow\V2\AnalyzeContentRequest; use Google\Cloud\Dialogflow\V2\AnalyzeContentResponse; +use Google\Cloud\Dialogflow\V2\AssistQueryParameters; use Google\Cloud\Dialogflow\V2\CreateParticipantRequest; use Google\Cloud\Dialogflow\V2\EventInput; use Google\Cloud\Dialogflow\V2\GetParticipantRequest; @@ -564,6 +565,8 @@ public function __construct(array $options = []) * is disabled. * @type QueryParameters $queryParams * Parameters for a Dialogflow virtual-agent query. + * @type AssistQueryParameters $assistQueryParams + * Parameters for a human assist query. * @type string $requestId * A unique identifier for this request. Restricted to 36 ASCII characters. * A random UUID is recommended. @@ -601,6 +604,10 @@ public function analyzeContent($participant, array $optionalArgs = []) $request->setQueryParams($optionalArgs['queryParams']); } + if (isset($optionalArgs['assistQueryParams'])) { + $request->setAssistQueryParams($optionalArgs['assistQueryParams']); + } + if (isset($optionalArgs['requestId'])) { $request->setRequestId($optionalArgs['requestId']); } @@ -799,6 +806,8 @@ public function listParticipants($parent, array $optionalArgs = []) * Max number of messages prior to and including * [latest_message][google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message] to use as context * when compiling the suggestion. By default 20 and at most 50. + * @type AssistQueryParameters $assistQueryParams + * Parameters for a human assist query. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry @@ -824,6 +833,10 @@ public function suggestArticles($parent, array $optionalArgs = []) $request->setContextSize($optionalArgs['contextSize']); } + if (isset($optionalArgs['assistQueryParams'])) { + $request->setAssistQueryParams($optionalArgs['assistQueryParams']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall('SuggestArticles', SuggestArticlesResponse::class, $optionalArgs, $request)->wait(); @@ -860,6 +873,8 @@ public function suggestArticles($parent, array $optionalArgs = []) * Max number of messages prior to and including * [latest_message] to use as context when compiling the * suggestion. By default 20 and at most 50. + * @type AssistQueryParameters $assistQueryParams + * Parameters for a human assist query. * @type RetrySettings|array $retrySettings * Retry settings to use for this call. Can be a * {@see Google\ApiCore\RetrySettings} object, or an associative array of retry @@ -885,6 +900,10 @@ public function suggestFaqAnswers($parent, array $optionalArgs = []) $request->setContextSize($optionalArgs['contextSize']); } + if (isset($optionalArgs['assistQueryParams'])) { + $request->setAssistQueryParams($optionalArgs['assistQueryParams']); + } + $requestParams = new RequestParamsHeaderDescriptor($requestParamHeaders); $optionalArgs['headers'] = isset($optionalArgs['headers']) ? array_merge($requestParams->getHeader(), $optionalArgs['headers']) : $requestParams->getHeader(); return $this->startCall('SuggestFaqAnswers', SuggestFaqAnswersResponse::class, $optionalArgs, $request)->wait(); diff --git a/Dialogflow/src/V2/Gapic/SessionEntityTypesGapicClient.php b/Dialogflow/src/V2/Gapic/SessionEntityTypesGapicClient.php index 452d9da01dd6..13cb2d61a1aa 100644 --- a/Dialogflow/src/V2/Gapic/SessionEntityTypesGapicClient.php +++ b/Dialogflow/src/V2/Gapic/SessionEntityTypesGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/session_entity_type.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/session_entity_type.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/SessionsGapicClient.php b/Dialogflow/src/V2/Gapic/SessionsGapicClient.php index 52dc65eff6c9..c2f241268ae7 100644 --- a/Dialogflow/src/V2/Gapic/SessionsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/SessionsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/session.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/session.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/Gapic/VersionsGapicClient.php b/Dialogflow/src/V2/Gapic/VersionsGapicClient.php index 1326c95d2315..783a30f20457 100644 --- a/Dialogflow/src/V2/Gapic/VersionsGapicClient.php +++ b/Dialogflow/src/V2/Gapic/VersionsGapicClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/version.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/version.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/GcsDestination.php b/Dialogflow/src/V2/GcsDestination.php new file mode 100644 index 000000000000..254d3811b1a1 --- /dev/null +++ b/Dialogflow/src/V2/GcsDestination.php @@ -0,0 +1,83 @@ +google.cloud.dialogflow.v2.GcsDestination + */ +class GcsDestination extends \Google\Protobuf\Internal\Message +{ + /** + * The Google Cloud Storage URIs for the output. A URI is of the + * form: + * gs://bucket/object-prefix-or-name + * Whether a prefix or name is used depends on the use case. The requesting + * user must have "write-permission" to the bucket. + * + * Generated from protobuf field string uri = 1; + */ + private $uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $uri + * The Google Cloud Storage URIs for the output. A URI is of the + * form: + * gs://bucket/object-prefix-or-name + * Whether a prefix or name is used depends on the use case. The requesting + * user must have "write-permission" to the bucket. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\V2\Gcs::initOnce(); + parent::__construct($data); + } + + /** + * The Google Cloud Storage URIs for the output. A URI is of the + * form: + * gs://bucket/object-prefix-or-name + * Whether a prefix or name is used depends on the use case. The requesting + * user must have "write-permission" to the bucket. + * + * Generated from protobuf field string uri = 1; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * The Google Cloud Storage URIs for the output. A URI is of the + * form: + * gs://bucket/object-prefix-or-name + * Whether a prefix or name is used depends on the use case. The requesting + * user must have "write-permission" to the bucket. + * + * Generated from protobuf field string uri = 1; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + +} + diff --git a/Dialogflow/src/V2/HumanAgentAssistantConfig/SuggestionQueryConfig.php b/Dialogflow/src/V2/HumanAgentAssistantConfig/SuggestionQueryConfig.php index 1d7764d74734..30df0bbba2c1 100644 --- a/Dialogflow/src/V2/HumanAgentAssistantConfig/SuggestionQueryConfig.php +++ b/Dialogflow/src/V2/HumanAgentAssistantConfig/SuggestionQueryConfig.php @@ -36,7 +36,7 @@ class SuggestionQueryConfig extends \Google\Protobuf\Internal\Message * desired results. * If this field is not set, it defaults to 0.0, which means that all * suggestions are returned. - * Supported features: ARTICLE_SUGGESTION. + * Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE. * * Generated from protobuf field float confidence_threshold = 5; */ @@ -81,7 +81,7 @@ class SuggestionQueryConfig extends \Google\Protobuf\Internal\Message * desired results. * If this field is not set, it defaults to 0.0, which means that all * suggestions are returned. - * Supported features: ARTICLE_SUGGESTION. + * Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE. * @type \Google\Cloud\Dialogflow\V2\HumanAgentAssistantConfig\SuggestionQueryConfig\ContextFilterSettings $context_filter_settings * Determines how recent conversation context is filtered when generating * suggestions. If unspecified, no messages will be dropped. @@ -231,7 +231,7 @@ public function setMaxResults($var) * desired results. * If this field is not set, it defaults to 0.0, which means that all * suggestions are returned. - * Supported features: ARTICLE_SUGGESTION. + * Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE. * * Generated from protobuf field float confidence_threshold = 5; * @return float @@ -255,7 +255,7 @@ public function getConfidenceThreshold() * desired results. * If this field is not set, it defaults to 0.0, which means that all * suggestions are returned. - * Supported features: ARTICLE_SUGGESTION. + * Supported features: ARTICLE_SUGGESTION, FAQ, SMART_REPLY, SMART_COMPOSE. * * Generated from protobuf field float confidence_threshold = 5; * @param float $var diff --git a/Dialogflow/src/V2/IntentsClient.php b/Dialogflow/src/V2/IntentsClient.php index 9654d47fb916..e85467bcf97c 100644 --- a/Dialogflow/src/V2/IntentsClient.php +++ b/Dialogflow/src/V2/IntentsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/intent.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/intent.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/KnowledgeBasesClient.php b/Dialogflow/src/V2/KnowledgeBasesClient.php index 420bc0f86fa7..1a2e66b61337 100644 --- a/Dialogflow/src/V2/KnowledgeBasesClient.php +++ b/Dialogflow/src/V2/KnowledgeBasesClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/knowledge_base.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/knowledge_base.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/ListDocumentsRequest.php b/Dialogflow/src/V2/ListDocumentsRequest.php index 144ab4faac2d..5b50bbca260d 100644 --- a/Dialogflow/src/V2/ListDocumentsRequest.php +++ b/Dialogflow/src/V2/ListDocumentsRequest.php @@ -36,6 +36,26 @@ class ListDocumentsRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string page_token = 3; */ private $page_token = ''; + /** + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * Examples: + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * + * Generated from protobuf field string filter = 4; + */ + private $filter = ''; /** * Constructor. @@ -52,6 +72,22 @@ class ListDocumentsRequest extends \Google\Protobuf\Internal\Message * default 10 and at most 100. * @type string $page_token * The next_page_token value returned from a previous list request. + * @type string $filter + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * Examples: + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * } */ public function __construct($data = NULL) { @@ -143,5 +179,59 @@ public function setPageToken($var) return $this; } + /** + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * Examples: + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression used to filter documents returned by the list method. + * The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * knowledge_types with has(:) operator + * * display_name with has(:) operator + * * state with equals(=) operator + * Examples: + * * "knowledge_types:FAQ" matches documents with FAQ knowledge type. + * * "display_name:customer" matches documents whose display name contains + * "customer". + * * "state=ACTIVE" matches documents with ACTIVE state. + * * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * + * 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/Dialogflow/src/V2/ListKnowledgeBasesRequest.php b/Dialogflow/src/V2/ListKnowledgeBasesRequest.php index 0ffc13517f0f..fb86e1a3ca67 100644 --- a/Dialogflow/src/V2/ListKnowledgeBasesRequest.php +++ b/Dialogflow/src/V2/ListKnowledgeBasesRequest.php @@ -35,6 +35,30 @@ class ListKnowledgeBasesRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string page_token = 3; */ private $page_token = ''; + /** + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * display_name with has(:) operator + * * language_code with equals(=) operator + * Examples: + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * + * Generated from protobuf field string filter = 4; + */ + private $filter = ''; /** * Constructor. @@ -50,6 +74,26 @@ class ListKnowledgeBasesRequest extends \Google\Protobuf\Internal\Message * default 10 and at most 100. * @type string $page_token * The next_page_token value returned from a previous list request. + * @type string $filter + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * display_name with has(:) operator + * * language_code with equals(=) operator + * Examples: + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). * } */ public function __construct($data = NULL) { @@ -139,5 +183,67 @@ public function setPageToken($var) return $this; } + /** + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * display_name with has(:) operator + * * language_code with equals(=) operator + * Examples: + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter expression used to filter knowledge bases returned by the list + * method. The expression has the following syntax: + * [AND ] ... + * The following fields and operators are supported: + * * display_name with has(:) operator + * * language_code with equals(=) operator + * Examples: + * * 'language_code=en-us' matches knowledge bases with en-us language code. + * * 'display_name:articles' matches knowledge bases whose display name + * contains "articles". + * * 'display_name:"Best Articles"' matches knowledge bases whose display + * name contains "Best Articles". + * * 'language_code=en-gb AND display_name=articles' matches all knowledge + * bases whose display name contains "articles" and whose language code is + * "en-gb". + * Note: An empty filter string (i.e. "") is a no-op and will result in no + * filtering. + * For more information about filtering, see + * [API Filtering](https://aip.dev/160). + * + * 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/Dialogflow/src/V2/NotificationConfig/MessageFormat.php b/Dialogflow/src/V2/NotificationConfig/MessageFormat.php index 3abdd2d4b12f..fac3e1d43f9f 100644 --- a/Dialogflow/src/V2/NotificationConfig/MessageFormat.php +++ b/Dialogflow/src/V2/NotificationConfig/MessageFormat.php @@ -14,19 +14,19 @@ class MessageFormat { /** - * If it is unspeified, PROTO will be used. + * If it is unspecified, PROTO will be used. * * Generated from protobuf enum MESSAGE_FORMAT_UNSPECIFIED = 0; */ const MESSAGE_FORMAT_UNSPECIFIED = 0; /** - * Pubsub message will be serialized proto. + * Pub/Sub message will be serialized proto. * * Generated from protobuf enum PROTO = 1; */ const PROTO = 1; /** - * Pubsub message will be json. + * Pub/Sub message will be json. * * Generated from protobuf enum JSON = 2; */ diff --git a/Dialogflow/src/V2/Participant.php b/Dialogflow/src/V2/Participant.php index b879d17caeb3..af346f725f8d 100644 --- a/Dialogflow/src/V2/Participant.php +++ b/Dialogflow/src/V2/Participant.php @@ -38,6 +38,27 @@ class Participant extends \Google\Protobuf\Internal\Message * Generated from protobuf field string sip_recording_media_label = 6 [(.google.api.field_behavior) = OPTIONAL]; */ private $sip_recording_media_label = ''; + /** + * Optional. Key-value filters on the metadata of documents returned by article + * suggestion. If specified, article suggestion only returns suggested + * documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + * values for a metadata key should be concatenated by comma. For example, + * filters to match all documents that have 'US' or 'CA' in their market + * metadata values and 'agent' in their user metadata values will be + * ``` + * documents_metadata_filters { + * key: "market" + * value: "US,CA" + * } + * documents_metadata_filters { + * key: "user" + * value: "agent" + * } + * ``` + * + * Generated from protobuf field map documents_metadata_filters = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $documents_metadata_filters; /** * Constructor. @@ -56,6 +77,23 @@ class Participant extends \Google\Protobuf\Internal\Message * Optional. Label applied to streams representing this participant in SIPREC * XML metadata and SDP. This is used to assign transcriptions from that * media stream to this participant. This field can be updated. + * @type array|\Google\Protobuf\Internal\MapField $documents_metadata_filters + * Optional. Key-value filters on the metadata of documents returned by article + * suggestion. If specified, article suggestion only returns suggested + * documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + * values for a metadata key should be concatenated by comma. For example, + * filters to match all documents that have 'US' or 'CA' in their market + * metadata values and 'agent' in their user metadata values will be + * ``` + * documents_metadata_filters { + * key: "market" + * value: "US,CA" + * } + * documents_metadata_filters { + * key: "user" + * value: "agent" + * } + * ``` * } */ public function __construct($data = NULL) { @@ -151,5 +189,61 @@ public function setSipRecordingMediaLabel($var) return $this; } + /** + * Optional. Key-value filters on the metadata of documents returned by article + * suggestion. If specified, article suggestion only returns suggested + * documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + * values for a metadata key should be concatenated by comma. For example, + * filters to match all documents that have 'US' or 'CA' in their market + * metadata values and 'agent' in their user metadata values will be + * ``` + * documents_metadata_filters { + * key: "market" + * value: "US,CA" + * } + * documents_metadata_filters { + * key: "user" + * value: "agent" + * } + * ``` + * + * Generated from protobuf field map documents_metadata_filters = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getDocumentsMetadataFilters() + { + return $this->documents_metadata_filters; + } + + /** + * Optional. Key-value filters on the metadata of documents returned by article + * suggestion. If specified, article suggestion only returns suggested + * documents that match all filters in their [Document.metadata][google.cloud.dialogflow.v2.Document.metadata]. Multiple + * values for a metadata key should be concatenated by comma. For example, + * filters to match all documents that have 'US' or 'CA' in their market + * metadata values and 'agent' in their user metadata values will be + * ``` + * documents_metadata_filters { + * key: "market" + * value: "US,CA" + * } + * documents_metadata_filters { + * key: "user" + * value: "agent" + * } + * ``` + * + * Generated from protobuf field map documents_metadata_filters = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setDocumentsMetadataFilters($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->documents_metadata_filters = $arr; + + return $this; + } + } diff --git a/Dialogflow/src/V2/ParticipantsClient.php b/Dialogflow/src/V2/ParticipantsClient.php index a35197bc6df6..ee53f01424ed 100644 --- a/Dialogflow/src/V2/ParticipantsClient.php +++ b/Dialogflow/src/V2/ParticipantsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/participant.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/participant.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/ReloadDocumentRequest.php b/Dialogflow/src/V2/ReloadDocumentRequest.php index 22f4a0740645..8035682d69fa 100644 --- a/Dialogflow/src/V2/ReloadDocumentRequest.php +++ b/Dialogflow/src/V2/ReloadDocumentRequest.php @@ -23,6 +23,20 @@ class ReloadDocumentRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ private $name = ''; + /** + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * + * Generated from protobuf field bool import_gcs_custom_metadata = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $import_gcs_custom_metadata = false; + /** + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. + * + * Generated from protobuf field bool smart_messaging_partial_update = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $smart_messaging_partial_update = false; protected $source; /** @@ -40,6 +54,12 @@ class ReloadDocumentRequest extends \Google\Protobuf\Internal\Message * only gcs uri is supported. * For documents stored in Google Cloud Storage, these URIs must have * the form `gs:///`. + * @type bool $import_gcs_custom_metadata + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * @type bool $smart_messaging_partial_update + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. * } */ public function __construct($data = NULL) { @@ -114,6 +134,62 @@ public function setContentUri($var) return $this; } + /** + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * + * Generated from protobuf field bool import_gcs_custom_metadata = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getImportGcsCustomMetadata() + { + return $this->import_gcs_custom_metadata; + } + + /** + * Optional. Whether to import custom metadata from Google Cloud Storage. + * Only valid when the document source is Google Cloud Storage URI. + * + * Generated from protobuf field bool import_gcs_custom_metadata = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setImportGcsCustomMetadata($var) + { + GPBUtil::checkBool($var); + $this->import_gcs_custom_metadata = $var; + + return $this; + } + + /** + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. + * + * Generated from protobuf field bool smart_messaging_partial_update = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getSmartMessagingPartialUpdate() + { + return $this->smart_messaging_partial_update; + } + + /** + * Optional. When enabled, the reload request is to apply partial update to the smart + * messaging allowlist. + * + * Generated from protobuf field bool smart_messaging_partial_update = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setSmartMessagingPartialUpdate($var) + { + GPBUtil::checkBool($var); + $this->smart_messaging_partial_update = $var; + + return $this; + } + /** * @return string */ diff --git a/Dialogflow/src/V2/SessionEntityTypesClient.php b/Dialogflow/src/V2/SessionEntityTypesClient.php index 18cefba59680..d468964bf277 100644 --- a/Dialogflow/src/V2/SessionEntityTypesClient.php +++ b/Dialogflow/src/V2/SessionEntityTypesClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/session_entity_type.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/session_entity_type.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/SessionsClient.php b/Dialogflow/src/V2/SessionsClient.php index 89156aece945..f7ffd86fde5a 100644 --- a/Dialogflow/src/V2/SessionsClient.php +++ b/Dialogflow/src/V2/SessionsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/session.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/session.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/SpeechToTextConfig.php b/Dialogflow/src/V2/SpeechToTextConfig.php index c0cc2a837f75..95ce94b06724 100644 --- a/Dialogflow/src/V2/SpeechToTextConfig.php +++ b/Dialogflow/src/V2/SpeechToTextConfig.php @@ -16,12 +16,15 @@ class SpeechToTextConfig extends \Google\Protobuf\Internal\Message { /** - * Optional. The speech model used in speech to text. + * The speech model used in speech to text. * `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as * `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest] and * [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest] request. + * If enhanced model variant is specified and an enhanced + * version of the specified model for the language does not exist, then it + * would emit an error. * - * Generated from protobuf field .google.cloud.dialogflow.v2.SpeechModelVariant speech_model_variant = 1 [(.google.api.field_behavior) = OPTIONAL]; + * Generated from protobuf field .google.cloud.dialogflow.v2.SpeechModelVariant speech_model_variant = 1; */ private $speech_model_variant = 0; @@ -32,10 +35,13 @@ class SpeechToTextConfig extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type int $speech_model_variant - * Optional. The speech model used in speech to text. + * The speech model used in speech to text. * `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as * `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest] and * [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest] request. + * If enhanced model variant is specified and an enhanced + * version of the specified model for the language does not exist, then it + * would emit an error. * } */ public function __construct($data = NULL) { @@ -44,12 +50,15 @@ public function __construct($data = NULL) { } /** - * Optional. The speech model used in speech to text. + * The speech model used in speech to text. * `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as * `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest] and * [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest] request. + * If enhanced model variant is specified and an enhanced + * version of the specified model for the language does not exist, then it + * would emit an error. * - * Generated from protobuf field .google.cloud.dialogflow.v2.SpeechModelVariant speech_model_variant = 1 [(.google.api.field_behavior) = OPTIONAL]; + * Generated from protobuf field .google.cloud.dialogflow.v2.SpeechModelVariant speech_model_variant = 1; * @return int */ public function getSpeechModelVariant() @@ -58,12 +67,15 @@ public function getSpeechModelVariant() } /** - * Optional. The speech model used in speech to text. + * The speech model used in speech to text. * `SPEECH_MODEL_VARIANT_UNSPECIFIED`, `USE_BEST_AVAILABLE` will be treated as * `USE_ENHANCED`. It can be overridden in [AnalyzeContentRequest][google.cloud.dialogflow.v2.AnalyzeContentRequest] and * [StreamingAnalyzeContentRequest][google.cloud.dialogflow.v2.StreamingAnalyzeContentRequest] request. + * If enhanced model variant is specified and an enhanced + * version of the specified model for the language does not exist, then it + * would emit an error. * - * Generated from protobuf field .google.cloud.dialogflow.v2.SpeechModelVariant speech_model_variant = 1 [(.google.api.field_behavior) = OPTIONAL]; + * Generated from protobuf field .google.cloud.dialogflow.v2.SpeechModelVariant speech_model_variant = 1; * @param int $var * @return $this */ diff --git a/Dialogflow/src/V2/StreamingDetectIntentResponse.php b/Dialogflow/src/V2/StreamingDetectIntentResponse.php index 119979e2d85f..5d1ff0025b27 100644 --- a/Dialogflow/src/V2/StreamingDetectIntentResponse.php +++ b/Dialogflow/src/V2/StreamingDetectIntentResponse.php @@ -12,10 +12,11 @@ * The top-level message returned from the * `StreamingDetectIntent` method. * Multiple response messages can be returned in order: - * 1. If the input was set to streaming audio, the first one or more messages - * contain `recognition_result`. Each `recognition_result` represents a more - * complete transcript of what the user said. The last `recognition_result` - * has `is_final` set to `true`. + * 1. If the `StreamingDetectIntentRequest.input_audio` field was + * set, the `recognition_result` field is populated for one + * or more messages. + * See the [StreamingRecognitionResult][google.cloud.dialogflow.v2.StreamingRecognitionResult] message for details + * about the result message sequence. * 2. The next message contains `response_id`, `query_result` * and optionally `webhook_status` if a WebHook was called. * diff --git a/Dialogflow/src/V2/StreamingRecognitionResult.php b/Dialogflow/src/V2/StreamingRecognitionResult.php index afafb39dd9fe..f3c096aa04dd 100644 --- a/Dialogflow/src/V2/StreamingRecognitionResult.php +++ b/Dialogflow/src/V2/StreamingRecognitionResult.php @@ -12,23 +12,34 @@ * Contains a speech recognition result corresponding to a portion of the audio * that is currently being processed or an indication that this is the end * of the single requested utterance. - * Example: - * 1. transcript: "tube" - * 2. transcript: "to be a" - * 3. transcript: "to be" - * 4. transcript: "to be or not to be" - * is_final: true - * 5. transcript: " that's" - * 6. transcript: " that is" - * 7. message_type: `END_OF_SINGLE_UTTERANCE` - * 8. transcript: " that is the question" - * is_final: true - * Only two of the responses contain final results (#4 and #8 indicated by - * `is_final: true`). Concatenating these generates the full transcript: "to be - * or not to be that is the question". - * In each response we populate: - * * for `TRANSCRIPT`: `transcript` and possibly `is_final`. - * * for `END_OF_SINGLE_UTTERANCE`: only `message_type`. + * While end-user audio is being processed, Dialogflow sends a series of + * results. Each result may contain a `transcript` value. A transcript + * represents a portion of the utterance. While the recognizer is processing + * audio, transcript values may be interim values or finalized values. + * Once a transcript is finalized, the `is_final` value is set to true and + * processing continues for the next transcript. + * If `StreamingDetectIntentRequest.query_input.audio_config.single_utterance` + * was true, and the recognizer has completed processing audio, + * the `message_type` value is set to `END_OF_SINGLE_UTTERANCE and the + * following (last) result contains the last finalized transcript. + * The complete end-user utterance is determined by concatenating the + * finalized transcript values received for the series of results. + * In the following example, single utterance is enabled. In the case where + * single utterance is not enabled, result 7 would not occur. + * ``` + * Num | transcript | message_type | is_final + * --- | ----------------------- | ----------------------- | -------- + * 1 | "tube" | TRANSCRIPT | false + * 2 | "to be a" | TRANSCRIPT | false + * 3 | "to be" | TRANSCRIPT | false + * 4 | "to be or not to be" | TRANSCRIPT | true + * 5 | "that's" | TRANSCRIPT | false + * 6 | "that is | TRANSCRIPT | false + * 7 | unset | END_OF_SINGLE_UTTERANCE | unset + * 8 | " that is the question" | TRANSCRIPT | true + * ``` + * Concatenating the finalized transcripts with `is_final` set to true, + * the complete utterance becomes "to be or not to be that is the question". * * Generated from protobuf message google.cloud.dialogflow.v2.StreamingRecognitionResult */ diff --git a/Dialogflow/src/V2/SuggestArticlesRequest.php b/Dialogflow/src/V2/SuggestArticlesRequest.php index 6250035f397e..ced91a59c057 100644 --- a/Dialogflow/src/V2/SuggestArticlesRequest.php +++ b/Dialogflow/src/V2/SuggestArticlesRequest.php @@ -40,6 +40,12 @@ class SuggestArticlesRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field int32 context_size = 3; */ private $context_size = 0; + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 4; + */ + private $assist_query_params = null; /** * Constructor. @@ -60,6 +66,8 @@ class SuggestArticlesRequest extends \Google\Protobuf\Internal\Message * Max number of messages prior to and including * [latest_message][google.cloud.dialogflow.v2.SuggestArticlesRequest.latest_message] to use as context * when compiling the suggestion. By default 20 and at most 50. + * @type \Google\Cloud\Dialogflow\V2\AssistQueryParameters $assist_query_params + * Parameters for a human assist query. * } */ public function __construct($data = NULL) { @@ -159,5 +167,41 @@ public function setContextSize($var) return $this; } + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 4; + * @return \Google\Cloud\Dialogflow\V2\AssistQueryParameters|null + */ + public function getAssistQueryParams() + { + return $this->assist_query_params; + } + + public function hasAssistQueryParams() + { + return isset($this->assist_query_params); + } + + public function clearAssistQueryParams() + { + unset($this->assist_query_params); + } + + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 4; + * @param \Google\Cloud\Dialogflow\V2\AssistQueryParameters $var + * @return $this + */ + public function setAssistQueryParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\AssistQueryParameters::class); + $this->assist_query_params = $var; + + return $this; + } + } diff --git a/Dialogflow/src/V2/SuggestFaqAnswersRequest.php b/Dialogflow/src/V2/SuggestFaqAnswersRequest.php index f14714a5ac3c..f9fae3095e3b 100644 --- a/Dialogflow/src/V2/SuggestFaqAnswersRequest.php +++ b/Dialogflow/src/V2/SuggestFaqAnswersRequest.php @@ -40,6 +40,12 @@ class SuggestFaqAnswersRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field int32 context_size = 3; */ private $context_size = 0; + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 4; + */ + private $assist_query_params = null; /** * Constructor. @@ -60,6 +66,8 @@ class SuggestFaqAnswersRequest extends \Google\Protobuf\Internal\Message * Max number of messages prior to and including * [latest_message] to use as context when compiling the * suggestion. By default 20 and at most 50. + * @type \Google\Cloud\Dialogflow\V2\AssistQueryParameters $assist_query_params + * Parameters for a human assist query. * } */ public function __construct($data = NULL) { @@ -159,5 +167,41 @@ public function setContextSize($var) return $this; } + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 4; + * @return \Google\Cloud\Dialogflow\V2\AssistQueryParameters|null + */ + public function getAssistQueryParams() + { + return $this->assist_query_params; + } + + public function hasAssistQueryParams() + { + return isset($this->assist_query_params); + } + + public function clearAssistQueryParams() + { + unset($this->assist_query_params); + } + + /** + * Parameters for a human assist query. + * + * Generated from protobuf field .google.cloud.dialogflow.v2.AssistQueryParameters assist_query_params = 4; + * @param \Google\Cloud\Dialogflow\V2\AssistQueryParameters $var + * @return $this + */ + public function setAssistQueryParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\V2\AssistQueryParameters::class); + $this->assist_query_params = $var; + + return $this; + } + } diff --git a/Dialogflow/src/V2/SuggestionFeature/Type.php b/Dialogflow/src/V2/SuggestionFeature/Type.php index f333b505633e..28d05a28bdb0 100644 --- a/Dialogflow/src/V2/SuggestionFeature/Type.php +++ b/Dialogflow/src/V2/SuggestionFeature/Type.php @@ -31,11 +31,18 @@ class Type * Generated from protobuf enum FAQ = 2; */ const FAQ = 2; + /** + * Run smart reply model. + * + * Generated from protobuf enum SMART_REPLY = 3; + */ + const SMART_REPLY = 3; private static $valueToName = [ self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', self::ARTICLE_SUGGESTION => 'ARTICLE_SUGGESTION', self::FAQ => 'FAQ', + self::SMART_REPLY => 'SMART_REPLY', ]; public static function name($value) diff --git a/Dialogflow/src/V2/VersionsClient.php b/Dialogflow/src/V2/VersionsClient.php index 20426b64c7de..f632f98b3e70 100644 --- a/Dialogflow/src/V2/VersionsClient.php +++ b/Dialogflow/src/V2/VersionsClient.php @@ -18,7 +18,7 @@ /* * GENERATED CODE WARNING * Generated by gapic-generator-php from the file - * https://github.com/google/googleapis/blob/master/google/cloud/dialogflow/v2/version.proto + * https://github.com/googleapis/googleapis/blob/master/google/cloud/dialogflow/v2/version.proto * Updates to the above are reflected here through a refresh process. */ diff --git a/Dialogflow/src/V2/gapic_metadata.json b/Dialogflow/src/V2/gapic_metadata.json index 55f2651e2a0b..09be03e0f4e9 100644 --- a/Dialogflow/src/V2/gapic_metadata.json +++ b/Dialogflow/src/V2/gapic_metadata.json @@ -400,6 +400,11 @@ "deleteDocument" ] }, + "ExportDocument": { + "methods": [ + "exportDocument" + ] + }, "GetDocument": { "methods": [ "getDocument" diff --git a/Dialogflow/src/V2/resources/documents_client_config.json b/Dialogflow/src/V2/resources/documents_client_config.json index 919e9c7194dd..ecaa9b68fc7e 100644 --- a/Dialogflow/src/V2/resources/documents_client_config.json +++ b/Dialogflow/src/V2/resources/documents_client_config.json @@ -38,6 +38,11 @@ "retry_codes_name": "retry_policy_1_codes", "retry_params_name": "retry_policy_1_params" }, + "ExportDocument": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, "GetDocument": { "timeout_millis": 60000, "retry_codes_name": "retry_policy_1_codes", diff --git a/Dialogflow/src/V2/resources/documents_descriptor_config.php b/Dialogflow/src/V2/resources/documents_descriptor_config.php index 6420dd76d6cb..2c8019202faf 100644 --- a/Dialogflow/src/V2/resources/documents_descriptor_config.php +++ b/Dialogflow/src/V2/resources/documents_descriptor_config.php @@ -23,6 +23,16 @@ 'totalPollTimeoutMillis' => '300000', ], ], + 'ExportDocument' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Dialogflow\V2\Document', + 'metadataReturnType' => '\Google\Cloud\Dialogflow\V2\KnowledgeOperationMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + ], 'ReloadDocument' => [ 'longRunning' => [ 'operationReturnType' => '\Google\Cloud\Dialogflow\V2\Document', diff --git a/Dialogflow/src/V2/resources/documents_rest_client_config.php b/Dialogflow/src/V2/resources/documents_rest_client_config.php index 3335911faad4..e1b369da3ab4 100644 --- a/Dialogflow/src/V2/resources/documents_rest_client_config.php +++ b/Dialogflow/src/V2/resources/documents_rest_client_config.php @@ -48,6 +48,25 @@ ], ], ], + 'ExportDocument' => [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/knowledgeBases/*/documents/*}:export', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v2/{name=projects/*/locations/*/knowledgeBases/*/documents/*}:export', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetDocument' => [ 'method' => 'get', 'uriTemplate' => '/v2/{name=projects/*/knowledgeBases/*/documents/*}', diff --git a/Dialogflow/tests/Unit/V2/ConversationProfilesClientTest.php b/Dialogflow/tests/Unit/V2/ConversationProfilesClientTest.php index e015986956da..62d493cca88a 100644 --- a/Dialogflow/tests/Unit/V2/ConversationProfilesClientTest.php +++ b/Dialogflow/tests/Unit/V2/ConversationProfilesClientTest.php @@ -84,10 +84,14 @@ public function createConversationProfileTest() $name = 'name3373707'; $displayName = 'displayName1615086568'; $languageCode = 'languageCode-412800396'; + $timeZone = 'timeZone36848094'; + $securitySettings = 'securitySettings-595091902'; $expectedResponse = new ConversationProfile(); $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setLanguageCode($languageCode); + $expectedResponse->setTimeZone($timeZone); + $expectedResponse->setSecuritySettings($securitySettings); $transport->addResponse($expectedResponse); // Mock request $formattedParent = $client->projectName('[PROJECT]'); @@ -221,10 +225,14 @@ public function getConversationProfileTest() $name2 = 'name2-1052831874'; $displayName = 'displayName1615086568'; $languageCode = 'languageCode-412800396'; + $timeZone = 'timeZone36848094'; + $securitySettings = 'securitySettings-595091902'; $expectedResponse = new ConversationProfile(); $expectedResponse->setName($name2); $expectedResponse->setDisplayName($displayName); $expectedResponse->setLanguageCode($languageCode); + $expectedResponse->setTimeZone($timeZone); + $expectedResponse->setSecuritySettings($securitySettings); $transport->addResponse($expectedResponse); // Mock request $formattedName = $client->conversationProfileName('[PROJECT]', '[CONVERSATION_PROFILE]'); @@ -361,10 +369,14 @@ public function updateConversationProfileTest() $name = 'name3373707'; $displayName = 'displayName1615086568'; $languageCode = 'languageCode-412800396'; + $timeZone = 'timeZone36848094'; + $securitySettings = 'securitySettings-595091902'; $expectedResponse = new ConversationProfile(); $expectedResponse->setName($name); $expectedResponse->setDisplayName($displayName); $expectedResponse->setLanguageCode($languageCode); + $expectedResponse->setTimeZone($timeZone); + $expectedResponse->setSecuritySettings($securitySettings); $transport->addResponse($expectedResponse); // Mock request $conversationProfile = new ConversationProfile(); diff --git a/Dialogflow/tests/Unit/V2/DocumentsClientTest.php b/Dialogflow/tests/Unit/V2/DocumentsClientTest.php index f06f2ae7e6a7..c8fe9b1ed910 100644 --- a/Dialogflow/tests/Unit/V2/DocumentsClientTest.php +++ b/Dialogflow/tests/Unit/V2/DocumentsClientTest.php @@ -342,6 +342,137 @@ public function deleteDocumentExceptionTest() $this->assertTrue($operationsTransport->isExhausted()); } + /** + * @test + */ + public function exportDocumentTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/exportDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $mimeType = 'mimeType-196041627'; + $contentUri = 'contentUri-388807514'; + $enableAutoReload = false; + $expectedResponse = new Document(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setMimeType($mimeType); + $expectedResponse->setContentUri($contentUri); + $expectedResponse->setEnableAutoReload($enableAutoReload); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/exportDocumentTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $client->documentName('[PROJECT]', '[KNOWLEDGE_BASE]', '[DOCUMENT]'); + $response = $client->exportDocument($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.v2.Documents/ExportDocument', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportDocumentTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** + * @test + */ + public function exportDocumentExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'serviceAddress' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $client = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/exportDocumentTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode([ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], JSON_PRETTY_PRINT); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $client->documentName('[PROJECT]', '[KNOWLEDGE_BASE]', '[DOCUMENT]'); + $response = $client->exportDocument($formattedName); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportDocumentTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + /** * @test */