diff --git a/DialogflowCx/metadata/V3/Agent.php b/DialogflowCx/metadata/V3/Agent.php index 9c0cb9ac7df8..724675fd9bce 100644 Binary files a/DialogflowCx/metadata/V3/Agent.php and b/DialogflowCx/metadata/V3/Agent.php differ diff --git a/DialogflowCx/metadata/V3/CodeBlock.php b/DialogflowCx/metadata/V3/CodeBlock.php new file mode 100644 index 000000000000..ba01efcc8462 --- /dev/null +++ b/DialogflowCx/metadata/V3/CodeBlock.php @@ -0,0 +1,30 @@ +internalAddGeneratedFile( + ' +‡ +.google/cloud/dialogflow/cx/v3/code_block.protogoogle.cloud.dialogflow.cx.v3" + CodeBlock +code ( BàAB +!com.google.cloud.dialogflow.cx.v3BCodeBlockProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb¢DFªGoogle.Cloud.Dialogflow.Cx.V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/DataStoreConnection.php b/DialogflowCx/metadata/V3/DataStoreConnection.php index 7eb8a0a721a5..fbc544844bdc 100644 Binary files a/DialogflowCx/metadata/V3/DataStoreConnection.php and b/DialogflowCx/metadata/V3/DataStoreConnection.php differ diff --git a/DialogflowCx/metadata/V3/Example.php b/DialogflowCx/metadata/V3/Example.php new file mode 100644 index 000000000000..e22ec9bd17ca --- /dev/null +++ b/DialogflowCx/metadata/V3/Example.php @@ -0,0 +1,77 @@ +internalAddGeneratedFile( + ' +± ++google/cloud/dialogflow/cx/v3/example.protogoogle.cloud.dialogflow.cx.v3google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto)google/cloud/dialogflow/cx/v3/trace.protogoogle/protobuf/empty.proto google/protobuf/field_mask.protogoogle/protobuf/timestamp.proto" +CreateExampleRequest9 +parent ( B)àAúA#!dialogflow.googleapis.com/Example< +example ( 2&.google.cloud.dialogflow.cx.v3.ExampleBàA"O +DeleteExampleRequest7 +name ( B)àAúA# +!dialogflow.googleapis.com/Example" +ListExamplesRequest9 +parent ( B)àAúA#!dialogflow.googleapis.com/Example + page_size (BàA + +page_token ( BàA + language_code ( BàA"i +ListExamplesResponse8 +examples ( 2&.google.cloud.dialogflow.cx.v3.Example +next_page_token ( "L +GetExampleRequest7 +name ( B)àAúA# +!dialogflow.googleapis.com/Example"Š +UpdateExampleRequest< +example ( 2&.google.cloud.dialogflow.cx.v3.ExampleBàA4 + update_mask ( 2.google.protobuf.FieldMaskBàA"­ +Example +name ( I +playbook_input ( 2,.google.cloud.dialogflow.cx.v3.PlaybookInputBàAK +playbook_output ( 2-.google.cloud.dialogflow.cx.v3.PlaybookOutputBàA; +actions ( 2%.google.cloud.dialogflow.cx.v3.ActionBàA + display_name ( BàA + description ( BàA + token_count (BàA4 + create_time + ( 2.google.protobuf.TimestampBàA4 + update_time ( 2.google.protobuf.TimestampBàAK +conversation_state (2*.google.cloud.dialogflow.cx.v3.OutputStateBàA + language_code ( BàA:šêA– +!dialogflow.googleapis.com/Example^projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/examples/{example}*examples2example2ó +ExamplesÑ + CreateExample3.google.cloud.dialogflow.cx.v3.CreateExampleRequest&.google.cloud.dialogflow.cx.v3.Example"cÚAparent,example‚Óä“L"A/v3/{parent=projects/*/locations/*/agents/*/playbooks/*}/examples:example® + DeleteExample3.google.cloud.dialogflow.cx.v3.DeleteExampleRequest.google.protobuf.Empty"PÚAname‚Óä“C*A/v3/{name=projects/*/locations/*/agents/*/playbooks/*/examples/*}Ë + ListExamples2.google.cloud.dialogflow.cx.v3.ListExamplesRequest3.google.cloud.dialogflow.cx.v3.ListExamplesResponse"RÚAparent‚Óä“CA/v3/{parent=projects/*/locations/*/agents/*/playbooks/*}/examples¸ + +GetExample0.google.cloud.dialogflow.cx.v3.GetExampleRequest&.google.cloud.dialogflow.cx.v3.Example"PÚAname‚Óä“CA/v3/{name=projects/*/locations/*/agents/*/playbooks/*/examples/*}Þ + UpdateExample3.google.cloud.dialogflow.cx.v3.UpdateExampleRequest&.google.cloud.dialogflow.cx.v3.Example"pÚAexample,update_mask‚Óä“T2I/v3/{example.name=projects/*/locations/*/agents/*/playbooks/*/examples/*}:examplexÊAdialogflow.googleapis.comÒAYhttps://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/dialogflowB‹ +!com.google.cloud.dialogflow.cx.v3B ExampleProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb¢DFªGoogle.Cloud.Dialogflow.Cx.V3bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DialogflowCx/metadata/V3/Flow.php b/DialogflowCx/metadata/V3/Flow.php index 5ad10bc49de4..ac2c05214442 100644 Binary files a/DialogflowCx/metadata/V3/Flow.php and b/DialogflowCx/metadata/V3/Flow.php differ diff --git a/DialogflowCx/metadata/V3/GenerativeSettings.php b/DialogflowCx/metadata/V3/GenerativeSettings.php index 4c1c57bb2fbf..26db1a820696 100644 --- a/DialogflowCx/metadata/V3/GenerativeSettings.php +++ b/DialogflowCx/metadata/V3/GenerativeSettings.php @@ -18,14 +18,16 @@ public static function initOnce() { \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SafetySettings::initOnce(); $pool->internalAddGeneratedFile( ' -Ð -7google/cloud/dialogflow/cx/v3/generative_settings.protogoogle.cloud.dialogflow.cx.v33google/cloud/dialogflow/cx/v3/safety_settings.proto"û +Õ + +7google/cloud/dialogflow/cx/v3/generative_settings.protogoogle.cloud.dialogflow.cx.v33google/cloud/dialogflow/cx/v3/safety_settings.proto"È GenerativeSettings name ( ] fallback_settings ( 2B.google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettingsQ generative_safety_settings ( 2-.google.cloud.dialogflow.cx.v3.SafetySettingsr knowledge_connector_settings ( 2L.google.cloud.dialogflow.cx.v3.GenerativeSettings.KnowledgeConnectorSettings - language_code ( å + language_code ( K +llm_model_settings ( 2/.google.cloud.dialogflow.cx.v3.LlmModelSettingså FallbackSettings selected_prompt ( k prompt_templates ( 2Q.google.cloud.dialogflow.cx.v3.GenerativeSettings.FallbackSettings.PromptTemplateK @@ -40,7 +42,10 @@ public static function initOnce() { business_description (  agent_scope ( # disable_data_store_fallback (:êA~ -1dialogflow.googleapis.com/AgentGenerativeSettingsIprojects/{project}/locations/{location}/agents/{agent}/generativeSettingsBº +1dialogflow.googleapis.com/AgentGenerativeSettingsIprojects/{project}/locations/{location}/agents/{agent}/generativeSettings"6 +LlmModelSettings +model (  + prompt_text ( Bº !com.google.cloud.dialogflow.cx.v3BGenerativeSettingsProtoPZ1cloud.google.com/go/dialogflow/cx/apiv3/cxpb;cxpb¢DFªGoogle.Cloud.Dialogflow.Cx.V3ê!Google::Cloud::Dialogflow::CX::V3bproto3' , true); diff --git a/DialogflowCx/metadata/V3/Generator.php b/DialogflowCx/metadata/V3/Generator.php index aab6a4c9bd65..694ef91bbf39 100644 Binary files a/DialogflowCx/metadata/V3/Generator.php and b/DialogflowCx/metadata/V3/Generator.php differ diff --git a/DialogflowCx/metadata/V3/Page.php b/DialogflowCx/metadata/V3/Page.php index 0b9d8a96b0fe..79d044246d23 100644 Binary files a/DialogflowCx/metadata/V3/Page.php and b/DialogflowCx/metadata/V3/Page.php differ diff --git a/DialogflowCx/metadata/V3/ParameterDefinition.php b/DialogflowCx/metadata/V3/ParameterDefinition.php new file mode 100644 index 000000000000..9fe147cdc56c Binary files /dev/null and b/DialogflowCx/metadata/V3/ParameterDefinition.php differ diff --git a/DialogflowCx/metadata/V3/Playbook.php b/DialogflowCx/metadata/V3/Playbook.php new file mode 100644 index 000000000000..6b5e57f83e02 Binary files /dev/null and b/DialogflowCx/metadata/V3/Playbook.php differ diff --git a/DialogflowCx/metadata/V3/ResponseMessage.php b/DialogflowCx/metadata/V3/ResponseMessage.php index 16d6e85a182b..3043afcba424 100644 Binary files a/DialogflowCx/metadata/V3/ResponseMessage.php and b/DialogflowCx/metadata/V3/ResponseMessage.php differ diff --git a/DialogflowCx/metadata/V3/SafetySettings.php b/DialogflowCx/metadata/V3/SafetySettings.php index 1a14fd5d3ef0..f18a27eda7a7 100644 Binary files a/DialogflowCx/metadata/V3/SafetySettings.php and b/DialogflowCx/metadata/V3/SafetySettings.php differ diff --git a/DialogflowCx/metadata/V3/Session.php b/DialogflowCx/metadata/V3/Session.php index 0d904253c5c6..5aea7c5a1873 100644 Binary files a/DialogflowCx/metadata/V3/Session.php and b/DialogflowCx/metadata/V3/Session.php differ diff --git a/DialogflowCx/metadata/V3/Tool.php b/DialogflowCx/metadata/V3/Tool.php new file mode 100644 index 000000000000..dcab6b088087 Binary files /dev/null and b/DialogflowCx/metadata/V3/Tool.php differ diff --git a/DialogflowCx/metadata/V3/ToolCall.php b/DialogflowCx/metadata/V3/ToolCall.php new file mode 100644 index 000000000000..830361f3f13c Binary files /dev/null and b/DialogflowCx/metadata/V3/ToolCall.php differ diff --git a/DialogflowCx/metadata/V3/Trace.php b/DialogflowCx/metadata/V3/Trace.php new file mode 100644 index 000000000000..7c0f645463e0 Binary files /dev/null and b/DialogflowCx/metadata/V3/Trace.php differ diff --git a/DialogflowCx/metadata/V3/Webhook.php b/DialogflowCx/metadata/V3/Webhook.php index 74e4fb902c93..61db3be66db3 100644 Binary files a/DialogflowCx/metadata/V3/Webhook.php and b/DialogflowCx/metadata/V3/Webhook.php differ diff --git a/DialogflowCx/samples/V3/ExamplesClient/create_example.php b/DialogflowCx/samples/V3/ExamplesClient/create_example.php new file mode 100644 index 000000000000..d2d2b6349918 --- /dev/null +++ b/DialogflowCx/samples/V3/ExamplesClient/create_example.php @@ -0,0 +1,88 @@ +/locations//agents//playbooks/`. Please see + * {@see ExamplesClient::playbookName()} for help formatting this field. + * @param string $exampleDisplayName The display name of the example. + * @param int $exampleConversationState Example's output state. + */ +function create_example_sample( + string $formattedParent, + string $exampleDisplayName, + int $exampleConversationState +): void { + // Create a client. + $examplesClient = new ExamplesClient(); + + // Prepare the request message. + $exampleActions = [new Action()]; + $example = (new Example()) + ->setActions($exampleActions) + ->setDisplayName($exampleDisplayName) + ->setConversationState($exampleConversationState); + $request = (new CreateExampleRequest()) + ->setParent($formattedParent) + ->setExample($example); + + // Call the API and handle any network failures. + try { + /** @var Example $response */ + $response = $examplesClient->createExample($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ExamplesClient::playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $exampleDisplayName = '[DISPLAY_NAME]'; + $exampleConversationState = OutputState::OUTPUT_STATE_UNSPECIFIED; + + create_example_sample($formattedParent, $exampleDisplayName, $exampleConversationState); +} +// [END dialogflow_v3_generated_Examples_CreateExample_sync] diff --git a/DialogflowCx/samples/V3/ExamplesClient/delete_example.php b/DialogflowCx/samples/V3/ExamplesClient/delete_example.php new file mode 100644 index 000000000000..6ecccfd82d22 --- /dev/null +++ b/DialogflowCx/samples/V3/ExamplesClient/delete_example.php @@ -0,0 +1,77 @@ +/locations//agents//playbooks//examples/`. Please see + * {@see ExamplesClient::exampleName()} for help formatting this field. + */ +function delete_example_sample(string $formattedName): void +{ + // Create a client. + $examplesClient = new ExamplesClient(); + + // Prepare the request message. + $request = (new DeleteExampleRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $examplesClient->deleteExample($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExamplesClient::exampleName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[EXAMPLE]' + ); + + delete_example_sample($formattedName); +} +// [END dialogflow_v3_generated_Examples_DeleteExample_sync] diff --git a/DialogflowCx/samples/V3/ExamplesClient/get_example.php b/DialogflowCx/samples/V3/ExamplesClient/get_example.php new file mode 100644 index 000000000000..f142433419a5 --- /dev/null +++ b/DialogflowCx/samples/V3/ExamplesClient/get_example.php @@ -0,0 +1,79 @@ +/locations//agents//playbooks//examples/`. Please see + * {@see ExamplesClient::exampleName()} for help formatting this field. + */ +function get_example_sample(string $formattedName): void +{ + // Create a client. + $examplesClient = new ExamplesClient(); + + // Prepare the request message. + $request = (new GetExampleRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Example $response */ + $response = $examplesClient->getExample($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ExamplesClient::exampleName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[EXAMPLE]' + ); + + get_example_sample($formattedName); +} +// [END dialogflow_v3_generated_Examples_GetExample_sync] diff --git a/DialogflowCx/samples/V3/ExamplesClient/get_location.php b/DialogflowCx/samples/V3/ExamplesClient/get_location.php new file mode 100644 index 000000000000..3cab506b8c9d --- /dev/null +++ b/DialogflowCx/samples/V3/ExamplesClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Examples_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/ExamplesClient/list_examples.php b/DialogflowCx/samples/V3/ExamplesClient/list_examples.php new file mode 100644 index 000000000000..5ac6a24928fe --- /dev/null +++ b/DialogflowCx/samples/V3/ExamplesClient/list_examples.php @@ -0,0 +1,78 @@ +/locations//agents//playbooks/`. Please see + * {@see ExamplesClient::playbookName()} for help formatting this field. + */ +function list_examples_sample(string $formattedParent): void +{ + // Create a client. + $examplesClient = new ExamplesClient(); + + // Prepare the request message. + $request = (new ListExamplesRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $examplesClient->listExamples($request); + + /** @var Example $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ExamplesClient::playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + + list_examples_sample($formattedParent); +} +// [END dialogflow_v3_generated_Examples_ListExamples_sync] diff --git a/DialogflowCx/samples/V3/ExamplesClient/list_locations.php b/DialogflowCx/samples/V3/ExamplesClient/list_locations.php new file mode 100644 index 000000000000..b7c50bd25ac5 --- /dev/null +++ b/DialogflowCx/samples/V3/ExamplesClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Examples_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/ExamplesClient/update_example.php b/DialogflowCx/samples/V3/ExamplesClient/update_example.php new file mode 100644 index 000000000000..e8c250d6a3c9 --- /dev/null +++ b/DialogflowCx/samples/V3/ExamplesClient/update_example.php @@ -0,0 +1,79 @@ +setActions($exampleActions) + ->setDisplayName($exampleDisplayName) + ->setConversationState($exampleConversationState); + $request = (new UpdateExampleRequest()) + ->setExample($example); + + // Call the API and handle any network failures. + try { + /** @var Example $response */ + $response = $examplesClient->updateExample($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $exampleDisplayName = '[DISPLAY_NAME]'; + $exampleConversationState = OutputState::OUTPUT_STATE_UNSPECIFIED; + + update_example_sample($exampleDisplayName, $exampleConversationState); +} +// [END dialogflow_v3_generated_Examples_UpdateExample_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/create_playbook.php b/DialogflowCx/samples/V3/PlaybooksClient/create_playbook.php new file mode 100644 index 000000000000..8799bccbe51f --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/create_playbook.php @@ -0,0 +1,85 @@ +/locations//agents/`. Please see + * {@see PlaybooksClient::agentName()} for help formatting this field. + * @param string $playbookDisplayName The human-readable name of the playbook, unique within an agent. + * @param string $playbookGoal High level description of the goal the playbook intend to + * accomplish. A goal should be concise since it's visible to other playbooks + * that may reference this playbook. + */ +function create_playbook_sample( + string $formattedParent, + string $playbookDisplayName, + string $playbookGoal +): void { + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $playbook = (new Playbook()) + ->setDisplayName($playbookDisplayName) + ->setGoal($playbookGoal); + $request = (new CreatePlaybookRequest()) + ->setParent($formattedParent) + ->setPlaybook($playbook); + + // Call the API and handle any network failures. + try { + /** @var Playbook $response */ + $response = $playbooksClient->createPlaybook($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = PlaybooksClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $playbookDisplayName = '[DISPLAY_NAME]'; + $playbookGoal = '[GOAL]'; + + create_playbook_sample($formattedParent, $playbookDisplayName, $playbookGoal); +} +// [END dialogflow_v3_generated_Playbooks_CreatePlaybook_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/create_playbook_version.php b/DialogflowCx/samples/V3/PlaybooksClient/create_playbook_version.php new file mode 100644 index 000000000000..78d102e1ffb4 --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/create_playbook_version.php @@ -0,0 +1,80 @@ +/locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + */ +function create_playbook_version_sample(string $formattedParent): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $playbookVersion = new PlaybookVersion(); + $request = (new CreatePlaybookVersionRequest()) + ->setParent($formattedParent) + ->setPlaybookVersion($playbookVersion); + + // Call the API and handle any network failures. + try { + /** @var PlaybookVersion $response */ + $response = $playbooksClient->createPlaybookVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = PlaybooksClient::playbookName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]' + ); + + create_playbook_version_sample($formattedParent); +} +// [END dialogflow_v3_generated_Playbooks_CreatePlaybookVersion_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/delete_playbook.php b/DialogflowCx/samples/V3/PlaybooksClient/delete_playbook.php new file mode 100644 index 000000000000..2ad8a285eefb --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/delete_playbook.php @@ -0,0 +1,71 @@ +/locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + */ +function delete_playbook_sample(string $formattedName): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new DeletePlaybookRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $playbooksClient->deletePlaybook($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = PlaybooksClient::playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + + delete_playbook_sample($formattedName); +} +// [END dialogflow_v3_generated_Playbooks_DeletePlaybook_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/delete_playbook_version.php b/DialogflowCx/samples/V3/PlaybooksClient/delete_playbook_version.php new file mode 100644 index 000000000000..d8b1184b5426 --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/delete_playbook_version.php @@ -0,0 +1,77 @@ +/locations//agents//playbooks//versions/`. Please see + * {@see PlaybooksClient::playbookVersionName()} for help formatting this field. + */ +function delete_playbook_version_sample(string $formattedName): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new DeletePlaybookVersionRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $playbooksClient->deletePlaybookVersion($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = PlaybooksClient::playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + + delete_playbook_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Playbooks_DeletePlaybookVersion_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/export_playbook.php b/DialogflowCx/samples/V3/PlaybooksClient/export_playbook.php new file mode 100644 index 000000000000..638956a77856 --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/export_playbook.php @@ -0,0 +1,88 @@ +/locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + */ +function export_playbook_sample(string $formattedName): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new ExportPlaybookRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $playbooksClient->exportPlaybook($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ExportPlaybookResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = PlaybooksClient::playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + + export_playbook_sample($formattedName); +} +// [END dialogflow_v3_generated_Playbooks_ExportPlaybook_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/get_location.php b/DialogflowCx/samples/V3/PlaybooksClient/get_location.php new file mode 100644 index 000000000000..dfd820b27039 --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Playbooks_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/get_playbook.php b/DialogflowCx/samples/V3/PlaybooksClient/get_playbook.php new file mode 100644 index 000000000000..98a4ac716d63 --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/get_playbook.php @@ -0,0 +1,73 @@ +/locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + */ +function get_playbook_sample(string $formattedName): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new GetPlaybookRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Playbook $response */ + $response = $playbooksClient->getPlaybook($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = PlaybooksClient::playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + + get_playbook_sample($formattedName); +} +// [END dialogflow_v3_generated_Playbooks_GetPlaybook_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/get_playbook_version.php b/DialogflowCx/samples/V3/PlaybooksClient/get_playbook_version.php new file mode 100644 index 000000000000..b695b62feafb --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/get_playbook_version.php @@ -0,0 +1,79 @@ +/locations//agents//playbooks//versions/`. Please see + * {@see PlaybooksClient::playbookVersionName()} for help formatting this field. + */ +function get_playbook_version_sample(string $formattedName): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new GetPlaybookVersionRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var PlaybookVersion $response */ + $response = $playbooksClient->getPlaybookVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = PlaybooksClient::playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + + get_playbook_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Playbooks_GetPlaybookVersion_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/import_playbook.php b/DialogflowCx/samples/V3/PlaybooksClient/import_playbook.php new file mode 100644 index 000000000000..8e438508acec --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/import_playbook.php @@ -0,0 +1,84 @@ +/locations//agents/`. Please see + * {@see PlaybooksClient::agentName()} for help formatting this field. + */ +function import_playbook_sample(string $formattedParent): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new ImportPlaybookRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $playbooksClient->importPlaybook($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var ImportPlaybookResponse $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = PlaybooksClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + import_playbook_sample($formattedParent); +} +// [END dialogflow_v3_generated_Playbooks_ImportPlaybook_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/list_locations.php b/DialogflowCx/samples/V3/PlaybooksClient/list_locations.php new file mode 100644 index 000000000000..1be70edfefd1 --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Playbooks_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/list_playbook_versions.php b/DialogflowCx/samples/V3/PlaybooksClient/list_playbook_versions.php new file mode 100644 index 000000000000..fd661893a50a --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/list_playbook_versions.php @@ -0,0 +1,83 @@ +/locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + */ +function list_playbook_versions_sample(string $formattedParent): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new ListPlaybookVersionsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $playbooksClient->listPlaybookVersions($request); + + /** @var PlaybookVersion $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = PlaybooksClient::playbookName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]' + ); + + list_playbook_versions_sample($formattedParent); +} +// [END dialogflow_v3_generated_Playbooks_ListPlaybookVersions_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/list_playbooks.php b/DialogflowCx/samples/V3/PlaybooksClient/list_playbooks.php new file mode 100644 index 000000000000..c4052fbdd4b0 --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/list_playbooks.php @@ -0,0 +1,77 @@ +/locations//agents/`. Please see + * {@see PlaybooksClient::agentName()} for help formatting this field. + */ +function list_playbooks_sample(string $formattedParent): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new ListPlaybooksRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $playbooksClient->listPlaybooks($request); + + /** @var Playbook $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = PlaybooksClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_playbooks_sample($formattedParent); +} +// [END dialogflow_v3_generated_Playbooks_ListPlaybooks_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/restore_playbook_version.php b/DialogflowCx/samples/V3/PlaybooksClient/restore_playbook_version.php new file mode 100644 index 000000000000..76464933bf8e --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/restore_playbook_version.php @@ -0,0 +1,80 @@ +/locations//agents//playbooks//versions/`. Please see + * {@see PlaybooksClient::playbookVersionName()} for help formatting this field. + */ +function restore_playbook_version_sample(string $formattedName): void +{ + // Create a client. + $playbooksClient = new PlaybooksClient(); + + // Prepare the request message. + $request = (new RestorePlaybookVersionRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var RestorePlaybookVersionResponse $response */ + $response = $playbooksClient->restorePlaybookVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = PlaybooksClient::playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + + restore_playbook_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Playbooks_RestorePlaybookVersion_sync] diff --git a/DialogflowCx/samples/V3/PlaybooksClient/update_playbook.php b/DialogflowCx/samples/V3/PlaybooksClient/update_playbook.php new file mode 100644 index 000000000000..d404fb8608af --- /dev/null +++ b/DialogflowCx/samples/V3/PlaybooksClient/update_playbook.php @@ -0,0 +1,77 @@ +setDisplayName($playbookDisplayName) + ->setGoal($playbookGoal); + $request = (new UpdatePlaybookRequest()) + ->setPlaybook($playbook); + + // Call the API and handle any network failures. + try { + /** @var Playbook $response */ + $response = $playbooksClient->updatePlaybook($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $playbookDisplayName = '[DISPLAY_NAME]'; + $playbookGoal = '[GOAL]'; + + update_playbook_sample($playbookDisplayName, $playbookGoal); +} +// [END dialogflow_v3_generated_Playbooks_UpdatePlaybook_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/create_tool.php b/DialogflowCx/samples/V3/ToolsClient/create_tool.php new file mode 100644 index 000000000000..e680b6661d19 --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/create_tool.php @@ -0,0 +1,84 @@ +/locations//agents/`. Please see + * {@see ToolsClient::agentName()} for help formatting this field. + * @param string $toolDisplayName The human-readable name of the Tool, unique within an agent. + * @param string $toolDescription High level description of the Tool and its usage. + */ +function create_tool_sample( + string $formattedParent, + string $toolDisplayName, + string $toolDescription +): void { + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $tool = (new Tool()) + ->setDisplayName($toolDisplayName) + ->setDescription($toolDescription); + $request = (new CreateToolRequest()) + ->setParent($formattedParent) + ->setTool($tool); + + // Call the API and handle any network failures. + try { + /** @var Tool $response */ + $response = $toolsClient->createTool($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ToolsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $toolDisplayName = '[DISPLAY_NAME]'; + $toolDescription = '[DESCRIPTION]'; + + create_tool_sample($formattedParent, $toolDisplayName, $toolDescription); +} +// [END dialogflow_v3_generated_Tools_CreateTool_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/create_tool_version.php b/DialogflowCx/samples/V3/ToolsClient/create_tool_version.php new file mode 100644 index 000000000000..d7ead7c57bee --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/create_tool_version.php @@ -0,0 +1,97 @@ +/locations//agents//tools/`. Please see + * {@see ToolsClient::toolName()} for help formatting this field. + * @param string $toolVersionDisplayName The display name of the tool version. + * @param string $toolVersionToolDisplayName The human-readable name of the Tool, unique within an agent. + * @param string $toolVersionToolDescription High level description of the Tool and its usage. + */ +function create_tool_version_sample( + string $formattedParent, + string $toolVersionDisplayName, + string $toolVersionToolDisplayName, + string $toolVersionToolDescription +): void { + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $toolVersionTool = (new Tool()) + ->setDisplayName($toolVersionToolDisplayName) + ->setDescription($toolVersionToolDescription); + $toolVersion = (new ToolVersion()) + ->setDisplayName($toolVersionDisplayName) + ->setTool($toolVersionTool); + $request = (new CreateToolVersionRequest()) + ->setParent($formattedParent) + ->setToolVersion($toolVersion); + + // Call the API and handle any network failures. + try { + /** @var ToolVersion $response */ + $response = $toolsClient->createToolVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ToolsClient::toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $toolVersionDisplayName = '[DISPLAY_NAME]'; + $toolVersionToolDisplayName = '[DISPLAY_NAME]'; + $toolVersionToolDescription = '[DESCRIPTION]'; + + create_tool_version_sample( + $formattedParent, + $toolVersionDisplayName, + $toolVersionToolDisplayName, + $toolVersionToolDescription + ); +} +// [END dialogflow_v3_generated_Tools_CreateToolVersion_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/delete_tool.php b/DialogflowCx/samples/V3/ToolsClient/delete_tool.php new file mode 100644 index 000000000000..332844c152f1 --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/delete_tool.php @@ -0,0 +1,71 @@ +/locations//agents//tools/`. Please see + * {@see ToolsClient::toolName()} for help formatting this field. + */ +function delete_tool_sample(string $formattedName): void +{ + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $request = (new DeleteToolRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $toolsClient->deleteTool($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ToolsClient::toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + + delete_tool_sample($formattedName); +} +// [END dialogflow_v3_generated_Tools_DeleteTool_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/delete_tool_version.php b/DialogflowCx/samples/V3/ToolsClient/delete_tool_version.php new file mode 100644 index 000000000000..e9042bddbcaf --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/delete_tool_version.php @@ -0,0 +1,78 @@ +/locations//agents//tools//versions/`. Please see + * {@see ToolsClient::toolVersionName()} for help formatting this field. + */ +function delete_tool_version_sample(string $formattedName): void +{ + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $request = (new DeleteToolVersionRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + $toolsClient->deleteToolVersion($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ToolsClient::toolVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[TOOL]', + '[VERSION]' + ); + + delete_tool_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Tools_DeleteToolVersion_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/get_location.php b/DialogflowCx/samples/V3/ToolsClient/get_location.php new file mode 100644 index 000000000000..e3ca0aa7531b --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/get_location.php @@ -0,0 +1,57 @@ +getLocation($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Tools_GetLocation_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/get_tool.php b/DialogflowCx/samples/V3/ToolsClient/get_tool.php new file mode 100644 index 000000000000..a253133717a1 --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/get_tool.php @@ -0,0 +1,73 @@ +/locations//agents//tools/`. Please see + * {@see ToolsClient::toolName()} for help formatting this field. + */ +function get_tool_sample(string $formattedName): void +{ + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $request = (new GetToolRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Tool $response */ + $response = $toolsClient->getTool($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ToolsClient::toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + + get_tool_sample($formattedName); +} +// [END dialogflow_v3_generated_Tools_GetTool_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/get_tool_version.php b/DialogflowCx/samples/V3/ToolsClient/get_tool_version.php new file mode 100644 index 000000000000..8fd611223f9d --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/get_tool_version.php @@ -0,0 +1,80 @@ +/locations//agents//tools//versions/`. Please see + * {@see ToolsClient::toolVersionName()} for help formatting this field. + */ +function get_tool_version_sample(string $formattedName): void +{ + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $request = (new GetToolVersionRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var ToolVersion $response */ + $response = $toolsClient->getToolVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ToolsClient::toolVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[TOOL]', + '[VERSION]' + ); + + get_tool_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Tools_GetToolVersion_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/list_locations.php b/DialogflowCx/samples/V3/ToolsClient/list_locations.php new file mode 100644 index 000000000000..eeffca42a68d --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/list_locations.php @@ -0,0 +1,62 @@ +listLocations($request); + + /** @var Location $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END dialogflow_v3_generated_Tools_ListLocations_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/list_tool_versions.php b/DialogflowCx/samples/V3/ToolsClient/list_tool_versions.php new file mode 100644 index 000000000000..f742df19b389 --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/list_tool_versions.php @@ -0,0 +1,78 @@ +/locations//agents//tools/`. Please see + * {@see ToolsClient::toolName()} for help formatting this field. + */ +function list_tool_versions_sample(string $formattedParent): void +{ + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $request = (new ListToolVersionsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $toolsClient->listToolVersions($request); + + /** @var ToolVersion $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ToolsClient::toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + + list_tool_versions_sample($formattedParent); +} +// [END dialogflow_v3_generated_Tools_ListToolVersions_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/list_tools.php b/DialogflowCx/samples/V3/ToolsClient/list_tools.php new file mode 100644 index 000000000000..98d7a5ff723d --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/list_tools.php @@ -0,0 +1,78 @@ +/locations//agents/`. Please see + * {@see ToolsClient::agentName()} for help formatting this field. + */ +function list_tools_sample(string $formattedParent): void +{ + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $request = (new ListToolsRequest()) + ->setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $toolsClient->listTools($request); + + /** @var Tool $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ToolsClient::agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + + list_tools_sample($formattedParent); +} +// [END dialogflow_v3_generated_Tools_ListTools_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/restore_tool_version.php b/DialogflowCx/samples/V3/ToolsClient/restore_tool_version.php new file mode 100644 index 000000000000..8effea3e8cc8 --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/restore_tool_version.php @@ -0,0 +1,80 @@ +/locations//agents//tools//versions/`. Please see + * {@see ToolsClient::toolVersionName()} for help formatting this field. + */ +function restore_tool_version_sample(string $formattedName): void +{ + // Create a client. + $toolsClient = new ToolsClient(); + + // Prepare the request message. + $request = (new RestoreToolVersionRequest()) + ->setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var RestoreToolVersionResponse $response */ + $response = $toolsClient->restoreToolVersion($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ToolsClient::toolVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[TOOL]', + '[VERSION]' + ); + + restore_tool_version_sample($formattedName); +} +// [END dialogflow_v3_generated_Tools_RestoreToolVersion_sync] diff --git a/DialogflowCx/samples/V3/ToolsClient/update_tool.php b/DialogflowCx/samples/V3/ToolsClient/update_tool.php new file mode 100644 index 000000000000..a87104c03245 --- /dev/null +++ b/DialogflowCx/samples/V3/ToolsClient/update_tool.php @@ -0,0 +1,75 @@ +setDisplayName($toolDisplayName) + ->setDescription($toolDescription); + $request = (new UpdateToolRequest()) + ->setTool($tool); + + // Call the API and handle any network failures. + try { + /** @var Tool $response */ + $response = $toolsClient->updateTool($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $toolDisplayName = '[DISPLAY_NAME]'; + $toolDescription = '[DESCRIPTION]'; + + update_tool_sample($toolDisplayName, $toolDescription); +} +// [END dialogflow_v3_generated_Tools_UpdateTool_sync] diff --git a/DialogflowCx/src/V3/Action.php b/DialogflowCx/src/V3/Action.php new file mode 100644 index 000000000000..d97cb6c0b3bf --- /dev/null +++ b/DialogflowCx/src/V3/Action.php @@ -0,0 +1,285 @@ +google.cloud.dialogflow.cx.v3.Action + */ +class Action extends \Google\Protobuf\Internal\Message +{ + protected $action; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\UserUtterance $user_utterance + * Optional. Agent obtained a message from the customer. + * @type \Google\Cloud\Dialogflow\Cx\V3\AgentUtterance $agent_utterance + * Optional. Action performed by the agent as a message. + * @type \Google\Cloud\Dialogflow\Cx\V3\ToolUse $tool_use + * Optional. Action performed on behalf of the agent by calling a plugin + * tool. + * @type \Google\Cloud\Dialogflow\Cx\V3\PlaybookInvocation $playbook_invocation + * Optional. Action performed on behalf of the agent by invoking a child + * playbook. + * @type \Google\Cloud\Dialogflow\Cx\V3\FlowInvocation $flow_invocation + * Optional. Action performed on behalf of the agent by invoking a CX flow. + * @type \Google\Cloud\Dialogflow\Cx\V3\PlaybookTransition $playbook_transition + * Optional. Action performed on behalf of the agent by transitioning to a + * target playbook. + * @type \Google\Cloud\Dialogflow\Cx\V3\FlowTransition $flow_transition + * Optional. Action performed on behalf of the agent by transitioning to a + * target CX flow. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Agent obtained a message from the customer. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.UserUtterance user_utterance = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\UserUtterance|null + */ + public function getUserUtterance() + { + return $this->readOneof(1); + } + + public function hasUserUtterance() + { + return $this->hasOneof(1); + } + + /** + * Optional. Agent obtained a message from the customer. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.UserUtterance user_utterance = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\UserUtterance $var + * @return $this + */ + public function setUserUtterance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\UserUtterance::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. Action performed by the agent as a message. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AgentUtterance agent_utterance = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\AgentUtterance|null + */ + public function getAgentUtterance() + { + return $this->readOneof(2); + } + + public function hasAgentUtterance() + { + return $this->hasOneof(2); + } + + /** + * Optional. Action performed by the agent as a message. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.AgentUtterance agent_utterance = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\AgentUtterance $var + * @return $this + */ + public function setAgentUtterance($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\AgentUtterance::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Optional. Action performed on behalf of the agent by calling a plugin + * tool. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolUse tool_use = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\ToolUse|null + */ + public function getToolUse() + { + return $this->readOneof(3); + } + + public function hasToolUse() + { + return $this->hasOneof(3); + } + + /** + * Optional. Action performed on behalf of the agent by calling a plugin + * tool. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolUse tool_use = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\ToolUse $var + * @return $this + */ + public function setToolUse($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ToolUse::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Optional. Action performed on behalf of the agent by invoking a child + * playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookInvocation playbook_invocation = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\PlaybookInvocation|null + */ + public function getPlaybookInvocation() + { + return $this->readOneof(4); + } + + public function hasPlaybookInvocation() + { + return $this->hasOneof(4); + } + + /** + * Optional. Action performed on behalf of the agent by invoking a child + * playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookInvocation playbook_invocation = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookInvocation $var + * @return $this + */ + public function setPlaybookInvocation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PlaybookInvocation::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Optional. Action performed on behalf of the agent by invoking a CX flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.FlowInvocation flow_invocation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\FlowInvocation|null + */ + public function getFlowInvocation() + { + return $this->readOneof(5); + } + + public function hasFlowInvocation() + { + return $this->hasOneof(5); + } + + /** + * Optional. Action performed on behalf of the agent by invoking a CX flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.FlowInvocation flow_invocation = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\FlowInvocation $var + * @return $this + */ + public function setFlowInvocation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\FlowInvocation::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * Optional. Action performed on behalf of the agent by transitioning to a + * target playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookTransition playbook_transition = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\PlaybookTransition|null + */ + public function getPlaybookTransition() + { + return $this->readOneof(12); + } + + public function hasPlaybookTransition() + { + return $this->hasOneof(12); + } + + /** + * Optional. Action performed on behalf of the agent by transitioning to a + * target playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookTransition playbook_transition = 12 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookTransition $var + * @return $this + */ + public function setPlaybookTransition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PlaybookTransition::class); + $this->writeOneof(12, $var); + + return $this; + } + + /** + * Optional. Action performed on behalf of the agent by transitioning to a + * target CX flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.FlowTransition flow_transition = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\FlowTransition|null + */ + public function getFlowTransition() + { + return $this->readOneof(13); + } + + public function hasFlowTransition() + { + return $this->hasOneof(13); + } + + /** + * Optional. Action performed on behalf of the agent by transitioning to a + * target CX flow. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.FlowTransition flow_transition = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\FlowTransition $var + * @return $this + */ + public function setFlowTransition($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\FlowTransition::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * @return string + */ + public function getAction() + { + return $this->whichOneof("action"); + } + +} + diff --git a/DialogflowCx/src/V3/Agent.php b/DialogflowCx/src/V3/Agent.php index 1cc74a783853..8bcccac73104 100644 --- a/DialogflowCx/src/V3/Agent.php +++ b/DialogflowCx/src/V3/Agent.php @@ -93,15 +93,6 @@ class Agent extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SpeechToTextSettings speech_to_text_settings = 13; */ protected $speech_to_text_settings = null; - /** - * Immutable. Name of the start flow in this agent. A start flow will be - * automatically created when the agent is created, and can only be deleted by - * deleting the agent. Format: - * `projects//locations//agents//flows/`. - * - * Generated from protobuf field string start_flow = 16 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { - */ - protected $start_flow = ''; /** * Name of the * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] @@ -200,6 +191,7 @@ class Agent extends \Google\Protobuf\Internal\Message * Generated from protobuf field optional bool satisfies_pzi = 46 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; */ protected $satisfies_pzi = null; + protected $session_entry_resource; /** * Constructor. @@ -243,10 +235,22 @@ class Agent extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Dialogflow\Cx\V3\SpeechToTextSettings $speech_to_text_settings * Speech recognition related settings. * @type string $start_flow - * Immutable. Name of the start flow in this agent. A start flow will be - * automatically created when the agent is created, and can only be deleted by - * deleting the agent. Format: + * Name of the start flow in this agent. A start flow will be automatically + * created when the agent is created, and can only be deleted by deleting + * the agent. + * Format: * `projects//locations//agents//flows/`. + * Currently only the default start flow with id + * "00000000-0000-0000-0000-000000000000" is allowed. + * @type string $start_playbook + * Name of the start playbook in this agent. A start playbook will be + * automatically created when the agent is created, and can only be deleted + * by deleting the agent. + * Format: + * `projects//locations//agents//playbooks/`. + * Currently only the + * default playbook with id + * "00000000-0000-0000-0000-000000000000" is allowed. * @type string $security_settings * Name of the * [SecuritySettings][google.cloud.dialogflow.cx.v3.SecuritySettings] @@ -552,33 +556,89 @@ public function setSpeechToTextSettings($var) } /** - * Immutable. Name of the start flow in this agent. A start flow will be - * automatically created when the agent is created, and can only be deleted by - * deleting the agent. Format: + * Name of the start flow in this agent. A start flow will be automatically + * created when the agent is created, and can only be deleted by deleting + * the agent. + * Format: * `projects//locations//agents//flows/`. + * Currently only the default start flow with id + * "00000000-0000-0000-0000-000000000000" is allowed. * - * Generated from protobuf field string start_flow = 16 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * Generated from protobuf field string start_flow = 16 [(.google.api.resource_reference) = { * @return string */ public function getStartFlow() { - return $this->start_flow; + return $this->readOneof(16); + } + + public function hasStartFlow() + { + return $this->hasOneof(16); } /** - * Immutable. Name of the start flow in this agent. A start flow will be - * automatically created when the agent is created, and can only be deleted by - * deleting the agent. Format: + * Name of the start flow in this agent. A start flow will be automatically + * created when the agent is created, and can only be deleted by deleting + * the agent. + * Format: * `projects//locations//agents//flows/`. + * Currently only the default start flow with id + * "00000000-0000-0000-0000-000000000000" is allowed. * - * Generated from protobuf field string start_flow = 16 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { + * Generated from protobuf field string start_flow = 16 [(.google.api.resource_reference) = { * @param string $var * @return $this */ public function setStartFlow($var) { GPBUtil::checkString($var, True); - $this->start_flow = $var; + $this->writeOneof(16, $var); + + return $this; + } + + /** + * Name of the start playbook in this agent. A start playbook will be + * automatically created when the agent is created, and can only be deleted + * by deleting the agent. + * Format: + * `projects//locations//agents//playbooks/`. + * Currently only the + * default playbook with id + * "00000000-0000-0000-0000-000000000000" is allowed. + * + * Generated from protobuf field string start_playbook = 39 [(.google.api.resource_reference) = { + * @return string + */ + public function getStartPlaybook() + { + return $this->readOneof(39); + } + + public function hasStartPlaybook() + { + return $this->hasOneof(39); + } + + /** + * Name of the start playbook in this agent. A start playbook will be + * automatically created when the agent is created, and can only be deleted + * by deleting the agent. + * Format: + * `projects//locations//agents//playbooks/`. + * Currently only the + * default playbook with id + * "00000000-0000-0000-0000-000000000000" is allowed. + * + * Generated from protobuf field string start_playbook = 39 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setStartPlaybook($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(39, $var); return $this; } @@ -1069,5 +1129,13 @@ public function setSatisfiesPzi($var) return $this; } + /** + * @return string + */ + public function getSessionEntryResource() + { + return $this->whichOneof("session_entry_resource"); + } + } diff --git a/DialogflowCx/src/V3/AgentUtterance.php b/DialogflowCx/src/V3/AgentUtterance.php new file mode 100644 index 000000000000..a23064e32813 --- /dev/null +++ b/DialogflowCx/src/V3/AgentUtterance.php @@ -0,0 +1,67 @@ +google.cloud.dialogflow.cx.v3.AgentUtterance + */ +class AgentUtterance extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Message content in text. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * Required. Message content in text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Required. Message content in text. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Required. Message content in text. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/AudioEncoding.php b/DialogflowCx/src/V3/AudioEncoding.php index 8d8ca43f7a10..570bd291f896 100644 --- a/DialogflowCx/src/V3/AudioEncoding.php +++ b/DialogflowCx/src/V3/AudioEncoding.php @@ -25,6 +25,7 @@ class AudioEncoding const AUDIO_ENCODING_UNSPECIFIED = 0; /** * Uncompressed 16-bit signed little-endian samples (Linear PCM). + * LINT: LEGACY_NAMES * * Generated from protobuf enum AUDIO_ENCODING_LINEAR_16 = 1; */ diff --git a/DialogflowCx/src/V3/Client/AgentsClient.php b/DialogflowCx/src/V3/Client/AgentsClient.php index ad294c99c9e1..9bde0787cebd 100644 --- a/DialogflowCx/src/V3/Client/AgentsClient.php +++ b/DialogflowCx/src/V3/Client/AgentsClient.php @@ -303,6 +303,27 @@ public static function locationName(string $project, string $location): string ]); } + /** + * Formats a string containing the fully-qualified path to represent a playbook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * + * @return string The formatted playbook resource. + */ + public static function playbookName(string $project, string $location, string $agent, string $playbook): string + { + return self::getPathTemplate('playbook')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * secret_version resource. @@ -351,6 +372,7 @@ public static function securitySettingsName(string $project, string $location, s * - environment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment} * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} * - location: projects/{project}/locations/{location} + * - playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook} * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} * - securitySettings: projects/{project}/locations/{location}/securitySettings/{security_settings} * diff --git a/DialogflowCx/src/V3/Client/EnvironmentsClient.php b/DialogflowCx/src/V3/Client/EnvironmentsClient.php index ffcbb8b49fbe..87e8c7ea1fbf 100644 --- a/DialogflowCx/src/V3/Client/EnvironmentsClient.php +++ b/DialogflowCx/src/V3/Client/EnvironmentsClient.php @@ -225,6 +225,25 @@ public static function environmentName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * secret_version resource. + * + * @param string $project + * @param string $secret + * @param string $version + * + * @return string The formatted secret_version resource. + */ + public static function secretVersionName(string $project, string $secret, string $version): string + { + return self::getPathTemplate('secretVersion')->render([ + 'project' => $project, + 'secret' => $secret, + 'version' => $version, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a service * resource. @@ -322,6 +341,7 @@ public static function webhookName(string $project, string $location, string $ag * Template: Pattern * - agent: projects/{project}/locations/{location}/agents/{agent} * - environment: projects/{project}/locations/{location}/agents/{agent}/environments/{environment} + * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} * - service: projects/{project}/locations/{location}/namespaces/{namespace}/services/{service} * - testCase: projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case} * - version: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version} diff --git a/DialogflowCx/src/V3/Client/ExamplesClient.php b/DialogflowCx/src/V3/Client/ExamplesClient.php new file mode 100644 index 000000000000..bf12f6adae26 --- /dev/null +++ b/DialogflowCx/src/V3/Client/ExamplesClient.php @@ -0,0 +1,499 @@ + createExampleAsync(CreateExampleRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteExampleAsync(DeleteExampleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getExampleAsync(GetExampleRequest $request, array $optionalArgs = []) + * @method PromiseInterface listExamplesAsync(ListExamplesRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateExampleAsync(UpdateExampleRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) + */ +final class ExamplesClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Examples'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'dialogflow.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/examples_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/examples_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/examples_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/examples_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a example + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * @param string $example + * + * @return string The formatted example resource. + */ + public static function exampleName( + string $project, + string $location, + string $agent, + string $playbook, + string $example + ): string { + return self::getPathTemplate('example')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + 'example' => $example, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a flow + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow resource. + */ + public static function flowName(string $project, string $location, string $agent, string $flow): string + { + return self::getPathTemplate('flow')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a playbook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * + * @return string The formatted playbook resource. + */ + public static function playbookName(string $project, string $location, string $agent, string $playbook): string + { + return self::getPathTemplate('playbook')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a tool + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * + * @return string The formatted tool resource. + */ + public static function toolName(string $project, string $location, string $agent, string $tool): string + { + return self::getPathTemplate('tool')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - example: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/examples/{example} + * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} + * - playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook} + * - tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array|ClientOptions $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type FetchAuthTokenInterface|CredentialsWrapper $credentials + * This option should only be used with a pre-constructed + * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that + * when one of these objects are provided, any settings in $credentialsConfig will + * be ignored. + * **Important**: If you are providing a path to a credentials file, or a decoded + * credentials file as a PHP array, this usage is now DEPRECATED. Providing an + * unvalidated credential configuration to Google APIs can compromise the security + * of your systems and data. It is recommended to create the credentials explicitly + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * use Google\Cloud\Dialogflow\Cx\V3\ExamplesClient; + * $creds = new ServiceAccountCredentials($scopes, $json); + * $options = new ExamplesClient(['credentials' => $creds]); + * ``` + * {@see + * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * @type string $universeDomain + * The service domain for the client. Defaults to 'googleapis.com'. + * } + * + * @throws ValidationException + */ + public function __construct(array|ClientOptions $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates an example in the specified playbook. + * + * The async variant is {@see ExamplesClient::createExampleAsync()} . + * + * @example samples/V3/ExamplesClient/create_example.php + * + * @param CreateExampleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Example + * + * @throws ApiException Thrown if the API call fails. + */ + public function createExample(CreateExampleRequest $request, array $callOptions = []): Example + { + return $this->startApiCall('CreateExample', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified example. + * + * The async variant is {@see ExamplesClient::deleteExampleAsync()} . + * + * @example samples/V3/ExamplesClient/delete_example.php + * + * @param DeleteExampleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteExample(DeleteExampleRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteExample', $request, $callOptions)->wait(); + } + + /** + * Retrieves the specified example. + * + * The async variant is {@see ExamplesClient::getExampleAsync()} . + * + * @example samples/V3/ExamplesClient/get_example.php + * + * @param GetExampleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Example + * + * @throws ApiException Thrown if the API call fails. + */ + public function getExample(GetExampleRequest $request, array $callOptions = []): Example + { + return $this->startApiCall('GetExample', $request, $callOptions)->wait(); + } + + /** + * Returns a list of examples in the specified playbook. + * + * The async variant is {@see ExamplesClient::listExamplesAsync()} . + * + * @example samples/V3/ExamplesClient/list_examples.php + * + * @param ListExamplesRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listExamples(ListExamplesRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListExamples', $request, $callOptions); + } + + /** + * Update the specified example. + * + * The async variant is {@see ExamplesClient::updateExampleAsync()} . + * + * @example samples/V3/ExamplesClient/update_example.php + * + * @param UpdateExampleRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Example + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateExample(UpdateExampleRequest $request, array $callOptions = []): Example + { + return $this->startApiCall('UpdateExample', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see ExamplesClient::getLocationAsync()} . + * + * @example samples/V3/ExamplesClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see ExamplesClient::listLocationsAsync()} . + * + * @example samples/V3/ExamplesClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/DialogflowCx/src/V3/Client/FlowsClient.php b/DialogflowCx/src/V3/Client/FlowsClient.php index 6cc86c08b614..c2f1b8c66642 100644 --- a/DialogflowCx/src/V3/Client/FlowsClient.php +++ b/DialogflowCx/src/V3/Client/FlowsClient.php @@ -316,6 +316,27 @@ public static function pageName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a playbook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * + * @return string The formatted playbook resource. + */ + public static function playbookName(string $project, string $location, string $agent, string $playbook): string + { + return self::getPathTemplate('playbook')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_agent_flow_transition_route_group resource. @@ -369,6 +390,27 @@ public static function projectLocationAgentTransitionRouteGroupName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a tool + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * + * @return string The formatted tool resource. + */ + public static function toolName(string $project, string $location, string $agent, string $tool): string + { + return self::getPathTemplate('tool')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * transition_route_group resource. @@ -428,8 +470,10 @@ public static function webhookName(string $project, string $location, string $ag * - generator: projects/{project}/locations/{location}/agents/{agent}/generators/{generator} * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook} * - projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} * - projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group} + * - tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool} * - transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} * diff --git a/DialogflowCx/src/V3/Client/PagesClient.php b/DialogflowCx/src/V3/Client/PagesClient.php index 914e2fd25fb6..19475607c20d 100644 --- a/DialogflowCx/src/V3/Client/PagesClient.php +++ b/DialogflowCx/src/V3/Client/PagesClient.php @@ -226,6 +226,27 @@ public static function pageName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a playbook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * + * @return string The formatted playbook resource. + */ + public static function playbookName(string $project, string $location, string $agent, string $playbook): string + { + return self::getPathTemplate('playbook')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_agent_flow_transition_route_group resource. @@ -279,6 +300,27 @@ public static function projectLocationAgentTransitionRouteGroupName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a tool + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * + * @return string The formatted tool resource. + */ + public static function toolName(string $project, string $location, string $agent, string $tool): string + { + return self::getPathTemplate('tool')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * transition_route_group resource. @@ -337,8 +379,10 @@ public static function webhookName(string $project, string $location, string $ag * - generator: projects/{project}/locations/{location}/agents/{agent}/generators/{generator} * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook} * - projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} * - projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group} + * - tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool} * - transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} * diff --git a/DialogflowCx/src/V3/Client/PlaybooksClient.php b/DialogflowCx/src/V3/Client/PlaybooksClient.php new file mode 100644 index 000000000000..e8e210e9d8f9 --- /dev/null +++ b/DialogflowCx/src/V3/Client/PlaybooksClient.php @@ -0,0 +1,854 @@ + createPlaybookAsync(CreatePlaybookRequest $request, array $optionalArgs = []) + * @method PromiseInterface createPlaybookVersionAsync(CreatePlaybookVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface deletePlaybookAsync(DeletePlaybookRequest $request, array $optionalArgs = []) + * @method PromiseInterface deletePlaybookVersionAsync(DeletePlaybookVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface exportPlaybookAsync(ExportPlaybookRequest $request, array $optionalArgs = []) + * @method PromiseInterface getPlaybookAsync(GetPlaybookRequest $request, array $optionalArgs = []) + * @method PromiseInterface getPlaybookVersionAsync(GetPlaybookVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface importPlaybookAsync(ImportPlaybookRequest $request, array $optionalArgs = []) + * @method PromiseInterface listPlaybookVersionsAsync(ListPlaybookVersionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listPlaybooksAsync(ListPlaybooksRequest $request, array $optionalArgs = []) + * @method PromiseInterface restorePlaybookVersionAsync(RestorePlaybookVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface updatePlaybookAsync(UpdatePlaybookRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) + */ +final class PlaybooksClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Playbooks'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'dialogflow.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private $operationsClient; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/playbooks_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/playbooks_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/playbooks_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/playbooks_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = $this->descriptors[$methodName]['longRunning'] ?? []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName(string $project, string $location, string $agent): string + { + return self::getPathTemplate('agent')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a example + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * @param string $example + * + * @return string The formatted example resource. + */ + public static function exampleName( + string $project, + string $location, + string $agent, + string $playbook, + string $example + ): string { + return self::getPathTemplate('example')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + 'example' => $example, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a flow + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $flow + * + * @return string The formatted flow resource. + */ + public static function flowName(string $project, string $location, string $agent, string $flow): string + { + return self::getPathTemplate('flow')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'flow' => $flow, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a generator + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $generator + * + * @return string The formatted generator resource. + */ + public static function generatorName(string $project, string $location, string $agent, string $generator): string + { + return self::getPathTemplate('generator')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'generator' => $generator, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a playbook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * + * @return string The formatted playbook resource. + */ + public static function playbookName(string $project, string $location, string $agent, string $playbook): string + { + return self::getPathTemplate('playbook')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * playbook_version resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * @param string $version + * + * @return string The formatted playbook_version resource. + */ + public static function playbookVersionName( + string $project, + string $location, + string $agent, + string $playbook, + string $version + ): string { + return self::getPathTemplate('playbookVersion')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + 'version' => $version, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a tool + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * + * @return string The formatted tool resource. + */ + public static function toolName(string $project, string $location, string $agent, string $tool): string + { + return self::getPathTemplate('tool')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a webhook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $webhook + * + * @return string The formatted webhook resource. + */ + public static function webhookName(string $project, string $location, string $agent, string $webhook): string + { + return self::getPathTemplate('webhook')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'webhook' => $webhook, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - example: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/examples/{example} + * - flow: projects/{project}/locations/{location}/agents/{agent}/flows/{flow} + * - generator: projects/{project}/locations/{location}/agents/{agent}/generators/{generator} + * - playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook} + * - playbookVersion: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/versions/{version} + * - tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool} + * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array|ClientOptions $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type FetchAuthTokenInterface|CredentialsWrapper $credentials + * This option should only be used with a pre-constructed + * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that + * when one of these objects are provided, any settings in $credentialsConfig will + * be ignored. + * **Important**: If you are providing a path to a credentials file, or a decoded + * credentials file as a PHP array, this usage is now DEPRECATED. Providing an + * unvalidated credential configuration to Google APIs can compromise the security + * of your systems and data. It is recommended to create the credentials explicitly + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * use Google\Cloud\Dialogflow\Cx\V3\PlaybooksClient; + * $creds = new ServiceAccountCredentials($scopes, $json); + * $options = new PlaybooksClient(['credentials' => $creds]); + * ``` + * {@see + * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * @type string $universeDomain + * The service domain for the client. Defaults to 'googleapis.com'. + * } + * + * @throws ValidationException + */ + public function __construct(array|ClientOptions $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a playbook in a specified agent. + * + * The async variant is {@see PlaybooksClient::createPlaybookAsync()} . + * + * @example samples/V3/PlaybooksClient/create_playbook.php + * + * @param CreatePlaybookRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Playbook + * + * @throws ApiException Thrown if the API call fails. + */ + public function createPlaybook(CreatePlaybookRequest $request, array $callOptions = []): Playbook + { + return $this->startApiCall('CreatePlaybook', $request, $callOptions)->wait(); + } + + /** + * Creates a version for the specified Playbook. + * + * The async variant is {@see PlaybooksClient::createPlaybookVersionAsync()} . + * + * @example samples/V3/PlaybooksClient/create_playbook_version.php + * + * @param CreatePlaybookVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaybookVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function createPlaybookVersion( + CreatePlaybookVersionRequest $request, + array $callOptions = [] + ): PlaybookVersion { + return $this->startApiCall('CreatePlaybookVersion', $request, $callOptions)->wait(); + } + + /** + * Deletes a specified playbook. + * + * The async variant is {@see PlaybooksClient::deletePlaybookAsync()} . + * + * @example samples/V3/PlaybooksClient/delete_playbook.php + * + * @param DeletePlaybookRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deletePlaybook(DeletePlaybookRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeletePlaybook', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified version of the Playbook. + * + * The async variant is {@see PlaybooksClient::deletePlaybookVersionAsync()} . + * + * @example samples/V3/PlaybooksClient/delete_playbook_version.php + * + * @param DeletePlaybookVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deletePlaybookVersion(DeletePlaybookVersionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeletePlaybookVersion', $request, $callOptions)->wait(); + } + + /** + * Exports the specified playbook to a binary file. + * + * Note that resources (e.g. examples, tools) that the playbook + * references will also be exported. + * + * The async variant is {@see PlaybooksClient::exportPlaybookAsync()} . + * + * @example samples/V3/PlaybooksClient/export_playbook.php + * + * @param ExportPlaybookRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function exportPlaybook(ExportPlaybookRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ExportPlaybook', $request, $callOptions)->wait(); + } + + /** + * Retrieves the specified Playbook. + * + * The async variant is {@see PlaybooksClient::getPlaybookAsync()} . + * + * @example samples/V3/PlaybooksClient/get_playbook.php + * + * @param GetPlaybookRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Playbook + * + * @throws ApiException Thrown if the API call fails. + */ + public function getPlaybook(GetPlaybookRequest $request, array $callOptions = []): Playbook + { + return $this->startApiCall('GetPlaybook', $request, $callOptions)->wait(); + } + + /** + * Retrieves the specified version of the Playbook. + * + * The async variant is {@see PlaybooksClient::getPlaybookVersionAsync()} . + * + * @example samples/V3/PlaybooksClient/get_playbook_version.php + * + * @param GetPlaybookVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PlaybookVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function getPlaybookVersion(GetPlaybookVersionRequest $request, array $callOptions = []): PlaybookVersion + { + return $this->startApiCall('GetPlaybookVersion', $request, $callOptions)->wait(); + } + + /** + * Imports the specified playbook to the specified agent from a binary file. + * + * The async variant is {@see PlaybooksClient::importPlaybookAsync()} . + * + * @example samples/V3/PlaybooksClient/import_playbook.php + * + * @param ImportPlaybookRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function importPlaybook(ImportPlaybookRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ImportPlaybook', $request, $callOptions)->wait(); + } + + /** + * Lists versions for the specified Playbook. + * + * The async variant is {@see PlaybooksClient::listPlaybookVersionsAsync()} . + * + * @example samples/V3/PlaybooksClient/list_playbook_versions.php + * + * @param ListPlaybookVersionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listPlaybookVersions( + ListPlaybookVersionsRequest $request, + array $callOptions = [] + ): PagedListResponse { + return $this->startApiCall('ListPlaybookVersions', $request, $callOptions); + } + + /** + * Returns a list of playbooks in the specified agent. + * + * The async variant is {@see PlaybooksClient::listPlaybooksAsync()} . + * + * @example samples/V3/PlaybooksClient/list_playbooks.php + * + * @param ListPlaybooksRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listPlaybooks(ListPlaybooksRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListPlaybooks', $request, $callOptions); + } + + /** + * Retrieves the specified version of the Playbook and stores it as the + * current playbook draft, returning the playbook with resources updated. + * + * The async variant is {@see PlaybooksClient::restorePlaybookVersionAsync()} . + * + * @example samples/V3/PlaybooksClient/restore_playbook_version.php + * + * @param RestorePlaybookVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return RestorePlaybookVersionResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function restorePlaybookVersion( + RestorePlaybookVersionRequest $request, + array $callOptions = [] + ): RestorePlaybookVersionResponse { + return $this->startApiCall('RestorePlaybookVersion', $request, $callOptions)->wait(); + } + + /** + * Updates the specified Playbook. + * + * The async variant is {@see PlaybooksClient::updatePlaybookAsync()} . + * + * @example samples/V3/PlaybooksClient/update_playbook.php + * + * @param UpdatePlaybookRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Playbook + * + * @throws ApiException Thrown if the API call fails. + */ + public function updatePlaybook(UpdatePlaybookRequest $request, array $callOptions = []): Playbook + { + return $this->startApiCall('UpdatePlaybook', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see PlaybooksClient::getLocationAsync()} . + * + * @example samples/V3/PlaybooksClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see PlaybooksClient::listLocationsAsync()} . + * + * @example samples/V3/PlaybooksClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/DialogflowCx/src/V3/Client/SessionsClient.php b/DialogflowCx/src/V3/Client/SessionsClient.php index e555685d32e9..4559d0912a42 100644 --- a/DialogflowCx/src/V3/Client/SessionsClient.php +++ b/DialogflowCx/src/V3/Client/SessionsClient.php @@ -228,6 +228,27 @@ public static function pageName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a playbook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * + * @return string The formatted playbook resource. + */ + public static function playbookName(string $project, string $location, string $agent, string $playbook): string + { + return self::getPathTemplate('playbook')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_agent_environment_session resource. @@ -433,6 +454,27 @@ public static function sessionEntityTypeName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a tool + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * + * @return string The formatted tool resource. + */ + public static function toolName(string $project, string $location, string $agent, string $tool): string + { + return self::getPathTemplate('tool')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a version * resource. @@ -470,6 +512,7 @@ public static function versionName( * - entityType: projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type} * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook} * - projectLocationAgentEnvironmentSession: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session} * - projectLocationAgentEnvironmentSessionEntityType: projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type} * - projectLocationAgentSession: projects/{project}/locations/{location}/agents/{agent}/sessions/{session} @@ -478,6 +521,7 @@ public static function versionName( * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - session: projects/{project}/locations/{location}/agents/{agent}/sessions/{session} * - sessionEntityType: projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type} + * - tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool} * - version: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version} * * The optional $template argument can be supplied to specify a particular pattern, diff --git a/DialogflowCx/src/V3/Client/TestCasesClient.php b/DialogflowCx/src/V3/Client/TestCasesClient.php index 6446b0d01ba8..b196238f6976 100644 --- a/DialogflowCx/src/V3/Client/TestCasesClient.php +++ b/DialogflowCx/src/V3/Client/TestCasesClient.php @@ -348,6 +348,27 @@ public static function pageName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a playbook + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $playbook + * + * @return string The formatted playbook resource. + */ + public static function playbookName(string $project, string $location, string $agent, string $playbook): string + { + return self::getPathTemplate('playbook')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'playbook' => $playbook, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_agent_flow_transition_route_group resource. @@ -450,6 +471,27 @@ public static function testCaseResultName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a tool + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * + * @return string The formatted tool resource. + */ + public static function toolName(string $project, string $location, string $agent, string $tool): string + { + return self::getPathTemplate('tool')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * transition_route_group resource. @@ -510,10 +552,12 @@ public static function webhookName(string $project, string $location, string $ag * - generator: projects/{project}/locations/{location}/agents/{agent}/generators/{generator} * - intent: projects/{project}/locations/{location}/agents/{agent}/intents/{intent} * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} + * - playbook: projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook} * - projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} * - projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group} * - testCase: projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case} * - testCaseResult: projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result} + * - tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool} * - transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} * diff --git a/DialogflowCx/src/V3/Client/ToolsClient.php b/DialogflowCx/src/V3/Client/ToolsClient.php new file mode 100644 index 000000000000..33eb3255f970 --- /dev/null +++ b/DialogflowCx/src/V3/Client/ToolsClient.php @@ -0,0 +1,665 @@ + createToolAsync(CreateToolRequest $request, array $optionalArgs = []) + * @method PromiseInterface createToolVersionAsync(CreateToolVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteToolAsync(DeleteToolRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteToolVersionAsync(DeleteToolVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface getToolAsync(GetToolRequest $request, array $optionalArgs = []) + * @method PromiseInterface getToolVersionAsync(GetToolVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface listToolVersionsAsync(ListToolVersionsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listToolsAsync(ListToolsRequest $request, array $optionalArgs = []) + * @method PromiseInterface restoreToolVersionAsync(RestoreToolVersionRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateToolAsync(UpdateToolRequest $request, array $optionalArgs = []) + * @method PromiseInterface getLocationAsync(GetLocationRequest $request, array $optionalArgs = []) + * @method PromiseInterface listLocationsAsync(ListLocationsRequest $request, array $optionalArgs = []) + */ +final class ToolsClient +{ + use GapicClientTrait; + use ResourceHelperTrait; + + /** The name of the service. */ + private const SERVICE_NAME = 'google.cloud.dialogflow.cx.v3.Tools'; + + /** + * The default address of the service. + * + * @deprecated SERVICE_ADDRESS_TEMPLATE should be used instead. + */ + private const SERVICE_ADDRESS = 'dialogflow.googleapis.com'; + + /** The address template of the service. */ + private const SERVICE_ADDRESS_TEMPLATE = 'dialogflow.UNIVERSE_DOMAIN'; + + /** The default port of the service. */ + private const DEFAULT_SERVICE_PORT = 443; + + /** The name of the code generator, to be included in the agent header. */ + private const CODEGEN_NAME = 'gapic'; + + /** The default scopes required by the service. */ + public static $serviceScopes = [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/dialogflow', + ]; + + private static function getClientDefaults() + { + return [ + 'serviceName' => self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/tools_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/tools_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/tools_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/tools_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a agent + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * + * @return string The formatted agent resource. + */ + public static function agentName(string $project, string $location, string $agent): string + { + return self::getPathTemplate('agent')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * secret_version resource. + * + * @param string $project + * @param string $secret + * @param string $version + * + * @return string The formatted secret_version resource. + */ + public static function secretVersionName(string $project, string $secret, string $version): string + { + return self::getPathTemplate('secretVersion')->render([ + 'project' => $project, + 'secret' => $secret, + 'version' => $version, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a service + * resource. + * + * @param string $project + * @param string $location + * @param string $namespace + * @param string $service + * + * @return string The formatted service resource. + */ + public static function serviceName(string $project, string $location, string $namespace, string $service): string + { + return self::getPathTemplate('service')->render([ + 'project' => $project, + 'location' => $location, + 'namespace' => $namespace, + 'service' => $service, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a tool + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * + * @return string The formatted tool resource. + */ + public static function toolName(string $project, string $location, string $agent, string $tool): string + { + return self::getPathTemplate('tool')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a tool_version + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * @param string $version + * + * @return string The formatted tool_version resource. + */ + public static function toolVersionName( + string $project, + string $location, + string $agent, + string $tool, + string $version + ): string { + return self::getPathTemplate('toolVersion')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + 'version' => $version, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - agent: projects/{project}/locations/{location}/agents/{agent} + * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} + * - service: projects/{project}/locations/{location}/namespaces/{namespace}/services/{service} + * - tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool} + * - toolVersion: projects/{project}/locations/{location}/agents/{agent}/tools/{tool}/versions/{version} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param ?string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, ?string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array|ClientOptions $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'dialogflow.googleapis.com:443'. + * @type FetchAuthTokenInterface|CredentialsWrapper $credentials + * This option should only be used with a pre-constructed + * {@see FetchAuthTokenInterface} or {@see CredentialsWrapper} object. Note that + * when one of these objects are provided, any settings in $credentialsConfig will + * be ignored. + * **Important**: If you are providing a path to a credentials file, or a decoded + * credentials file as a PHP array, this usage is now DEPRECATED. Providing an + * unvalidated credential configuration to Google APIs can compromise the security + * of your systems and data. It is recommended to create the credentials explicitly + * ``` + * use Google\Auth\Credentials\ServiceAccountCredentials; + * use Google\Cloud\Dialogflow\Cx\V3\ToolsClient; + * $creds = new ServiceAccountCredentials($scopes, $json); + * $options = new ToolsClient(['credentials' => $creds]); + * ``` + * {@see + * https://cloud.google.com/docs/authentication/external/externally-sourced-credentials} + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * @type false|LoggerInterface $logger + * A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the + * 'GOOGLE_SDK_PHP_LOGGING' environment flag + * @type string $universeDomain + * The service domain for the client. Defaults to 'googleapis.com'. + * } + * + * @throws ValidationException + */ + public function __construct(array|ClientOptions $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a [Tool][google.cloud.dialogflow.cx.v3.Tool] in the specified + * agent. + * + * The async variant is {@see ToolsClient::createToolAsync()} . + * + * @example samples/V3/ToolsClient/create_tool.php + * + * @param CreateToolRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Tool + * + * @throws ApiException Thrown if the API call fails. + */ + public function createTool(CreateToolRequest $request, array $callOptions = []): Tool + { + return $this->startApiCall('CreateTool', $request, $callOptions)->wait(); + } + + /** + * Creates a version for the specified + * [Tool][google.cloud.dialogflow.cx.v3.Tool]. + * + * The async variant is {@see ToolsClient::createToolVersionAsync()} . + * + * @example samples/V3/ToolsClient/create_tool_version.php + * + * @param CreateToolVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ToolVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function createToolVersion(CreateToolVersionRequest $request, array $callOptions = []): ToolVersion + { + return $this->startApiCall('CreateToolVersion', $request, $callOptions)->wait(); + } + + /** + * Deletes a specified [Tool][google.cloud.dialogflow.cx.v3.Tool]. + * + * The async variant is {@see ToolsClient::deleteToolAsync()} . + * + * @example samples/V3/ToolsClient/delete_tool.php + * + * @param DeleteToolRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteTool(DeleteToolRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteTool', $request, $callOptions)->wait(); + } + + /** + * Deletes the specified version of the + * [Tool][google.cloud.dialogflow.cx.v3.Tool]. + * + * The async variant is {@see ToolsClient::deleteToolVersionAsync()} . + * + * @example samples/V3/ToolsClient/delete_tool_version.php + * + * @param DeleteToolVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteToolVersion(DeleteToolVersionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteToolVersion', $request, $callOptions)->wait(); + } + + /** + * Retrieves the specified [Tool][google.cloud.dialogflow.cx.v3.Tool]. + * + * The async variant is {@see ToolsClient::getToolAsync()} . + * + * @example samples/V3/ToolsClient/get_tool.php + * + * @param GetToolRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Tool + * + * @throws ApiException Thrown if the API call fails. + */ + public function getTool(GetToolRequest $request, array $callOptions = []): Tool + { + return $this->startApiCall('GetTool', $request, $callOptions)->wait(); + } + + /** + * Retrieves the specified version of the + * [Tool][google.cloud.dialogflow.cx.v3.Tool]. + * + * The async variant is {@see ToolsClient::getToolVersionAsync()} . + * + * @example samples/V3/ToolsClient/get_tool_version.php + * + * @param GetToolVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ToolVersion + * + * @throws ApiException Thrown if the API call fails. + */ + public function getToolVersion(GetToolVersionRequest $request, array $callOptions = []): ToolVersion + { + return $this->startApiCall('GetToolVersion', $request, $callOptions)->wait(); + } + + /** + * List versions of the specified [Tool][google.cloud.dialogflow.cx.v3.Tool]. + * + * The async variant is {@see ToolsClient::listToolVersionsAsync()} . + * + * @example samples/V3/ToolsClient/list_tool_versions.php + * + * @param ListToolVersionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listToolVersions(ListToolVersionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListToolVersions', $request, $callOptions); + } + + /** + * Returns a list of [Tools][google.cloud.dialogflow.cx.v3.Tool] in the + * specified agent. + * + * The async variant is {@see ToolsClient::listToolsAsync()} . + * + * @example samples/V3/ToolsClient/list_tools.php + * + * @param ListToolsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listTools(ListToolsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListTools', $request, $callOptions); + } + + /** + * Retrieves the specified version of the Tool and stores it as the + * current tool draft, returning the tool with resources updated. + * + * The async variant is {@see ToolsClient::restoreToolVersionAsync()} . + * + * @example samples/V3/ToolsClient/restore_tool_version.php + * + * @param RestoreToolVersionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return RestoreToolVersionResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function restoreToolVersion( + RestoreToolVersionRequest $request, + array $callOptions = [] + ): RestoreToolVersionResponse { + return $this->startApiCall('RestoreToolVersion', $request, $callOptions)->wait(); + } + + /** + * Update the specified [Tool][google.cloud.dialogflow.cx.v3.Tool]. + * + * The async variant is {@see ToolsClient::updateToolAsync()} . + * + * @example samples/V3/ToolsClient/update_tool.php + * + * @param UpdateToolRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Tool + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateTool(UpdateToolRequest $request, array $callOptions = []): Tool + { + return $this->startApiCall('UpdateTool', $request, $callOptions)->wait(); + } + + /** + * Gets information about a location. + * + * The async variant is {@see ToolsClient::getLocationAsync()} . + * + * @example samples/V3/ToolsClient/get_location.php + * + * @param GetLocationRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Location + * + * @throws ApiException Thrown if the API call fails. + */ + public function getLocation(GetLocationRequest $request, array $callOptions = []): Location + { + return $this->startApiCall('GetLocation', $request, $callOptions)->wait(); + } + + /** + * Lists information about the supported locations for this service. + * + * The async variant is {@see ToolsClient::listLocationsAsync()} . + * + * @example samples/V3/ToolsClient/list_locations.php + * + * @param ListLocationsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listLocations(ListLocationsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListLocations', $request, $callOptions); + } +} diff --git a/DialogflowCx/src/V3/Client/TransitionRouteGroupsClient.php b/DialogflowCx/src/V3/Client/TransitionRouteGroupsClient.php index 4f8b1527bf93..e59900ce028c 100644 --- a/DialogflowCx/src/V3/Client/TransitionRouteGroupsClient.php +++ b/DialogflowCx/src/V3/Client/TransitionRouteGroupsClient.php @@ -278,6 +278,27 @@ public static function projectLocationAgentTransitionRouteGroupName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a tool + * resource. + * + * @param string $project + * @param string $location + * @param string $agent + * @param string $tool + * + * @return string The formatted tool resource. + */ + public static function toolName(string $project, string $location, string $agent, string $tool): string + { + return self::getPathTemplate('tool')->render([ + 'project' => $project, + 'location' => $location, + 'agent' => $agent, + 'tool' => $tool, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * transition_route_group resource. @@ -338,6 +359,7 @@ public static function webhookName(string $project, string $location, string $ag * - page: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page} * - projectLocationAgentFlowTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} * - projectLocationAgentTransitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group} + * - tool: projects/{project}/locations/{location}/agents/{agent}/tools/{tool} * - transitionRouteGroup: projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group} * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} * diff --git a/DialogflowCx/src/V3/Client/WebhooksClient.php b/DialogflowCx/src/V3/Client/WebhooksClient.php index 4ac5c13254f8..de7e7f4443e1 100644 --- a/DialogflowCx/src/V3/Client/WebhooksClient.php +++ b/DialogflowCx/src/V3/Client/WebhooksClient.php @@ -133,6 +133,25 @@ public static function agentName(string $project, string $location, string $agen ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * secret_version resource. + * + * @param string $project + * @param string $secret + * @param string $version + * + * @return string The formatted secret_version resource. + */ + public static function secretVersionName(string $project, string $secret, string $version): string + { + return self::getPathTemplate('secretVersion')->render([ + 'project' => $project, + 'secret' => $secret, + 'version' => $version, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a service * resource. @@ -180,6 +199,7 @@ public static function webhookName(string $project, string $location, string $ag * The following name formats are supported: * Template: Pattern * - agent: projects/{project}/locations/{location}/agents/{agent} + * - secretVersion: projects/{project}/secrets/{secret}/versions/{version} * - service: projects/{project}/locations/{location}/namespaces/{namespace}/services/{service} * - webhook: projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook} * diff --git a/DialogflowCx/src/V3/CodeBlock.php b/DialogflowCx/src/V3/CodeBlock.php new file mode 100644 index 000000000000..9c1d8ffa995e --- /dev/null +++ b/DialogflowCx/src/V3/CodeBlock.php @@ -0,0 +1,67 @@ +google.cloud.dialogflow.cx.v3.CodeBlock + */ +class CodeBlock extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Source code of the block in Python. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $code + * Optional. Source code of the block in Python. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\CodeBlock::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Source code of the block in Python. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Optional. Source code of the block in Python. + * + * Generated from protobuf field string code = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCode($var) + { + GPBUtil::checkString($var, True); + $this->code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateExampleRequest.php b/DialogflowCx/src/V3/CreateExampleRequest.php new file mode 100644 index 000000000000..736e871e372f --- /dev/null +++ b/DialogflowCx/src/V3/CreateExampleRequest.php @@ -0,0 +1,138 @@ +google.cloud.dialogflow.cx.v3.CreateExampleRequest + */ +class CreateExampleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The playbook to create an example for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The example to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Example example = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $example = null; + + /** + * @param string $parent Required. The playbook to create an example for. + * Format: + * `projects//locations//agents//playbooks/`. Please see + * {@see ExamplesClient::playbookName()} for help formatting this field. + * @param \Google\Cloud\Dialogflow\Cx\V3\Example $example Required. The example to create. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\CreateExampleRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dialogflow\Cx\V3\Example $example): self + { + return (new self()) + ->setParent($parent) + ->setExample($example); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The playbook to create an example for. + * Format: + * `projects//locations//agents//playbooks/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Example $example + * Required. The example to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Example::initOnce(); + parent::__construct($data); + } + + /** + * Required. The playbook to create an example for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The playbook to create an example for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The example to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Example example = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Example|null + */ + public function getExample() + { + return $this->example; + } + + public function hasExample() + { + return isset($this->example); + } + + public function clearExample() + { + unset($this->example); + } + + /** + * Required. The example to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Example example = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Example $var + * @return $this + */ + public function setExample($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Example::class); + $this->example = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreatePlaybookRequest.php b/DialogflowCx/src/V3/CreatePlaybookRequest.php new file mode 100644 index 000000000000..a923c01b8405 --- /dev/null +++ b/DialogflowCx/src/V3/CreatePlaybookRequest.php @@ -0,0 +1,133 @@ +google.cloud.dialogflow.cx.v3.CreatePlaybookRequest + */ +class CreatePlaybookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to create a playbook for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The playbook to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $playbook = null; + + /** + * @param string $parent Required. The agent to create a playbook for. + * Format: `projects//locations//agents/`. Please see + * {@see PlaybooksClient::agentName()} for help formatting this field. + * @param \Google\Cloud\Dialogflow\Cx\V3\Playbook $playbook Required. The playbook to create. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\CreatePlaybookRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dialogflow\Cx\V3\Playbook $playbook): self + { + return (new self()) + ->setParent($parent) + ->setPlaybook($playbook); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to create a playbook for. + * Format: `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Playbook $playbook + * Required. The playbook to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to create a playbook for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to create a playbook for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The playbook to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Playbook|null + */ + public function getPlaybook() + { + return $this->playbook; + } + + public function hasPlaybook() + { + return isset($this->playbook); + } + + public function clearPlaybook() + { + unset($this->playbook); + } + + /** + * Required. The playbook to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Playbook $var + * @return $this + */ + public function setPlaybook($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Playbook::class); + $this->playbook = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreatePlaybookVersionRequest.php b/DialogflowCx/src/V3/CreatePlaybookVersionRequest.php new file mode 100644 index 000000000000..bd79b5411443 --- /dev/null +++ b/DialogflowCx/src/V3/CreatePlaybookVersionRequest.php @@ -0,0 +1,138 @@ +google.cloud.dialogflow.cx.v3.CreatePlaybookVersionRequest + */ +class CreatePlaybookVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The playbook to create a version for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The playbook version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookVersion playbook_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $playbook_version = null; + + /** + * @param string $parent Required. The playbook to create a version for. + * Format: + * `projects//locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion $playbookVersion Required. The playbook version to create. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\CreatePlaybookVersionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion $playbookVersion): self + { + return (new self()) + ->setParent($parent) + ->setPlaybookVersion($playbookVersion); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The playbook to create a version for. + * Format: + * `projects//locations//agents//playbooks/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion $playbook_version + * Required. The playbook version to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The playbook to create a version for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The playbook to create a version for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The playbook version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookVersion playbook_version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion|null + */ + public function getPlaybookVersion() + { + return $this->playbook_version; + } + + public function hasPlaybookVersion() + { + return isset($this->playbook_version); + } + + public function clearPlaybookVersion() + { + unset($this->playbook_version); + } + + /** + * Required. The playbook version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookVersion playbook_version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion $var + * @return $this + */ + public function setPlaybookVersion($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion::class); + $this->playbook_version = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateToolRequest.php b/DialogflowCx/src/V3/CreateToolRequest.php new file mode 100644 index 000000000000..1f73c7a91b66 --- /dev/null +++ b/DialogflowCx/src/V3/CreateToolRequest.php @@ -0,0 +1,133 @@ +google.cloud.dialogflow.cx.v3.CreateToolRequest + */ +class CreateToolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to create a Tool for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The Tool to be created. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tool = null; + + /** + * @param string $parent Required. The agent to create a Tool for. + * Format: `projects//locations//agents/`. Please see + * {@see ToolsClient::agentName()} for help formatting this field. + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool $tool Required. The Tool to be created. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\CreateToolRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dialogflow\Cx\V3\Tool $tool): self + { + return (new self()) + ->setParent($parent) + ->setTool($tool); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to create a Tool for. + * Format: `projects//locations//agents/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool $tool + * Required. The Tool to be created. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to create a Tool for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to create a Tool for. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The Tool to be created. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool|null + */ + public function getTool() + { + return $this->tool; + } + + public function hasTool() + { + return isset($this->tool); + } + + public function clearTool() + { + unset($this->tool); + } + + /** + * Required. The Tool to be created. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool $var + * @return $this + */ + public function setTool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool::class); + $this->tool = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/CreateToolVersionRequest.php b/DialogflowCx/src/V3/CreateToolVersionRequest.php new file mode 100644 index 000000000000..18cff5e72d34 --- /dev/null +++ b/DialogflowCx/src/V3/CreateToolVersionRequest.php @@ -0,0 +1,140 @@ +google.cloud.dialogflow.cx.v3.CreateToolVersionRequest + */ +class CreateToolVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The tool to create a version for. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The tool version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolVersion tool_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tool_version = null; + + /** + * @param string $parent Required. The tool to create a version for. + * Format: + * `projects//locations//agents//tools/`. Please see + * {@see ToolsClient::toolName()} for help formatting this field. + * @param \Google\Cloud\Dialogflow\Cx\V3\ToolVersion $toolVersion Required. The tool version to create. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\CreateToolVersionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\Dialogflow\Cx\V3\ToolVersion $toolVersion): self + { + return (new self()) + ->setParent($parent) + ->setToolVersion($toolVersion); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The tool to create a version for. + * Format: + * `projects//locations//agents//tools/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\ToolVersion $tool_version + * Required. The tool version to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The tool to create a version for. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The tool to create a version for. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The tool version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolVersion tool_version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\ToolVersion|null + */ + public function getToolVersion() + { + return $this->tool_version; + } + + public function hasToolVersion() + { + return isset($this->tool_version); + } + + public function clearToolVersion() + { + unset($this->tool_version); + } + + /** + * Required. The tool version to create. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolVersion tool_version = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\ToolVersion $var + * @return $this + */ + public function setToolVersion($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ToolVersion::class); + $this->tool_version = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DataStoreConnectionSignals/SearchSnippet.php b/DialogflowCx/src/V3/DataStoreConnectionSignals/SearchSnippet.php index c4405d9227da..ff30426a2dbf 100644 --- a/DialogflowCx/src/V3/DataStoreConnectionSignals/SearchSnippet.php +++ b/DialogflowCx/src/V3/DataStoreConnectionSignals/SearchSnippet.php @@ -33,6 +33,12 @@ class SearchSnippet extends \Google\Protobuf\Internal\Message * Generated from protobuf field string text = 3; */ protected $text = ''; + /** + * Metadata associated with the document. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 5; + */ + protected $metadata = null; /** * Constructor. @@ -46,6 +52,8 @@ class SearchSnippet extends \Google\Protobuf\Internal\Message * Uri for the document. Present if specified for the document. * @type string $text * Text included in the prompt. + * @type \Google\Protobuf\Struct $metadata + * Metadata associated with the document. * } */ public function __construct($data = NULL) { @@ -131,6 +139,42 @@ public function setText($var) return $this; } + /** + * Metadata associated with the document. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 5; + * @return \Google\Protobuf\Struct|null + */ + public function getMetadata() + { + return $this->metadata; + } + + public function hasMetadata() + { + return isset($this->metadata); + } + + public function clearMetadata() + { + unset($this->metadata); + } + + /** + * Metadata associated with the document. + * + * Generated from protobuf field .google.protobuf.Struct metadata = 5; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->metadata = $var; + + return $this; + } + } diff --git a/DialogflowCx/src/V3/DataType.php b/DialogflowCx/src/V3/DataType.php new file mode 100644 index 000000000000..6cb0572c06cb --- /dev/null +++ b/DialogflowCx/src/V3/DataType.php @@ -0,0 +1,80 @@ +google.cloud.dialogflow.cx.v3.DataType + */ +class DataType +{ + /** + * Not specified. + * + * Generated from protobuf enum DATA_TYPE_UNSPECIFIED = 0; + */ + const DATA_TYPE_UNSPECIFIED = 0; + /** + * Represents any string value. + * + * Generated from protobuf enum STRING = 1; + */ + const STRING = 1; + /** + * Represents any number value. + * + * Generated from protobuf enum NUMBER = 2; + */ + const NUMBER = 2; + /** + * Represents a boolean value. + * + * Generated from protobuf enum BOOLEAN = 3; + */ + const BOOLEAN = 3; + /** + * Represents a repeated value. + * + * Generated from protobuf enum ARRAY = 6; + */ + const PBARRAY = 6; + + private static $valueToName = [ + self::DATA_TYPE_UNSPECIFIED => 'DATA_TYPE_UNSPECIFIED', + self::STRING => 'STRING', + self::NUMBER => 'NUMBER', + self::BOOLEAN => 'BOOLEAN', + self::PBARRAY => 'ARRAY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + diff --git a/DialogflowCx/src/V3/DeleteExampleRequest.php b/DialogflowCx/src/V3/DeleteExampleRequest.php new file mode 100644 index 000000000000..69db81da243b --- /dev/null +++ b/DialogflowCx/src/V3/DeleteExampleRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.DeleteExampleRequest + */ +class DeleteExampleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the example to delete. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the example to delete. + * Format: + * `projects//locations//agents//playbooks//examples/`. Please see + * {@see ExamplesClient::exampleName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\DeleteExampleRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the example to delete. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Example::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the example to delete. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * 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 example to delete. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeletePlaybookRequest.php b/DialogflowCx/src/V3/DeletePlaybookRequest.php new file mode 100644 index 000000000000..f9fff61f2d2e --- /dev/null +++ b/DialogflowCx/src/V3/DeletePlaybookRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.DeletePlaybookRequest + */ +class DeletePlaybookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the playbook to delete. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the playbook to delete. + * Format: + * `projects//locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\DeletePlaybookRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the playbook to delete. + * Format: + * `projects//locations//agents//playbooks/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the playbook to delete. + * Format: + * `projects//locations//agents//playbooks/`. + * + * 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 playbook to delete. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeletePlaybookVersionRequest.php b/DialogflowCx/src/V3/DeletePlaybookVersionRequest.php new file mode 100644 index 000000000000..bf26f312f44a --- /dev/null +++ b/DialogflowCx/src/V3/DeletePlaybookVersionRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.DeletePlaybookVersionRequest + */ +class DeletePlaybookVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the playbook version to delete. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the playbook version to delete. + * Format: + * `projects//locations//agents//playbooks//versions/`. Please see + * {@see PlaybooksClient::playbookVersionName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\DeletePlaybookVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the playbook version to delete. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the playbook version to delete. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the playbook version to delete. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteToolRequest.php b/DialogflowCx/src/V3/DeleteToolRequest.php new file mode 100644 index 000000000000..4a93d8242490 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteToolRequest.php @@ -0,0 +1,146 @@ +google.cloud.dialogflow.cx.v3.DeleteToolRequest + */ +class DeleteToolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the Tool to be deleted. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * This field has no effect for Tools not being used. + * For Tools that are used: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the tool, as well + * as any references to the tool. + * + * Generated from protobuf field bool force = 2; + */ + protected $force = false; + + /** + * @param string $name Required. The name of the Tool to be deleted. + * Format: + * `projects//locations//agents//tools/`. Please see + * {@see ToolsClient::toolName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\DeleteToolRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the Tool to be deleted. + * Format: + * `projects//locations//agents//tools/`. + * @type bool $force + * This field has no effect for Tools not being used. + * For Tools that are used: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the tool, as well + * as any references to the tool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the Tool to be deleted. + * Format: + * `projects//locations//agents//tools/`. + * + * 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 Tool to be deleted. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * This field has no effect for Tools not being used. + * For Tools that are used: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the tool, as well + * as any references to the tool. + * + * Generated from protobuf field bool force = 2; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * This field has no effect for Tools not being used. + * For Tools that are used: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the tool, as well + * as any references to the tool. + * + * Generated from protobuf field bool force = 2; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DeleteToolVersionRequest.php b/DialogflowCx/src/V3/DeleteToolVersionRequest.php new file mode 100644 index 000000000000..1a04d5fdf4b5 --- /dev/null +++ b/DialogflowCx/src/V3/DeleteToolVersionRequest.php @@ -0,0 +1,146 @@ +google.cloud.dialogflow.cx.v3.DeleteToolVersionRequest + */ +class DeleteToolVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the tool version to delete. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. This field has no effect for Tools not being used. + * For Tools that are used: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the tool, as well + * as any references to the tool. + * + * Generated from protobuf field bool force = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $force = false; + + /** + * @param string $name Required. The name of the tool version to delete. + * Format: + * `projects//locations//agents//tools//versions/`. Please see + * {@see ToolsClient::toolVersionName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\DeleteToolVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the tool version to delete. + * Format: + * `projects//locations//agents//tools//versions/`. + * @type bool $force + * Optional. This field has no effect for Tools not being used. + * For Tools that are used: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the tool, as well + * as any references to the tool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the tool version to delete. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the tool version to delete. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. This field has no effect for Tools not being used. + * For Tools that are used: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the tool, as well + * as any references to the tool. + * + * Generated from protobuf field bool force = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getForce() + { + return $this->force; + } + + /** + * Optional. This field has no effect for Tools not being used. + * For Tools that are used: + * * If `force` is set to false, an error will be returned with message + * indicating the referenced resources. + * * If `force` is set to true, Dialogflow will remove the tool, as well + * as any references to the tool. + * + * Generated from protobuf field bool force = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setForce($var) + { + GPBUtil::checkBool($var); + $this->force = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/DetectIntentRequest.php b/DialogflowCx/src/V3/DetectIntentRequest.php index 315fa48ec970..7bf17368cf56 100644 --- a/DialogflowCx/src/V3/DetectIntentRequest.php +++ b/DialogflowCx/src/V3/DetectIntentRequest.php @@ -53,6 +53,14 @@ class DetectIntentRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputAudioConfig output_audio_config = 4; */ protected $output_audio_config = null; + /** + * Optional. Specifies which fields in the + * [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] to return. If not + * set, the default is DETECT_INTENT_RESPONSE_VIEW_FULL. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponseView response_view = 9 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $response_view = 0; /** * Constructor. @@ -82,6 +90,10 @@ class DetectIntentRequest extends \Google\Protobuf\Internal\Message * Required. The input specification. * @type \Google\Cloud\Dialogflow\Cx\V3\OutputAudioConfig $output_audio_config * Instructs the speech synthesizer how to generate the output audio. + * @type int $response_view + * Optional. Specifies which fields in the + * [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] to return. If not + * set, the default is DETECT_INTENT_RESPONSE_VIEW_FULL. * } */ public function __construct($data = NULL) { @@ -251,5 +263,35 @@ public function setOutputAudioConfig($var) return $this; } + /** + * Optional. Specifies which fields in the + * [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] to return. If not + * set, the default is DETECT_INTENT_RESPONSE_VIEW_FULL. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponseView response_view = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getResponseView() + { + return $this->response_view; + } + + /** + * Optional. Specifies which fields in the + * [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] to return. If not + * set, the default is DETECT_INTENT_RESPONSE_VIEW_FULL. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponseView response_view = 9 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setResponseView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\DetectIntentResponseView::class); + $this->response_view = $var; + + return $this; + } + } diff --git a/DialogflowCx/src/V3/DetectIntentResponseView.php b/DialogflowCx/src/V3/DetectIntentResponseView.php new file mode 100644 index 000000000000..694f0dc28982 --- /dev/null +++ b/DialogflowCx/src/V3/DetectIntentResponseView.php @@ -0,0 +1,73 @@ +google.cloud.dialogflow.cx.v3.DetectIntentResponseView + */ +class DetectIntentResponseView +{ + /** + * Not specified. `DETECT_INTENT_RESPONSE_VIEW_DEFAULT` will be used. + * + * Generated from protobuf enum DETECT_INTENT_RESPONSE_VIEW_UNSPECIFIED = 0; + */ + const DETECT_INTENT_RESPONSE_VIEW_UNSPECIFIED = 0; + /** + * Full response view includes all fields. + * + * Generated from protobuf enum DETECT_INTENT_RESPONSE_VIEW_FULL = 1; + */ + const DETECT_INTENT_RESPONSE_VIEW_FULL = 1; + /** + * Basic response view omits the following fields: + * - + * [QueryResult.diagnostic_info][google.cloud.dialogflow.cx.v3.QueryResult.diagnostic_info] + * + * Generated from protobuf enum DETECT_INTENT_RESPONSE_VIEW_BASIC = 2; + */ + const DETECT_INTENT_RESPONSE_VIEW_BASIC = 2; + /** + * Default response view omits the following fields: + * - + * [QueryResult.trace_blocks][google.cloud.dialogflow.cx.v3.QueryResult.trace_blocks] + * + * Generated from protobuf enum DETECT_INTENT_RESPONSE_VIEW_DEFAULT = 3; + */ + const DETECT_INTENT_RESPONSE_VIEW_DEFAULT = 3; + + private static $valueToName = [ + self::DETECT_INTENT_RESPONSE_VIEW_UNSPECIFIED => 'DETECT_INTENT_RESPONSE_VIEW_UNSPECIFIED', + self::DETECT_INTENT_RESPONSE_VIEW_FULL => 'DETECT_INTENT_RESPONSE_VIEW_FULL', + self::DETECT_INTENT_RESPONSE_VIEW_BASIC => 'DETECT_INTENT_RESPONSE_VIEW_BASIC', + self::DETECT_INTENT_RESPONSE_VIEW_DEFAULT => 'DETECT_INTENT_RESPONSE_VIEW_DEFAULT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DialogflowCx/src/V3/Environment/VersionConfig.php b/DialogflowCx/src/V3/Environment/VersionConfig.php index e0000ec78bc0..bd163a6bf6a3 100644 --- a/DialogflowCx/src/V3/Environment/VersionConfig.php +++ b/DialogflowCx/src/V3/Environment/VersionConfig.php @@ -16,11 +16,13 @@ class VersionConfig extends \Google\Protobuf\Internal\Message { /** - * Required. Both flow and playbook versions are supported. + * Required. Flow, playbook and tool versions are supported. * Format for flow version: * projects//locations//agents//flows//versions/. * Format for playbook version: * projects//locations//agents//playbooks//versions/. + * Format for tool version: + * projects//locations//agents//tools//versions/. * * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -33,11 +35,13 @@ class VersionConfig extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $version - * Required. Both flow and playbook versions are supported. + * Required. Flow, playbook and tool versions are supported. * Format for flow version: * projects//locations//agents//flows//versions/. * Format for playbook version: * projects//locations//agents//playbooks//versions/. + * Format for tool version: + * projects//locations//agents//tools//versions/. * } */ public function __construct($data = NULL) { @@ -46,11 +50,13 @@ public function __construct($data = NULL) { } /** - * Required. Both flow and playbook versions are supported. + * Required. Flow, playbook and tool versions are supported. * Format for flow version: * projects//locations//agents//flows//versions/. * Format for playbook version: * projects//locations//agents//playbooks//versions/. + * Format for tool version: + * projects//locations//agents//tools//versions/. * * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -61,11 +67,13 @@ public function getVersion() } /** - * Required. Both flow and playbook versions are supported. + * Required. Flow, playbook and tool versions are supported. * Format for flow version: * projects//locations//agents//flows//versions/. * Format for playbook version: * projects//locations//agents//playbooks//versions/. + * Format for tool version: + * projects//locations//agents//tools//versions/. * * Generated from protobuf field string version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var diff --git a/DialogflowCx/src/V3/EventHandler.php b/DialogflowCx/src/V3/EventHandler.php index 32c60215e66b..69dc1970bcfc 100644 --- a/DialogflowCx/src/V3/EventHandler.php +++ b/DialogflowCx/src/V3/EventHandler.php @@ -75,6 +75,10 @@ class EventHandler extends \Google\Protobuf\Internal\Message * The target flow to transition to. * Format: * `projects//locations//agents//flows/`. + * @type string $target_playbook + * The target playbook to transition to. + * Format: + * `projects//locations//agents//playbooks/`. * } */ public function __construct($data = NULL) { @@ -246,6 +250,41 @@ public function setTargetFlow($var) return $this; } + /** + * The target playbook to transition to. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string target_playbook = 7 [(.google.api.resource_reference) = { + * @return string + */ + public function getTargetPlaybook() + { + return $this->readOneof(7); + } + + public function hasTargetPlaybook() + { + return $this->hasOneof(7); + } + + /** + * The target playbook to transition to. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string target_playbook = 7 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTargetPlaybook($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(7, $var); + + return $this; + } + /** * @return string */ diff --git a/DialogflowCx/src/V3/Example.php b/DialogflowCx/src/V3/Example.php new file mode 100644 index 000000000000..6d4ee67a9e6b --- /dev/null +++ b/DialogflowCx/src/V3/Example.php @@ -0,0 +1,481 @@ +google.cloud.dialogflow.cx.v3.Example + */ +class Example extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the playbook example. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Optional. The input to the playbook in the example. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookInput playbook_input = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $playbook_input = null; + /** + * Optional. The output of the playbook in the example. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookOutput playbook_output = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $playbook_output = null; + /** + * Required. The ordered list of actions performed by the end user and the + * Dialogflow agent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Action actions = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private $actions; + /** + * Required. The display name of the example. + * + * Generated from protobuf field string display_name = 6 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Optional. The high level concise description of the example. The max number + * of characters is 200. + * + * Generated from protobuf field string description = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Output only. Estimated number of tokes current example takes when sent to + * the LLM. + * + * Generated from protobuf field int64 token_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $token_count = 0; + /** + * Output only. The timestamp of initial example creation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last time the example was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Required. Example's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState conversation_state = 12 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $conversation_state = 0; + /** + * Optional. The language code of the example. + * If not specified, the agent's default language is used. + * Note: languages must be enabled in the agent before they can be used. + * Note: example's language code is not currently used in dialogflow agents. + * + * Generated from protobuf field string language_code = 13 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $language_code = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the playbook example. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\PlaybookInput $playbook_input + * Optional. The input to the playbook in the example. + * @type \Google\Cloud\Dialogflow\Cx\V3\PlaybookOutput $playbook_output + * Optional. The output of the playbook in the example. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Action>|\Google\Protobuf\Internal\RepeatedField $actions + * Required. The ordered list of actions performed by the end user and the + * Dialogflow agent. + * @type string $display_name + * Required. The display name of the example. + * @type string $description + * Optional. The high level concise description of the example. The max number + * of characters is 200. + * @type int|string $token_count + * Output only. Estimated number of tokes current example takes when sent to + * the LLM. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp of initial example creation. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last time the example was updated. + * @type int $conversation_state + * Required. Example's output state. + * @type string $language_code + * Optional. The language code of the example. + * If not specified, the agent's default language is used. + * Note: languages must be enabled in the agent before they can be used. + * Note: example's language code is not currently used in dialogflow agents. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Example::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the playbook example. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the playbook example. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The input to the playbook in the example. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookInput playbook_input = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\PlaybookInput|null + */ + public function getPlaybookInput() + { + return $this->playbook_input; + } + + public function hasPlaybookInput() + { + return isset($this->playbook_input); + } + + public function clearPlaybookInput() + { + unset($this->playbook_input); + } + + /** + * Optional. The input to the playbook in the example. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookInput playbook_input = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookInput $var + * @return $this + */ + public function setPlaybookInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PlaybookInput::class); + $this->playbook_input = $var; + + return $this; + } + + /** + * Optional. The output of the playbook in the example. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookOutput playbook_output = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\PlaybookOutput|null + */ + public function getPlaybookOutput() + { + return $this->playbook_output; + } + + public function hasPlaybookOutput() + { + return isset($this->playbook_output); + } + + public function clearPlaybookOutput() + { + unset($this->playbook_output); + } + + /** + * Optional. The output of the playbook in the example. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookOutput playbook_output = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookOutput $var + * @return $this + */ + public function setPlaybookOutput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PlaybookOutput::class); + $this->playbook_output = $var; + + return $this; + } + + /** + * Required. The ordered list of actions performed by the end user and the + * Dialogflow agent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Action actions = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getActions() + { + return $this->actions; + } + + /** + * Required. The ordered list of actions performed by the end user and the + * Dialogflow agent. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Action actions = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Action>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Action::class); + $this->actions = $arr; + + return $this; + } + + /** + * Required. The display name of the example. + * + * Generated from protobuf field string display_name = 6 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The display name of the example. + * + * Generated from protobuf field string display_name = 6 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Optional. The high level concise description of the example. The max number + * of characters is 200. + * + * Generated from protobuf field string description = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. The high level concise description of the example. The max number + * of characters is 200. + * + * Generated from protobuf field string description = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. Estimated number of tokes current example takes when sent to + * the LLM. + * + * Generated from protobuf field int64 token_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getTokenCount() + { + return $this->token_count; + } + + /** + * Output only. Estimated number of tokes current example takes when sent to + * the LLM. + * + * Generated from protobuf field int64 token_count = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setTokenCount($var) + { + GPBUtil::checkInt64($var); + $this->token_count = $var; + + return $this; + } + + /** + * Output only. The timestamp of initial example creation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp of initial example creation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last time the example was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last time the example was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Required. Example's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState conversation_state = 12 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getConversationState() + { + return $this->conversation_state; + } + + /** + * Required. Example's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState conversation_state = 12 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setConversationState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\OutputState::class); + $this->conversation_state = $var; + + return $this; + } + + /** + * Optional. The language code of the example. + * If not specified, the agent's default language is used. + * Note: languages must be enabled in the agent before they can be used. + * Note: example's language code is not currently used in dialogflow agents. + * + * Generated from protobuf field string language_code = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Optional. The language code of the example. + * If not specified, the agent's default language is used. + * Note: languages must be enabled in the agent before they can be used. + * Note: example's language code is not currently used in dialogflow agents. + * + * Generated from protobuf field string language_code = 13 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ExportPlaybookRequest.php b/DialogflowCx/src/V3/ExportPlaybookRequest.php new file mode 100644 index 000000000000..4a6094668946 --- /dev/null +++ b/DialogflowCx/src/V3/ExportPlaybookRequest.php @@ -0,0 +1,180 @@ +google.cloud.dialogflow.cx.v3.ExportPlaybookRequest + */ +class ExportPlaybookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the playbook to export. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the playbook + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized playbook is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string playbook_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $playbook_uri = ''; + /** + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportPlaybookRequest.DataFormat data_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $data_format = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the playbook to export. + * Format: + * `projects//locations//agents//playbooks/`. + * @type string $playbook_uri + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the playbook + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized playbook is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type int $data_format + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the playbook to export. + * Format: + * `projects//locations//agents//playbooks/`. + * + * 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 playbook to export. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the playbook + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized playbook is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string playbook_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPlaybookUri() + { + return $this->playbook_uri; + } + + /** + * Optional. The [Google Cloud + * Storage](https://cloud.google.com/storage/docs/) URI to export the playbook + * to. The format of this URI must be `gs:///`. If + * left unspecified, the serialized playbook is returned inline. + * Dialogflow performs a write operation for the Cloud Storage object + * on the caller's behalf, so your request authentication must + * have write permissions for the object. For more information, see + * [Dialogflow access + * control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string playbook_uri = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPlaybookUri($var) + { + GPBUtil::checkString($var, True); + $this->playbook_uri = $var; + + return $this; + } + + /** + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportPlaybookRequest.DataFormat data_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDataFormat() + { + return $this->data_format; + } + + /** + * Optional. The data format of the exported agent. If not specified, `BLOB` + * is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ExportPlaybookRequest.DataFormat data_format = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDataFormat($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ExportPlaybookRequest\DataFormat::class); + $this->data_format = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ExportPlaybookRequest/DataFormat.php b/DialogflowCx/src/V3/ExportPlaybookRequest/DataFormat.php new file mode 100644 index 000000000000..9f7cb410ec05 --- /dev/null +++ b/DialogflowCx/src/V3/ExportPlaybookRequest/DataFormat.php @@ -0,0 +1,62 @@ +google.cloud.dialogflow.cx.v3.ExportPlaybookRequest.DataFormat + */ +class DataFormat +{ + /** + * Unspecified format. + * + * Generated from protobuf enum DATA_FORMAT_UNSPECIFIED = 0; + */ + const DATA_FORMAT_UNSPECIFIED = 0; + /** + * Flow content will be exported as raw bytes. + * + * Generated from protobuf enum BLOB = 1; + */ + const BLOB = 1; + /** + * Flow content will be exported in JSON format. + * + * Generated from protobuf enum JSON = 2; + */ + const JSON = 2; + + private static $valueToName = [ + self::DATA_FORMAT_UNSPECIFIED => 'DATA_FORMAT_UNSPECIFIED', + self::BLOB => 'BLOB', + self::JSON => 'JSON', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ExportPlaybookResponse.php b/DialogflowCx/src/V3/ExportPlaybookResponse.php new file mode 100644 index 000000000000..52e8c73e1ac4 --- /dev/null +++ b/DialogflowCx/src/V3/ExportPlaybookResponse.php @@ -0,0 +1,115 @@ +google.cloud.dialogflow.cx.v3.ExportPlaybookResponse + */ +class ExportPlaybookResponse extends \Google\Protobuf\Internal\Message +{ + protected $playbook; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $playbook_uri + * The URI to a file containing the exported playbook. This field is + * populated only if `playbook_uri` is specified in + * [ExportPlaybookRequest][google.cloud.dialogflow.cx.v3.ExportPlaybookRequest]. + * @type string $playbook_content + * Uncompressed raw byte content for playbook. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * The URI to a file containing the exported playbook. This field is + * populated only if `playbook_uri` is specified in + * [ExportPlaybookRequest][google.cloud.dialogflow.cx.v3.ExportPlaybookRequest]. + * + * Generated from protobuf field string playbook_uri = 1; + * @return string + */ + public function getPlaybookUri() + { + return $this->readOneof(1); + } + + public function hasPlaybookUri() + { + return $this->hasOneof(1); + } + + /** + * The URI to a file containing the exported playbook. This field is + * populated only if `playbook_uri` is specified in + * [ExportPlaybookRequest][google.cloud.dialogflow.cx.v3.ExportPlaybookRequest]. + * + * Generated from protobuf field string playbook_uri = 1; + * @param string $var + * @return $this + */ + public function setPlaybookUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Uncompressed raw byte content for playbook. + * + * Generated from protobuf field bytes playbook_content = 2; + * @return string + */ + public function getPlaybookContent() + { + return $this->readOneof(2); + } + + public function hasPlaybookContent() + { + return $this->hasOneof(2); + } + + /** + * Uncompressed raw byte content for playbook. + * + * Generated from protobuf field bytes playbook_content = 2; + * @param string $var + * @return $this + */ + public function setPlaybookContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getPlaybook() + { + return $this->whichOneof("playbook"); + } + +} + diff --git a/DialogflowCx/src/V3/Flow.php b/DialogflowCx/src/V3/Flow.php index cf97dba80ab6..f2e0f44fc815 100644 --- a/DialogflowCx/src/V3/Flow.php +++ b/DialogflowCx/src/V3/Flow.php @@ -115,6 +115,18 @@ class Flow extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.dialogflow.cx.v3.KnowledgeConnectorSettings knowledge_connector_settings = 18 [(.google.api.field_behavior) = OPTIONAL]; */ protected $knowledge_connector_settings = null; + /** + * Optional. Defined structured input parameters for this flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition input_parameter_definitions = 26 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $input_parameter_definitions; + /** + * Optional. Defined structured output parameters for this flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition output_parameter_definitions = 27 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $output_parameter_definitions; /** * Optional. Multi-lingual agent settings for this flow. * @@ -188,6 +200,10 @@ class Flow extends \Google\Protobuf\Internal\Message * lower level overrides the settings exposed at the higher level. * @type \Google\Cloud\Dialogflow\Cx\V3\KnowledgeConnectorSettings $knowledge_connector_settings * Optional. Knowledge connector configuration. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition>|\Google\Protobuf\Internal\RepeatedField $input_parameter_definitions + * Optional. Defined structured input parameters for this flow. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition>|\Google\Protobuf\Internal\RepeatedField $output_parameter_definitions + * Optional. Defined structured output parameters for this flow. * @type \Google\Cloud\Dialogflow\Cx\V3\Flow\MultiLanguageSettings $multi_language_settings * Optional. Multi-lingual agent settings for this flow. * @type bool $locked @@ -534,6 +550,58 @@ public function setKnowledgeConnectorSettings($var) return $this; } + /** + * Optional. Defined structured input parameters for this flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition input_parameter_definitions = 26 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputParameterDefinitions() + { + return $this->input_parameter_definitions; + } + + /** + * Optional. Defined structured input parameters for this flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition input_parameter_definitions = 26 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputParameterDefinitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition::class); + $this->input_parameter_definitions = $arr; + + return $this; + } + + /** + * Optional. Defined structured output parameters for this flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition output_parameter_definitions = 27 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOutputParameterDefinitions() + { + return $this->output_parameter_definitions; + } + + /** + * Optional. Defined structured output parameters for this flow. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition output_parameter_definitions = 27 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOutputParameterDefinitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition::class); + $this->output_parameter_definitions = $arr; + + return $this; + } + /** * Optional. Multi-lingual agent settings for this flow. * diff --git a/DialogflowCx/src/V3/FlowInvocation.php b/DialogflowCx/src/V3/FlowInvocation.php new file mode 100644 index 000000000000..678f25173aae --- /dev/null +++ b/DialogflowCx/src/V3/FlowInvocation.php @@ -0,0 +1,143 @@ +google.cloud.dialogflow.cx.v3.FlowInvocation + */ +class FlowInvocation extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique identifier of the flow. + * Format: + * `projects//locations//agents//flows/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $flow = ''; + /** + * Output only. The display name of the flow. + * + * Generated from protobuf field string display_name = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + /** + * Required. Flow invocation's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState flow_state = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $flow_state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $flow + * Required. The unique identifier of the flow. + * Format: + * `projects//locations//agents//flows/`. + * @type string $display_name + * Output only. The display name of the flow. + * @type int $flow_state + * Required. Flow invocation's output state. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique identifier of the flow. + * Format: + * `projects//locations//agents//flows/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getFlow() + { + return $this->flow; + } + + /** + * Required. The unique identifier of the flow. + * Format: + * `projects//locations//agents//flows/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setFlow($var) + { + GPBUtil::checkString($var, True); + $this->flow = $var; + + return $this; + } + + /** + * Output only. The display name of the flow. + * + * Generated from protobuf field string display_name = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. The display name of the flow. + * + * Generated from protobuf field string display_name = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. Flow invocation's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState flow_state = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getFlowState() + { + return $this->flow_state; + } + + /** + * Required. Flow invocation's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState flow_state = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setFlowState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\OutputState::class); + $this->flow_state = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/FlowTransition.php b/DialogflowCx/src/V3/FlowTransition.php new file mode 100644 index 000000000000..2f6c7f05d2ad --- /dev/null +++ b/DialogflowCx/src/V3/FlowTransition.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.FlowTransition + */ +class FlowTransition extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique identifier of the flow. + * Format: + * `projects//locations//agents/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $flow = ''; + /** + * Output only. The display name of the flow. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $flow + * Required. The unique identifier of the flow. + * Format: + * `projects//locations//agents/`. + * @type string $display_name + * Output only. The display name of the flow. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique identifier of the flow. + * Format: + * `projects//locations//agents/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getFlow() + { + return $this->flow; + } + + /** + * Required. The unique identifier of the flow. + * Format: + * `projects//locations//agents/`. + * + * Generated from protobuf field string flow = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setFlow($var) + { + GPBUtil::checkString($var, True); + $this->flow = $var; + + return $this; + } + + /** + * Output only. The display name of the flow. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. The display name of the flow. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GenerativeSettings.php b/DialogflowCx/src/V3/GenerativeSettings.php index bfb64503e0b8..6d92099d4244 100644 --- a/DialogflowCx/src/V3/GenerativeSettings.php +++ b/DialogflowCx/src/V3/GenerativeSettings.php @@ -46,6 +46,12 @@ class GenerativeSettings extends \Google\Protobuf\Internal\Message * Generated from protobuf field string language_code = 4; */ protected $language_code = ''; + /** + * LLM model settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 8; + */ + protected $llm_model_settings = null; /** * Constructor. @@ -64,6 +70,8 @@ class GenerativeSettings extends \Google\Protobuf\Internal\Message * Settings for knowledge connector. * @type string $language_code * Language for this settings. + * @type \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings $llm_model_settings + * LLM model settings. * } */ public function __construct($data = NULL) { @@ -233,5 +241,41 @@ public function setLanguageCode($var) return $this; } + /** + * LLM model settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 8; + * @return \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings|null + */ + public function getLlmModelSettings() + { + return $this->llm_model_settings; + } + + public function hasLlmModelSettings() + { + return isset($this->llm_model_settings); + } + + public function clearLlmModelSettings() + { + unset($this->llm_model_settings); + } + + /** + * LLM model settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 8; + * @param \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings $var + * @return $this + */ + public function setLlmModelSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings::class); + $this->llm_model_settings = $var; + + return $this; + } + } diff --git a/DialogflowCx/src/V3/Generator.php b/DialogflowCx/src/V3/Generator.php index 7068ad70c839..4dbfcbb0f94e 100644 --- a/DialogflowCx/src/V3/Generator.php +++ b/DialogflowCx/src/V3/Generator.php @@ -50,6 +50,12 @@ class Generator extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Generator.Placeholder placeholders = 5 [(.google.api.field_behavior) = OPTIONAL]; */ private $placeholders; + /** + * The LLM model settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 9; + */ + protected $llm_model_settings = null; /** * Parameters passed to the LLM to configure its behavior. * @@ -79,6 +85,8 @@ class Generator extends \Google\Protobuf\Internal\Message * Required. Prompt for the LLM model. * @type array<\Google\Cloud\Dialogflow\Cx\V3\Generator\Placeholder>|\Google\Protobuf\Internal\RepeatedField $placeholders * Optional. List of custom placeholders in the prompt text. + * @type \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings $llm_model_settings + * The LLM model settings. * @type \Google\Cloud\Dialogflow\Cx\V3\Generator\ModelParameter $model_parameter * Parameters passed to the LLM to configure its behavior. * } @@ -218,6 +226,42 @@ public function setPlaceholders($var) return $this; } + /** + * The LLM model settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 9; + * @return \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings|null + */ + public function getLlmModelSettings() + { + return $this->llm_model_settings; + } + + public function hasLlmModelSettings() + { + return isset($this->llm_model_settings); + } + + public function clearLlmModelSettings() + { + unset($this->llm_model_settings); + } + + /** + * The LLM model settings. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 9; + * @param \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings $var + * @return $this + */ + public function setLlmModelSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings::class); + $this->llm_model_settings = $var; + + return $this; + } + /** * Parameters passed to the LLM to configure its behavior. * diff --git a/DialogflowCx/src/V3/GetExampleRequest.php b/DialogflowCx/src/V3/GetExampleRequest.php new file mode 100644 index 000000000000..f7e3a3fe3233 --- /dev/null +++ b/DialogflowCx/src/V3/GetExampleRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.GetExampleRequest + */ +class GetExampleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the example. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the example. + * Format: + * `projects//locations//agents//playbooks//examples/`. Please see + * {@see ExamplesClient::exampleName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\GetExampleRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the example. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Example::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the example. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * 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 example. + * Format: + * `projects//locations//agents//playbooks//examples/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetPlaybookRequest.php b/DialogflowCx/src/V3/GetPlaybookRequest.php new file mode 100644 index 000000000000..c93817eb03ab --- /dev/null +++ b/DialogflowCx/src/V3/GetPlaybookRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.GetPlaybookRequest + */ +class GetPlaybookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\GetPlaybookRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * 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 playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetPlaybookVersionRequest.php b/DialogflowCx/src/V3/GetPlaybookVersionRequest.php new file mode 100644 index 000000000000..e6d613fda3a3 --- /dev/null +++ b/DialogflowCx/src/V3/GetPlaybookVersionRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.GetPlaybookVersionRequest + */ +class GetPlaybookVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. Please see + * {@see PlaybooksClient::playbookVersionName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\GetPlaybookVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetToolRequest.php b/DialogflowCx/src/V3/GetToolRequest.php new file mode 100644 index 000000000000..06cadfc85c51 --- /dev/null +++ b/DialogflowCx/src/V3/GetToolRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.GetToolRequest + */ +class GetToolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the Tool. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the Tool. + * Format: + * `projects//locations//agents//tools/`. Please see + * {@see ToolsClient::toolName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\GetToolRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the Tool. + * Format: + * `projects//locations//agents//tools/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the Tool. + * Format: + * `projects//locations//agents//tools/`. + * + * 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 Tool. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/GetToolVersionRequest.php b/DialogflowCx/src/V3/GetToolVersionRequest.php new file mode 100644 index 000000000000..5ae8cf8eb87e --- /dev/null +++ b/DialogflowCx/src/V3/GetToolVersionRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.GetToolVersionRequest + */ +class GetToolVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. Please see + * {@see ToolsClient::toolVersionName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\GetToolVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Handler.php b/DialogflowCx/src/V3/Handler.php new file mode 100644 index 000000000000..1fd220a2f67a --- /dev/null +++ b/DialogflowCx/src/V3/Handler.php @@ -0,0 +1,109 @@ +google.cloud.dialogflow.cx.v3.Handler + */ +class Handler extends \Google\Protobuf\Internal\Message +{ + protected $handler; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Handler\EventHandler $event_handler + * A handler triggered by event. + * @type \Google\Cloud\Dialogflow\Cx\V3\Handler\LifecycleHandler $lifecycle_handler + * A handler triggered during specific lifecycle of the playbook execution. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * A handler triggered by event. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Handler.EventHandler event_handler = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\Handler\EventHandler|null + */ + public function getEventHandler() + { + return $this->readOneof(1); + } + + public function hasEventHandler() + { + return $this->hasOneof(1); + } + + /** + * A handler triggered by event. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Handler.EventHandler event_handler = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\Handler\EventHandler $var + * @return $this + */ + public function setEventHandler($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Handler\EventHandler::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * A handler triggered during specific lifecycle of the playbook execution. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Handler.LifecycleHandler lifecycle_handler = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\Handler\LifecycleHandler|null + */ + public function getLifecycleHandler() + { + return $this->readOneof(3); + } + + public function hasLifecycleHandler() + { + return $this->hasOneof(3); + } + + /** + * A handler triggered during specific lifecycle of the playbook execution. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Handler.LifecycleHandler lifecycle_handler = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\Handler\LifecycleHandler $var + * @return $this + */ + public function setLifecycleHandler($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Handler\LifecycleHandler::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * @return string + */ + public function getHandler() + { + return $this->whichOneof("handler"); + } + +} + diff --git a/DialogflowCx/src/V3/Handler/EventHandler.php b/DialogflowCx/src/V3/Handler/EventHandler.php new file mode 100644 index 000000000000..00145eec21e9 --- /dev/null +++ b/DialogflowCx/src/V3/Handler/EventHandler.php @@ -0,0 +1,147 @@ +google.cloud.dialogflow.cx.v3.Handler.EventHandler + */ +class EventHandler extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the event that triggers this handler. + * + * Generated from protobuf field string event = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $event = ''; + /** + * Optional. The condition that must be satisfied to trigger this handler. + * + * Generated from protobuf field string condition = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $condition = ''; + /** + * Required. The fulfillment to call when the event occurs. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fulfillment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $event + * Required. The name of the event that triggers this handler. + * @type string $condition + * Optional. The condition that must be satisfied to trigger this handler. + * @type \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $fulfillment + * Required. The fulfillment to call when the event occurs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the event that triggers this handler. + * + * Generated from protobuf field string event = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getEvent() + { + return $this->event; + } + + /** + * Required. The name of the event that triggers this handler. + * + * Generated from protobuf field string event = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setEvent($var) + { + GPBUtil::checkString($var, True); + $this->event = $var; + + return $this; + } + + /** + * Optional. The condition that must be satisfied to trigger this handler. + * + * Generated from protobuf field string condition = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCondition() + { + return $this->condition; + } + + /** + * Optional. The condition that must be satisfied to trigger this handler. + * + * Generated from protobuf field string condition = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkString($var, True); + $this->condition = $var; + + return $this; + } + + /** + * Required. The fulfillment to call when the event occurs. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Fulfillment|null + */ + public function getFulfillment() + { + return $this->fulfillment; + } + + public function hasFulfillment() + { + return isset($this->fulfillment); + } + + public function clearFulfillment() + { + unset($this->fulfillment); + } + + /** + * Required. The fulfillment to call when the event occurs. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $var + * @return $this + */ + public function setFulfillment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment::class); + $this->fulfillment = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Handler/LifecycleHandler.php b/DialogflowCx/src/V3/Handler/LifecycleHandler.php new file mode 100644 index 000000000000..5472b599794c --- /dev/null +++ b/DialogflowCx/src/V3/Handler/LifecycleHandler.php @@ -0,0 +1,164 @@ +google.cloud.dialogflow.cx.v3.Handler.LifecycleHandler + */ +class LifecycleHandler extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the lifecycle stage that triggers this handler. + * Supported values: + * * `playbook-start` + * * `pre-action-selection` + * * `pre-action-execution` + * + * Generated from protobuf field string lifecycle_stage = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $lifecycle_stage = ''; + /** + * Optional. The condition that must be satisfied to trigger this handler. + * + * Generated from protobuf field string condition = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $condition = ''; + /** + * Required. The fulfillment to call when this handler is triggered. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fulfillment = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $lifecycle_stage + * Required. The name of the lifecycle stage that triggers this handler. + * Supported values: + * * `playbook-start` + * * `pre-action-selection` + * * `pre-action-execution` + * @type string $condition + * Optional. The condition that must be satisfied to trigger this handler. + * @type \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $fulfillment + * Required. The fulfillment to call when this handler is triggered. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the lifecycle stage that triggers this handler. + * Supported values: + * * `playbook-start` + * * `pre-action-selection` + * * `pre-action-execution` + * + * Generated from protobuf field string lifecycle_stage = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getLifecycleStage() + { + return $this->lifecycle_stage; + } + + /** + * Required. The name of the lifecycle stage that triggers this handler. + * Supported values: + * * `playbook-start` + * * `pre-action-selection` + * * `pre-action-execution` + * + * Generated from protobuf field string lifecycle_stage = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setLifecycleStage($var) + { + GPBUtil::checkString($var, True); + $this->lifecycle_stage = $var; + + return $this; + } + + /** + * Optional. The condition that must be satisfied to trigger this handler. + * + * Generated from protobuf field string condition = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getCondition() + { + return $this->condition; + } + + /** + * Optional. The condition that must be satisfied to trigger this handler. + * + * Generated from protobuf field string condition = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setCondition($var) + { + GPBUtil::checkString($var, True); + $this->condition = $var; + + return $this; + } + + /** + * Required. The fulfillment to call when this handler is triggered. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Fulfillment|null + */ + public function getFulfillment() + { + return $this->fulfillment; + } + + public function hasFulfillment() + { + return isset($this->fulfillment); + } + + public function clearFulfillment() + { + unset($this->fulfillment); + } + + /** + * Required. The fulfillment to call when this handler is triggered. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Fulfillment fulfillment = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Fulfillment $var + * @return $this + */ + public function setFulfillment($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Fulfillment::class); + $this->fulfillment = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ImportPlaybookRequest.php b/DialogflowCx/src/V3/ImportPlaybookRequest.php new file mode 100644 index 000000000000..a5b91f4e9fcb --- /dev/null +++ b/DialogflowCx/src/V3/ImportPlaybookRequest.php @@ -0,0 +1,201 @@ +google.cloud.dialogflow.cx.v3.ImportPlaybookRequest + */ +class ImportPlaybookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to import the playbook into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookImportStrategy import_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $import_strategy = null; + protected $playbook; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to import the playbook into. + * Format: `projects//locations//agents/`. + * @type string $playbook_uri + * [Dialogflow access + * control] + * (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * @type string $playbook_content + * Uncompressed raw byte content for playbook. + * @type \Google\Cloud\Dialogflow\Cx\V3\PlaybookImportStrategy $import_strategy + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to import the playbook into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to import the playbook into. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * [Dialogflow access + * control] + * (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string playbook_uri = 2; + * @return string + */ + public function getPlaybookUri() + { + return $this->readOneof(2); + } + + public function hasPlaybookUri() + { + return $this->hasOneof(2); + } + + /** + * [Dialogflow access + * control] + * (https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). + * + * Generated from protobuf field string playbook_uri = 2; + * @param string $var + * @return $this + */ + public function setPlaybookUri($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Uncompressed raw byte content for playbook. + * + * Generated from protobuf field bytes playbook_content = 3; + * @return string + */ + public function getPlaybookContent() + { + return $this->readOneof(3); + } + + public function hasPlaybookContent() + { + return $this->hasOneof(3); + } + + /** + * Uncompressed raw byte content for playbook. + * + * Generated from protobuf field bytes playbook_content = 3; + * @param string $var + * @return $this + */ + public function setPlaybookContent($var) + { + GPBUtil::checkString($var, False); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookImportStrategy import_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\PlaybookImportStrategy|null + */ + public function getImportStrategy() + { + return $this->import_strategy; + } + + public function hasImportStrategy() + { + return isset($this->import_strategy); + } + + public function clearImportStrategy() + { + unset($this->import_strategy); + } + + /** + * Optional. Specifies the import strategy used when resolving resource + * conflicts. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookImportStrategy import_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookImportStrategy $var + * @return $this + */ + public function setImportStrategy($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PlaybookImportStrategy::class); + $this->import_strategy = $var; + + return $this; + } + + /** + * @return string + */ + public function getPlaybook() + { + return $this->whichOneof("playbook"); + } + +} + diff --git a/DialogflowCx/src/V3/ImportPlaybookResponse.php b/DialogflowCx/src/V3/ImportPlaybookResponse.php new file mode 100644 index 000000000000..f1124654e62b --- /dev/null +++ b/DialogflowCx/src/V3/ImportPlaybookResponse.php @@ -0,0 +1,128 @@ +google.cloud.dialogflow.cx.v3.ImportPlaybookResponse + */ +class ImportPlaybookResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the new playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.resource_reference) = { + */ + protected $playbook = ''; + /** + * Info which resources have conflicts when + * [REPORT_CONFLICTS][ImportPlaybookResponse.REPORT_CONFLICTS] import strategy + * is set for all resources in ImportPlaybookRequest. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportPlaybookResponse.ConflictingResources conflicting_resources = 2; + */ + protected $conflicting_resources = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $playbook + * The unique identifier of the new playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\ImportPlaybookResponse\ConflictingResources $conflicting_resources + * Info which resources have conflicts when + * [REPORT_CONFLICTS][ImportPlaybookResponse.REPORT_CONFLICTS] import strategy + * is set for all resources in ImportPlaybookRequest. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the new playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getPlaybook() + { + return $this->playbook; + } + + /** + * The unique identifier of the new playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPlaybook($var) + { + GPBUtil::checkString($var, True); + $this->playbook = $var; + + return $this; + } + + /** + * Info which resources have conflicts when + * [REPORT_CONFLICTS][ImportPlaybookResponse.REPORT_CONFLICTS] import strategy + * is set for all resources in ImportPlaybookRequest. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportPlaybookResponse.ConflictingResources conflicting_resources = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\ImportPlaybookResponse\ConflictingResources|null + */ + public function getConflictingResources() + { + return $this->conflicting_resources; + } + + public function hasConflictingResources() + { + return isset($this->conflicting_resources); + } + + public function clearConflictingResources() + { + unset($this->conflicting_resources); + } + + /** + * Info which resources have conflicts when + * [REPORT_CONFLICTS][ImportPlaybookResponse.REPORT_CONFLICTS] import strategy + * is set for all resources in ImportPlaybookRequest. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportPlaybookResponse.ConflictingResources conflicting_resources = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\ImportPlaybookResponse\ConflictingResources $var + * @return $this + */ + public function setConflictingResources($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ImportPlaybookResponse\ConflictingResources::class); + $this->conflicting_resources = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ImportPlaybookResponse/ConflictingResources.php b/DialogflowCx/src/V3/ImportPlaybookResponse/ConflictingResources.php new file mode 100644 index 000000000000..788e58593217 --- /dev/null +++ b/DialogflowCx/src/V3/ImportPlaybookResponse/ConflictingResources.php @@ -0,0 +1,138 @@ +google.cloud.dialogflow.cx.v3.ImportPlaybookResponse.ConflictingResources + */ +class ConflictingResources extends \Google\Protobuf\Internal\Message +{ + /** + * Display name of conflicting main playbook. + * + * Generated from protobuf field string main_playbook_display_name = 1; + */ + protected $main_playbook_display_name = ''; + /** + * Display names of conflicting nested playbooks. + * + * Generated from protobuf field repeated string nested_playbook_display_names = 2; + */ + private $nested_playbook_display_names; + /** + * Display names of conflicting tools. + * + * Generated from protobuf field repeated string tool_display_names = 3; + */ + private $tool_display_names; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $main_playbook_display_name + * Display name of conflicting main playbook. + * @type array|\Google\Protobuf\Internal\RepeatedField $nested_playbook_display_names + * Display names of conflicting nested playbooks. + * @type array|\Google\Protobuf\Internal\RepeatedField $tool_display_names + * Display names of conflicting tools. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Display name of conflicting main playbook. + * + * Generated from protobuf field string main_playbook_display_name = 1; + * @return string + */ + public function getMainPlaybookDisplayName() + { + return $this->main_playbook_display_name; + } + + /** + * Display name of conflicting main playbook. + * + * Generated from protobuf field string main_playbook_display_name = 1; + * @param string $var + * @return $this + */ + public function setMainPlaybookDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->main_playbook_display_name = $var; + + return $this; + } + + /** + * Display names of conflicting nested playbooks. + * + * Generated from protobuf field repeated string nested_playbook_display_names = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getNestedPlaybookDisplayNames() + { + return $this->nested_playbook_display_names; + } + + /** + * Display names of conflicting nested playbooks. + * + * Generated from protobuf field repeated string nested_playbook_display_names = 2; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setNestedPlaybookDisplayNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->nested_playbook_display_names = $arr; + + return $this; + } + + /** + * Display names of conflicting tools. + * + * Generated from protobuf field repeated string tool_display_names = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getToolDisplayNames() + { + return $this->tool_display_names; + } + + /** + * Display names of conflicting tools. + * + * Generated from protobuf field repeated string tool_display_names = 3; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setToolDisplayNames($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->tool_display_names = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/InlineSchema.php b/DialogflowCx/src/V3/InlineSchema.php new file mode 100644 index 000000000000..a8e4f32b3c9c --- /dev/null +++ b/DialogflowCx/src/V3/InlineSchema.php @@ -0,0 +1,111 @@ +google.cloud.dialogflow.cx.v3.InlineSchema + */ +class InlineSchema extends \Google\Protobuf\Internal\Message +{ + /** + * Data type of the schema. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DataType type = 1; + */ + protected $type = 0; + /** + * Schema of the elements if this is an ARRAY type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TypeSchema items = 2; + */ + protected $items = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Data type of the schema. + * @type \Google\Cloud\Dialogflow\Cx\V3\TypeSchema $items + * Schema of the elements if this is an ARRAY type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition::initOnce(); + parent::__construct($data); + } + + /** + * Data type of the schema. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DataType type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Data type of the schema. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DataType type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\DataType::class); + $this->type = $var; + + return $this; + } + + /** + * Schema of the elements if this is an ARRAY type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TypeSchema items = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\TypeSchema|null + */ + public function getItems() + { + return $this->items; + } + + public function hasItems() + { + return isset($this->items); + } + + public function clearItems() + { + unset($this->items); + } + + /** + * Schema of the elements if this is an ARRAY type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TypeSchema items = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\TypeSchema $var + * @return $this + */ + public function setItems($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TypeSchema::class); + $this->items = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListExamplesRequest.php b/DialogflowCx/src/V3/ListExamplesRequest.php new file mode 100644 index 000000000000..2d993b1fff60 --- /dev/null +++ b/DialogflowCx/src/V3/ListExamplesRequest.php @@ -0,0 +1,210 @@ +google.cloud.dialogflow.cx.v3.ListExamplesRequest + */ +class ListExamplesRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The playbook to list the examples from. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The [next_page_token][ListExampleResponse.next_page_token] value + * returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. The language to list examples for. + * If not specified, list all examples under the playbook. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $language_code = ''; + + /** + * @param string $parent Required. The playbook to list the examples from. + * Format: + * `projects//locations//agents//playbooks/`. Please see + * {@see ExamplesClient::playbookName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\ListExamplesRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The playbook to list the examples from. + * Format: + * `projects//locations//agents//playbooks/`. + * @type int $page_size + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @type string $page_token + * Optional. The [next_page_token][ListExampleResponse.next_page_token] value + * returned from a previous list request. + * @type string $language_code + * Optional. The language to list examples for. + * If not specified, list all examples under the playbook. + * Note: languages must be enabled in the agent before they can be used. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Example::initOnce(); + parent::__construct($data); + } + + /** + * Required. The playbook to list the examples from. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The playbook to list the examples from. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The [next_page_token][ListExampleResponse.next_page_token] value + * returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The [next_page_token][ListExampleResponse.next_page_token] value + * returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. The language to list examples for. + * If not specified, list all examples under the playbook. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getLanguageCode() + { + return $this->language_code; + } + + /** + * Optional. The language to list examples for. + * If not specified, list all examples under the playbook. + * Note: languages must be enabled in the agent before they can be used. + * + * Generated from protobuf field string language_code = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->language_code = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListExamplesResponse.php b/DialogflowCx/src/V3/ListExamplesResponse.php new file mode 100644 index 000000000000..07fb955e50bf --- /dev/null +++ b/DialogflowCx/src/V3/ListExamplesResponse.php @@ -0,0 +1,118 @@ +google.cloud.dialogflow.cx.v3.ListExamplesResponse + */ +class ListExamplesResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of examples. There will be a maximum number of items returned + * based on the + * [page_size][google.cloud.dialogflow.cx.v3.ListExamplesRequest.page_size] + * field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Example examples = 1; + */ + private $examples; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Example>|\Google\Protobuf\Internal\RepeatedField $examples + * The list of examples. There will be a maximum number of items returned + * based on the + * [page_size][google.cloud.dialogflow.cx.v3.ListExamplesRequest.page_size] + * field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Example::initOnce(); + parent::__construct($data); + } + + /** + * The list of examples. There will be a maximum number of items returned + * based on the + * [page_size][google.cloud.dialogflow.cx.v3.ListExamplesRequest.page_size] + * field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Example examples = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExamples() + { + return $this->examples; + } + + /** + * The list of examples. There will be a maximum number of items returned + * based on the + * [page_size][google.cloud.dialogflow.cx.v3.ListExamplesRequest.page_size] + * field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Example examples = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Example>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExamples($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Example::class); + $this->examples = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListPlaybookVersionsRequest.php b/DialogflowCx/src/V3/ListPlaybookVersionsRequest.php new file mode 100644 index 000000000000..053d31a0d4d8 --- /dev/null +++ b/DialogflowCx/src/V3/ListPlaybookVersionsRequest.php @@ -0,0 +1,164 @@ +google.cloud.dialogflow.cx.v3.ListPlaybookVersionsRequest + */ +class ListPlaybookVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The playbook to list versions for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The playbook to list versions for. + * Format: + * `projects//locations//agents//playbooks/`. Please see + * {@see PlaybooksClient::playbookName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\ListPlaybookVersionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The playbook to list versions for. + * Format: + * `projects//locations//agents//playbooks/`. + * @type int $page_size + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @type string $page_token + * Optional. The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The playbook to list versions for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The playbook to list versions for. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListPlaybookVersionsResponse.php b/DialogflowCx/src/V3/ListPlaybookVersionsResponse.php new file mode 100644 index 000000000000..4896c178fbe2 --- /dev/null +++ b/DialogflowCx/src/V3/ListPlaybookVersionsResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListPlaybookVersionsResponse + */ +class ListPlaybookVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of playbook version. There will be a maximum number of items + * returned based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.PlaybookVersion playbook_versions = 1; + */ + private $playbook_versions; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion>|\Google\Protobuf\Internal\RepeatedField $playbook_versions + * The list of playbook version. There will be a maximum number of items + * returned based on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * The list of playbook version. There will be a maximum number of items + * returned based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.PlaybookVersion playbook_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPlaybookVersions() + { + return $this->playbook_versions; + } + + /** + * The list of playbook version. There will be a maximum number of items + * returned based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.PlaybookVersion playbook_versions = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPlaybookVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion::class); + $this->playbook_versions = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListPlaybooksRequest.php b/DialogflowCx/src/V3/ListPlaybooksRequest.php new file mode 100644 index 000000000000..4ce0812cace6 --- /dev/null +++ b/DialogflowCx/src/V3/ListPlaybooksRequest.php @@ -0,0 +1,159 @@ +google.cloud.dialogflow.cx.v3.ListPlaybooksRequest + */ +class ListPlaybooksRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to list playbooks from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The agent to list playbooks from. + * Format: `projects//locations//agents/`. Please see + * {@see PlaybooksClient::agentName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\ListPlaybooksRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to list playbooks from. + * Format: `projects//locations//agents/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to list playbooks from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to list playbooks from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListPlaybooksResponse.php b/DialogflowCx/src/V3/ListPlaybooksResponse.php new file mode 100644 index 000000000000..95cd2530e712 --- /dev/null +++ b/DialogflowCx/src/V3/ListPlaybooksResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListPlaybooksResponse + */ +class ListPlaybooksResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of playbooks. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook playbooks = 1; + */ + private $playbooks; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Playbook>|\Google\Protobuf\Internal\RepeatedField $playbooks + * The list of playbooks. There will be a maximum number of items returned + * based on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * The list of playbooks. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook playbooks = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getPlaybooks() + { + return $this->playbooks; + } + + /** + * The list of playbooks. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook playbooks = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Playbook>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setPlaybooks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Playbook::class); + $this->playbooks = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListToolVersionsRequest.php b/DialogflowCx/src/V3/ListToolVersionsRequest.php new file mode 100644 index 000000000000..7353a1402824 --- /dev/null +++ b/DialogflowCx/src/V3/ListToolVersionsRequest.php @@ -0,0 +1,164 @@ +google.cloud.dialogflow.cx.v3.ListToolVersionsRequest + */ +class ListToolVersionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parent of the tool versions. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The parent of the tool versions. + * Format: + * `projects//locations//agents//tools/`. Please see + * {@see ToolsClient::toolName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\ListToolVersionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The parent of the tool versions. + * Format: + * `projects//locations//agents//tools/`. + * @type int $page_size + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * @type string $page_token + * Optional. The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parent of the tool versions. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The parent of the tool versions. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. The maximum number of items to return in a single page. By + * default 100 and at most 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListToolVersionsResponse.php b/DialogflowCx/src/V3/ListToolVersionsResponse.php new file mode 100644 index 000000000000..5314aea836e5 --- /dev/null +++ b/DialogflowCx/src/V3/ListToolVersionsResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListToolVersionsResponse + */ +class ListToolVersionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of tool versions. There will be a maximum number of items + * returned based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ToolVersion tool_versions = 1; + */ + private $tool_versions; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ToolVersion>|\Google\Protobuf\Internal\RepeatedField $tool_versions + * The list of tool versions. There will be a maximum number of items + * returned based on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * The list of tool versions. There will be a maximum number of items + * returned based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ToolVersion tool_versions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getToolVersions() + { + return $this->tool_versions; + } + + /** + * The list of tool versions. There will be a maximum number of items + * returned based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ToolVersion tool_versions = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ToolVersion>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setToolVersions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ToolVersion::class); + $this->tool_versions = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListToolsRequest.php b/DialogflowCx/src/V3/ListToolsRequest.php new file mode 100644 index 000000000000..792df305dad6 --- /dev/null +++ b/DialogflowCx/src/V3/ListToolsRequest.php @@ -0,0 +1,159 @@ +google.cloud.dialogflow.cx.v3.ListToolsRequest + */ +class ListToolsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The agent to list the Tools from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + + /** + * @param string $parent Required. The agent to list the Tools from. + * Format: `projects//locations//agents/`. Please see + * {@see ToolsClient::agentName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\ListToolsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The agent to list the Tools from. + * Format: `projects//locations//agents/`. + * @type int $page_size + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * @type string $page_token + * The next_page_token value returned from a previous list request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The agent to list the Tools from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The agent to list the Tools from. + * Format: `projects//locations//agents/`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * The maximum number of items to return in a single page. By default 100 and + * at most 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * The next_page_token value returned from a previous list request. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ListToolsResponse.php b/DialogflowCx/src/V3/ListToolsResponse.php new file mode 100644 index 000000000000..80c56b49848d --- /dev/null +++ b/DialogflowCx/src/V3/ListToolsResponse.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.ListToolsResponse + */ +class ListToolsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The list of Tools. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Tool tools = 1; + */ + private $tools; + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Tool>|\Google\Protobuf\Internal\RepeatedField $tools + * The list of Tools. There will be a maximum number of items returned + * based on the page_size field in the request. + * @type string $next_page_token + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * The list of Tools. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Tool tools = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTools() + { + return $this->tools; + } + + /** + * The list of Tools. There will be a maximum number of items returned + * based on the page_size field in the request. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Tool tools = 1; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Tool>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTools($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Tool::class); + $this->tools = $arr; + + return $this; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Token to retrieve the next page of results, or empty if there are no more + * results in the list. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/LlmModelSettings.php b/DialogflowCx/src/V3/LlmModelSettings.php new file mode 100644 index 000000000000..0e862e925466 --- /dev/null +++ b/DialogflowCx/src/V3/LlmModelSettings.php @@ -0,0 +1,101 @@ +google.cloud.dialogflow.cx.v3.LlmModelSettings + */ +class LlmModelSettings extends \Google\Protobuf\Internal\Message +{ + /** + * The selected LLM model. + * + * Generated from protobuf field string model = 1; + */ + protected $model = ''; + /** + * The custom prompt to use. + * + * Generated from protobuf field string prompt_text = 2; + */ + protected $prompt_text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model + * The selected LLM model. + * @type string $prompt_text + * The custom prompt to use. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\GenerativeSettings::initOnce(); + parent::__construct($data); + } + + /** + * The selected LLM model. + * + * Generated from protobuf field string model = 1; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * The selected LLM model. + * + * Generated from protobuf field string model = 1; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The custom prompt to use. + * + * Generated from protobuf field string prompt_text = 2; + * @return string + */ + public function getPromptText() + { + return $this->prompt_text; + } + + /** + * The custom prompt to use. + * + * Generated from protobuf field string prompt_text = 2; + * @param string $var + * @return $this + */ + public function setPromptText($var) + { + GPBUtil::checkString($var, True); + $this->prompt_text = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/OutputAudioEncoding.php b/DialogflowCx/src/V3/OutputAudioEncoding.php index c12c52eb1ef7..996795c8626d 100644 --- a/DialogflowCx/src/V3/OutputAudioEncoding.php +++ b/DialogflowCx/src/V3/OutputAudioEncoding.php @@ -22,6 +22,7 @@ class OutputAudioEncoding /** * Uncompressed 16-bit signed little-endian samples (Linear PCM). * Audio content returned as LINEAR16 also contains a WAV header. + * LINT: LEGACY_NAMES * * Generated from protobuf enum OUTPUT_AUDIO_ENCODING_LINEAR_16 = 1; */ @@ -34,6 +35,7 @@ class OutputAudioEncoding const OUTPUT_AUDIO_ENCODING_MP3 = 2; /** * MP3 audio at 64kbps. + * LINT: LEGACY_NAMES * * Generated from protobuf enum OUTPUT_AUDIO_ENCODING_MP3_64_KBPS = 4; */ diff --git a/DialogflowCx/src/V3/OutputState.php b/DialogflowCx/src/V3/OutputState.php new file mode 100644 index 000000000000..47087ffe3b21 --- /dev/null +++ b/DialogflowCx/src/V3/OutputState.php @@ -0,0 +1,82 @@ +google.cloud.dialogflow.cx.v3.OutputState + */ +class OutputState +{ + /** + * Unspecified output. + * + * Generated from protobuf enum OUTPUT_STATE_UNSPECIFIED = 0; + */ + const OUTPUT_STATE_UNSPECIFIED = 0; + /** + * Succeeded. + * + * Generated from protobuf enum OUTPUT_STATE_OK = 1; + */ + const OUTPUT_STATE_OK = 1; + /** + * Cancelled. + * + * Generated from protobuf enum OUTPUT_STATE_CANCELLED = 2; + */ + const OUTPUT_STATE_CANCELLED = 2; + /** + * Failed. + * + * Generated from protobuf enum OUTPUT_STATE_FAILED = 3; + */ + const OUTPUT_STATE_FAILED = 3; + /** + * Escalated. + * + * Generated from protobuf enum OUTPUT_STATE_ESCALATED = 4; + */ + const OUTPUT_STATE_ESCALATED = 4; + /** + * Pending. + * + * Generated from protobuf enum OUTPUT_STATE_PENDING = 5; + */ + const OUTPUT_STATE_PENDING = 5; + + private static $valueToName = [ + self::OUTPUT_STATE_UNSPECIFIED => 'OUTPUT_STATE_UNSPECIFIED', + self::OUTPUT_STATE_OK => 'OUTPUT_STATE_OK', + self::OUTPUT_STATE_CANCELLED => 'OUTPUT_STATE_CANCELLED', + self::OUTPUT_STATE_FAILED => 'OUTPUT_STATE_FAILED', + self::OUTPUT_STATE_ESCALATED => 'OUTPUT_STATE_ESCALATED', + self::OUTPUT_STATE_PENDING => 'OUTPUT_STATE_PENDING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DialogflowCx/src/V3/PBMatch/MatchType.php b/DialogflowCx/src/V3/PBMatch/MatchType.php index 57b29485c28e..50c3dcec3419 100644 --- a/DialogflowCx/src/V3/PBMatch/MatchType.php +++ b/DialogflowCx/src/V3/PBMatch/MatchType.php @@ -62,7 +62,8 @@ class MatchType */ const KNOWLEDGE_CONNECTOR = 8; /** - * The query was handled by a [`Playbook`][Playbook]. + * The query was handled by a + * [`Playbook`][google.cloud.dialogflow.cx.v3.Playbook]. * * Generated from protobuf enum PLAYBOOK = 9; */ diff --git a/DialogflowCx/src/V3/ParameterDefinition.php b/DialogflowCx/src/V3/ParameterDefinition.php new file mode 100644 index 000000000000..bc51d383a3ca --- /dev/null +++ b/DialogflowCx/src/V3/ParameterDefinition.php @@ -0,0 +1,188 @@ +google.cloud.dialogflow.cx.v3.ParameterDefinition + */ +class ParameterDefinition extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Name of parameter. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $name = ''; + /** + * Type of parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ParameterDefinition.ParameterType type = 2 [deprecated = true]; + * @deprecated + */ + protected $type = 0; + /** + * Optional. Type schema of parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TypeSchema type_schema = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $type_schema = null; + /** + * Human-readable description of the parameter. Limited to 300 characters. + * + * Generated from protobuf field string description = 3; + */ + protected $description = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Name of parameter. + * @type int $type + * Type of parameter. + * @type \Google\Cloud\Dialogflow\Cx\V3\TypeSchema $type_schema + * Optional. Type schema of parameter. + * @type string $description + * Human-readable description of the parameter. Limited to 300 characters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition::initOnce(); + parent::__construct($data); + } + + /** + * Required. Name of parameter. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Name of parameter. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Type of parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ParameterDefinition.ParameterType type = 2 [deprecated = true]; + * @return int + * @deprecated + */ + public function getType() + { + if ($this->type !== 0) { + @trigger_error('type is deprecated.', E_USER_DEPRECATED); + } + return $this->type; + } + + /** + * Type of parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ParameterDefinition.ParameterType type = 2 [deprecated = true]; + * @param int $var + * @return $this + * @deprecated + */ + public function setType($var) + { + @trigger_error('type is deprecated.', E_USER_DEPRECATED); + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition\ParameterType::class); + $this->type = $var; + + return $this; + } + + /** + * Optional. Type schema of parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TypeSchema type_schema = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\TypeSchema|null + */ + public function getTypeSchema() + { + return $this->type_schema; + } + + public function hasTypeSchema() + { + return isset($this->type_schema); + } + + public function clearTypeSchema() + { + unset($this->type_schema); + } + + /** + * Optional. Type schema of parameter. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TypeSchema type_schema = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\TypeSchema $var + * @return $this + */ + public function setTypeSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TypeSchema::class); + $this->type_schema = $var; + + return $this; + } + + /** + * Human-readable description of the parameter. Limited to 300 characters. + * + * Generated from protobuf field string description = 3; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Human-readable description of the parameter. Limited to 300 characters. + * + * Generated from protobuf field string description = 3; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ParameterDefinition/ParameterType.php b/DialogflowCx/src/V3/ParameterDefinition/ParameterType.php new file mode 100644 index 000000000000..0df601d5ca15 --- /dev/null +++ b/DialogflowCx/src/V3/ParameterDefinition/ParameterType.php @@ -0,0 +1,96 @@ +google.cloud.dialogflow.cx.v3.ParameterDefinition.ParameterType + */ +class ParameterType +{ + /** + * Not specified. No validation will be performed. + * + * Generated from protobuf enum PARAMETER_TYPE_UNSPECIFIED = 0; + */ + const PARAMETER_TYPE_UNSPECIFIED = 0; + /** + * Represents any string value. + * + * Generated from protobuf enum STRING = 1; + */ + const STRING = 1; + /** + * Represents any number value. + * + * Generated from protobuf enum NUMBER = 2; + */ + const NUMBER = 2; + /** + * Represents a boolean value. + * + * Generated from protobuf enum BOOLEAN = 3; + */ + const BOOLEAN = 3; + /** + * Represents a null value. + * + * Generated from protobuf enum NULL = 4; + */ + const NULL = 4; + /** + * Represents any object value. + * + * Generated from protobuf enum OBJECT = 5; + */ + const OBJECT = 5; + /** + * Represents a repeated value. + * + * Generated from protobuf enum LIST = 6; + */ + const PBLIST = 6; + + private static $valueToName = [ + self::PARAMETER_TYPE_UNSPECIFIED => 'PARAMETER_TYPE_UNSPECIFIED', + self::STRING => 'STRING', + self::NUMBER => 'NUMBER', + self::BOOLEAN => 'BOOLEAN', + self::NULL => 'NULL', + self::OBJECT => 'OBJECT', + self::PBLIST => 'LIST', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + $pbconst = __CLASS__. '::PB' . strtoupper($name); + if (!defined($pbconst)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($pbconst); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/Playbook.php b/DialogflowCx/src/V3/Playbook.php new file mode 100644 index 000000000000..2f0a01b746a2 --- /dev/null +++ b/DialogflowCx/src/V3/Playbook.php @@ -0,0 +1,723 @@ +google.cloud.dialogflow.cx.v3.Playbook + */ +class Playbook extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the playbook, unique within an agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Required. High level description of the goal the playbook intend to + * accomplish. A goal should be concise since it's visible to other playbooks + * that may reference this playbook. + * + * Generated from protobuf field string goal = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $goal = ''; + /** + * Optional. Defined structured input parameters for this playbook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition input_parameter_definitions = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $input_parameter_definitions; + /** + * Optional. Defined structured output parameters for this playbook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition output_parameter_definitions = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $output_parameter_definitions; + /** + * Instruction to accomplish target goal. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook.Instruction instruction = 17; + */ + protected $instruction = null; + /** + * Output only. Estimated number of tokes current playbook takes when sent to + * the LLM. + * + * Generated from protobuf field int64 token_count = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $token_count = 0; + /** + * Output only. The timestamp of initial playbook creation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last time the playbook version was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + /** + * Output only. The resource name of other playbooks referenced by the current + * playbook in the instructions. + * + * Generated from protobuf field repeated string referenced_playbooks = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $referenced_playbooks; + /** + * Output only. The resource name of flows referenced by the current playbook + * in the instructions. + * + * Generated from protobuf field repeated string referenced_flows = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + */ + private $referenced_flows; + /** + * Optional. The resource name of tools referenced by the current playbook in + * the instructions. If not provided explicitly, they are will + * be implied using the tool being referenced in goal and steps. + * + * Generated from protobuf field repeated string referenced_tools = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + private $referenced_tools; + /** + * Optional. Output only. Names of inline actions scoped to this playbook. + * These actions are in addition to those belonging to referenced tools, child + * playbooks, and flows, e.g. actions that are defined in the playbook's code + * block. + * + * Generated from protobuf field repeated string inline_actions = 22 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $inline_actions; + /** + * Optional. The playbook's scoped code block, which may implement handlers + * and actions. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.CodeBlock code_block = 21 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $code_block = null; + /** + * Optional. Llm model settings for the playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 14 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $llm_model_settings = null; + /** + * Optional. A list of registered handlers to execuate based on the specified + * triggers. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Handler handlers = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $handlers; + /** + * Optional. Type of the playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook.PlaybookType playbook_type = 19 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $playbook_type = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * @type string $display_name + * Required. The human-readable name of the playbook, unique within an agent. + * @type string $goal + * Required. High level description of the goal the playbook intend to + * accomplish. A goal should be concise since it's visible to other playbooks + * that may reference this playbook. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition>|\Google\Protobuf\Internal\RepeatedField $input_parameter_definitions + * Optional. Defined structured input parameters for this playbook. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition>|\Google\Protobuf\Internal\RepeatedField $output_parameter_definitions + * Optional. Defined structured output parameters for this playbook. + * @type \Google\Cloud\Dialogflow\Cx\V3\Playbook\Instruction $instruction + * Instruction to accomplish target goal. + * @type int|string $token_count + * Output only. Estimated number of tokes current playbook takes when sent to + * the LLM. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp of initial playbook creation. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last time the playbook version was updated. + * @type array|\Google\Protobuf\Internal\RepeatedField $referenced_playbooks + * Output only. The resource name of other playbooks referenced by the current + * playbook in the instructions. + * @type array|\Google\Protobuf\Internal\RepeatedField $referenced_flows + * Output only. The resource name of flows referenced by the current playbook + * in the instructions. + * @type array|\Google\Protobuf\Internal\RepeatedField $referenced_tools + * Optional. The resource name of tools referenced by the current playbook in + * the instructions. If not provided explicitly, they are will + * be implied using the tool being referenced in goal and steps. + * @type array|\Google\Protobuf\Internal\RepeatedField $inline_actions + * Optional. Output only. Names of inline actions scoped to this playbook. + * These actions are in addition to those belonging to referenced tools, child + * playbooks, and flows, e.g. actions that are defined in the playbook's code + * block. + * @type \Google\Cloud\Dialogflow\Cx\V3\CodeBlock $code_block + * Optional. The playbook's scoped code block, which may implement handlers + * and actions. + * @type \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings $llm_model_settings + * Optional. Llm model settings for the playbook. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Handler>|\Google\Protobuf\Internal\RepeatedField $handlers + * Optional. A list of registered handlers to execuate based on the specified + * triggers. + * @type int $playbook_type + * Optional. Type of the playbook. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the playbook, unique within an agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the playbook, unique within an agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. High level description of the goal the playbook intend to + * accomplish. A goal should be concise since it's visible to other playbooks + * that may reference this playbook. + * + * Generated from protobuf field string goal = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getGoal() + { + return $this->goal; + } + + /** + * Required. High level description of the goal the playbook intend to + * accomplish. A goal should be concise since it's visible to other playbooks + * that may reference this playbook. + * + * Generated from protobuf field string goal = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setGoal($var) + { + GPBUtil::checkString($var, True); + $this->goal = $var; + + return $this; + } + + /** + * Optional. Defined structured input parameters for this playbook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition input_parameter_definitions = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInputParameterDefinitions() + { + return $this->input_parameter_definitions; + } + + /** + * Optional. Defined structured input parameters for this playbook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition input_parameter_definitions = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInputParameterDefinitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition::class); + $this->input_parameter_definitions = $arr; + + return $this; + } + + /** + * Optional. Defined structured output parameters for this playbook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition output_parameter_definitions = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getOutputParameterDefinitions() + { + return $this->output_parameter_definitions; + } + + /** + * Optional. Defined structured output parameters for this playbook. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ParameterDefinition output_parameter_definitions = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setOutputParameterDefinitions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition::class); + $this->output_parameter_definitions = $arr; + + return $this; + } + + /** + * Instruction to accomplish target goal. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook.Instruction instruction = 17; + * @return \Google\Cloud\Dialogflow\Cx\V3\Playbook\Instruction|null + */ + public function getInstruction() + { + return $this->instruction; + } + + public function hasInstruction() + { + return isset($this->instruction); + } + + public function clearInstruction() + { + unset($this->instruction); + } + + /** + * Instruction to accomplish target goal. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook.Instruction instruction = 17; + * @param \Google\Cloud\Dialogflow\Cx\V3\Playbook\Instruction $var + * @return $this + */ + public function setInstruction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Playbook\Instruction::class); + $this->instruction = $var; + + return $this; + } + + /** + * Output only. Estimated number of tokes current playbook takes when sent to + * the LLM. + * + * Generated from protobuf field int64 token_count = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int|string + */ + public function getTokenCount() + { + return $this->token_count; + } + + /** + * Output only. Estimated number of tokes current playbook takes when sent to + * the LLM. + * + * Generated from protobuf field int64 token_count = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int|string $var + * @return $this + */ + public function setTokenCount($var) + { + GPBUtil::checkInt64($var); + $this->token_count = $var; + + return $this; + } + + /** + * Output only. The timestamp of initial playbook creation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp of initial playbook creation. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last time the playbook version was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last time the playbook version was updated. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + + /** + * Output only. The resource name of other playbooks referenced by the current + * playbook in the instructions. + * + * Generated from protobuf field repeated string referenced_playbooks = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferencedPlaybooks() + { + return $this->referenced_playbooks; + } + + /** + * Output only. The resource name of other playbooks referenced by the current + * playbook in the instructions. + * + * Generated from protobuf field repeated string referenced_playbooks = 11 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferencedPlaybooks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->referenced_playbooks = $arr; + + return $this; + } + + /** + * Output only. The resource name of flows referenced by the current playbook + * in the instructions. + * + * Generated from protobuf field repeated string referenced_flows = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferencedFlows() + { + return $this->referenced_flows; + } + + /** + * Output only. The resource name of flows referenced by the current playbook + * in the instructions. + * + * Generated from protobuf field repeated string referenced_flows = 12 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferencedFlows($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->referenced_flows = $arr; + + return $this; + } + + /** + * Optional. The resource name of tools referenced by the current playbook in + * the instructions. If not provided explicitly, they are will + * be implied using the tool being referenced in goal and steps. + * + * Generated from protobuf field repeated string referenced_tools = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferencedTools() + { + return $this->referenced_tools; + } + + /** + * Optional. The resource name of tools referenced by the current playbook in + * the instructions. If not provided explicitly, they are will + * be implied using the tool being referenced in goal and steps. + * + * Generated from protobuf field repeated string referenced_tools = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferencedTools($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->referenced_tools = $arr; + + return $this; + } + + /** + * Optional. Output only. Names of inline actions scoped to this playbook. + * These actions are in addition to those belonging to referenced tools, child + * playbooks, and flows, e.g. actions that are defined in the playbook's code + * block. + * + * Generated from protobuf field repeated string inline_actions = 22 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getInlineActions() + { + return $this->inline_actions; + } + + /** + * Optional. Output only. Names of inline actions scoped to this playbook. + * These actions are in addition to those belonging to referenced tools, child + * playbooks, and flows, e.g. actions that are defined in the playbook's code + * block. + * + * Generated from protobuf field repeated string inline_actions = 22 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setInlineActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->inline_actions = $arr; + + return $this; + } + + /** + * Optional. The playbook's scoped code block, which may implement handlers + * and actions. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.CodeBlock code_block = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\CodeBlock|null + */ + public function getCodeBlock() + { + return $this->code_block; + } + + public function hasCodeBlock() + { + return isset($this->code_block); + } + + public function clearCodeBlock() + { + unset($this->code_block); + } + + /** + * Optional. The playbook's scoped code block, which may implement handlers + * and actions. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.CodeBlock code_block = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\CodeBlock $var + * @return $this + */ + public function setCodeBlock($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\CodeBlock::class); + $this->code_block = $var; + + return $this; + } + + /** + * Optional. Llm model settings for the playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings|null + */ + public function getLlmModelSettings() + { + return $this->llm_model_settings; + } + + public function hasLlmModelSettings() + { + return isset($this->llm_model_settings); + } + + public function clearLlmModelSettings() + { + unset($this->llm_model_settings); + } + + /** + * Optional. Llm model settings for the playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 14 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings $var + * @return $this + */ + public function setLlmModelSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings::class); + $this->llm_model_settings = $var; + + return $this; + } + + /** + * Optional. A list of registered handlers to execuate based on the specified + * triggers. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Handler handlers = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getHandlers() + { + return $this->handlers; + } + + /** + * Optional. A list of registered handlers to execuate based on the specified + * triggers. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Handler handlers = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Handler>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setHandlers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Handler::class); + $this->handlers = $arr; + + return $this; + } + + /** + * Optional. Type of the playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook.PlaybookType playbook_type = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPlaybookType() + { + return $this->playbook_type; + } + + /** + * Optional. Type of the playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook.PlaybookType playbook_type = 19 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPlaybookType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Playbook\PlaybookType::class); + $this->playbook_type = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Playbook/Instruction.php b/DialogflowCx/src/V3/Playbook/Instruction.php new file mode 100644 index 000000000000..ae44c9ae360a --- /dev/null +++ b/DialogflowCx/src/V3/Playbook/Instruction.php @@ -0,0 +1,114 @@ +google.cloud.dialogflow.cx.v3.Playbook.Instruction + */ +class Instruction extends \Google\Protobuf\Internal\Message +{ + /** + * General guidelines for the playbook. These are unstructured instructions + * that are not directly part of the goal, e.g. "Always be polite". It's + * valid for this text to be long and used instead of steps altogether. + * + * Generated from protobuf field string guidelines = 1; + */ + protected $guidelines = ''; + /** + * Ordered list of step by step execution instructions to accomplish + * target goal. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook.Step steps = 2; + */ + private $steps; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $guidelines + * General guidelines for the playbook. These are unstructured instructions + * that are not directly part of the goal, e.g. "Always be polite". It's + * valid for this text to be long and used instead of steps altogether. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Playbook\Step>|\Google\Protobuf\Internal\RepeatedField $steps + * Ordered list of step by step execution instructions to accomplish + * target goal. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * General guidelines for the playbook. These are unstructured instructions + * that are not directly part of the goal, e.g. "Always be polite". It's + * valid for this text to be long and used instead of steps altogether. + * + * Generated from protobuf field string guidelines = 1; + * @return string + */ + public function getGuidelines() + { + return $this->guidelines; + } + + /** + * General guidelines for the playbook. These are unstructured instructions + * that are not directly part of the goal, e.g. "Always be polite". It's + * valid for this text to be long and used instead of steps altogether. + * + * Generated from protobuf field string guidelines = 1; + * @param string $var + * @return $this + */ + public function setGuidelines($var) + { + GPBUtil::checkString($var, True); + $this->guidelines = $var; + + return $this; + } + + /** + * Ordered list of step by step execution instructions to accomplish + * target goal. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook.Step steps = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSteps() + { + return $this->steps; + } + + /** + * Ordered list of step by step execution instructions to accomplish + * target goal. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook.Step steps = 2; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Playbook\Step>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Playbook\Step::class); + $this->steps = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Playbook/PlaybookType.php b/DialogflowCx/src/V3/Playbook/PlaybookType.php new file mode 100644 index 000000000000..15f33de9c458 --- /dev/null +++ b/DialogflowCx/src/V3/Playbook/PlaybookType.php @@ -0,0 +1,62 @@ +google.cloud.dialogflow.cx.v3.Playbook.PlaybookType + */ +class PlaybookType +{ + /** + * Unspecified type. Default to TASK. + * + * Generated from protobuf enum PLAYBOOK_TYPE_UNSPECIFIED = 0; + */ + const PLAYBOOK_TYPE_UNSPECIFIED = 0; + /** + * Task playbook. + * + * Generated from protobuf enum TASK = 1; + */ + const TASK = 1; + /** + * Routine playbook. + * + * Generated from protobuf enum ROUTINE = 3; + */ + const ROUTINE = 3; + + private static $valueToName = [ + self::PLAYBOOK_TYPE_UNSPECIFIED => 'PLAYBOOK_TYPE_UNSPECIFIED', + self::TASK => 'TASK', + self::ROUTINE => 'ROUTINE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/Playbook/Step.php b/DialogflowCx/src/V3/Playbook/Step.php new file mode 100644 index 000000000000..4d82d5d9ddc9 --- /dev/null +++ b/DialogflowCx/src/V3/Playbook/Step.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.Playbook.Step + */ +class Step extends \Google\Protobuf\Internal\Message +{ + /** + * Sub-processing needed to execute the current step. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook.Step steps = 2; + */ + private $steps; + protected $instruction; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * Step instruction in text format. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Playbook\Step>|\Google\Protobuf\Internal\RepeatedField $steps + * Sub-processing needed to execute the current step. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Step instruction in text format. + * + * Generated from protobuf field string text = 1; + * @return string + */ + public function getText() + { + return $this->readOneof(1); + } + + public function hasText() + { + return $this->hasOneof(1); + } + + /** + * Step instruction in text format. + * + * Generated from protobuf field string text = 1; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Sub-processing needed to execute the current step. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook.Step steps = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSteps() + { + return $this->steps; + } + + /** + * Sub-processing needed to execute the current step. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Playbook.Step steps = 2; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Playbook\Step>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Playbook\Step::class); + $this->steps = $arr; + + return $this; + } + + /** + * @return string + */ + public function getInstruction() + { + return $this->whichOneof("instruction"); + } + +} + + diff --git a/DialogflowCx/src/V3/PlaybookImportStrategy.php b/DialogflowCx/src/V3/PlaybookImportStrategy.php new file mode 100644 index 000000000000..ea9ad2eafd83 --- /dev/null +++ b/DialogflowCx/src/V3/PlaybookImportStrategy.php @@ -0,0 +1,161 @@ +google.cloud.dialogflow.cx.v3.PlaybookImportStrategy + */ +class PlaybookImportStrategy extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Specifies the import strategy used when resolving conflicts with + * the main playbook. If not specified, 'CREATE_NEW' is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy main_playbook_import_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $main_playbook_import_strategy = 0; + /** + * Optional. Specifies the import strategy used when resolving referenced + * playbook/flow conflicts. If not specified, 'CREATE_NEW' is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy nested_resource_import_strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $nested_resource_import_strategy = 0; + /** + * Optional. Specifies the import strategy used when resolving tool conflicts. + * If not specified, 'CREATE_NEW' is assumed. This will be applied after the + * main playbook and nested resource import strategies, meaning if the + * playbook that references the tool is skipped, the tool will also be + * skipped. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy tool_import_strategy = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $tool_import_strategy = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $main_playbook_import_strategy + * Optional. Specifies the import strategy used when resolving conflicts with + * the main playbook. If not specified, 'CREATE_NEW' is assumed. + * @type int $nested_resource_import_strategy + * Optional. Specifies the import strategy used when resolving referenced + * playbook/flow conflicts. If not specified, 'CREATE_NEW' is assumed. + * @type int $tool_import_strategy + * Optional. Specifies the import strategy used when resolving tool conflicts. + * If not specified, 'CREATE_NEW' is assumed. This will be applied after the + * main playbook and nested resource import strategies, meaning if the + * playbook that references the tool is skipped, the tool will also be + * skipped. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Specifies the import strategy used when resolving conflicts with + * the main playbook. If not specified, 'CREATE_NEW' is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy main_playbook_import_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getMainPlaybookImportStrategy() + { + return $this->main_playbook_import_strategy; + } + + /** + * Optional. Specifies the import strategy used when resolving conflicts with + * the main playbook. If not specified, 'CREATE_NEW' is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy main_playbook_import_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setMainPlaybookImportStrategy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ImportStrategy::class); + $this->main_playbook_import_strategy = $var; + + return $this; + } + + /** + * Optional. Specifies the import strategy used when resolving referenced + * playbook/flow conflicts. If not specified, 'CREATE_NEW' is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy nested_resource_import_strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getNestedResourceImportStrategy() + { + return $this->nested_resource_import_strategy; + } + + /** + * Optional. Specifies the import strategy used when resolving referenced + * playbook/flow conflicts. If not specified, 'CREATE_NEW' is assumed. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy nested_resource_import_strategy = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setNestedResourceImportStrategy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ImportStrategy::class); + $this->nested_resource_import_strategy = $var; + + return $this; + } + + /** + * Optional. Specifies the import strategy used when resolving tool conflicts. + * If not specified, 'CREATE_NEW' is assumed. This will be applied after the + * main playbook and nested resource import strategies, meaning if the + * playbook that references the tool is skipped, the tool will also be + * skipped. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy tool_import_strategy = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getToolImportStrategy() + { + return $this->tool_import_strategy; + } + + /** + * Optional. Specifies the import strategy used when resolving tool conflicts. + * If not specified, 'CREATE_NEW' is assumed. This will be applied after the + * main playbook and nested resource import strategies, meaning if the + * playbook that references the tool is skipped, the tool will also be + * skipped. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ImportStrategy tool_import_strategy = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setToolImportStrategy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\ImportStrategy::class); + $this->tool_import_strategy = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/PlaybookInput.php b/DialogflowCx/src/V3/PlaybookInput.php new file mode 100644 index 000000000000..af15dc2b9b4c --- /dev/null +++ b/DialogflowCx/src/V3/PlaybookInput.php @@ -0,0 +1,71 @@ +google.cloud.dialogflow.cx.v3.PlaybookInput + */ +class PlaybookInput extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Summary string of the preceding conversation for the child + * playbook invocation. + * + * Generated from protobuf field string preceding_conversation_summary = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $preceding_conversation_summary = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $preceding_conversation_summary + * Optional. Summary string of the preceding conversation for the child + * playbook invocation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Summary string of the preceding conversation for the child + * playbook invocation. + * + * Generated from protobuf field string preceding_conversation_summary = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPrecedingConversationSummary() + { + return $this->preceding_conversation_summary; + } + + /** + * Optional. Summary string of the preceding conversation for the child + * playbook invocation. + * + * Generated from protobuf field string preceding_conversation_summary = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPrecedingConversationSummary($var) + { + GPBUtil::checkString($var, True); + $this->preceding_conversation_summary = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/PlaybookInvocation.php b/DialogflowCx/src/V3/PlaybookInvocation.php new file mode 100644 index 000000000000..25a4f80d2b90 --- /dev/null +++ b/DialogflowCx/src/V3/PlaybookInvocation.php @@ -0,0 +1,231 @@ +google.cloud.dialogflow.cx.v3.PlaybookInvocation + */ +class PlaybookInvocation extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $playbook = ''; + /** + * Output only. The display name of the playbook. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + /** + * Optional. Input of the child playbook invocation. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookInput playbook_input = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $playbook_input = null; + /** + * Optional. Output of the child playbook invocation. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookOutput playbook_output = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $playbook_output = null; + /** + * Required. Playbook invocation's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState playbook_state = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $playbook_state = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $playbook + * Required. The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * @type string $display_name + * Output only. The display name of the playbook. + * @type \Google\Cloud\Dialogflow\Cx\V3\PlaybookInput $playbook_input + * Optional. Input of the child playbook invocation. + * @type \Google\Cloud\Dialogflow\Cx\V3\PlaybookOutput $playbook_output + * Optional. Output of the child playbook invocation. + * @type int $playbook_state + * Required. Playbook invocation's output state. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getPlaybook() + { + return $this->playbook; + } + + /** + * Required. The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPlaybook($var) + { + GPBUtil::checkString($var, True); + $this->playbook = $var; + + return $this; + } + + /** + * Output only. The display name of the playbook. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. The display name of the playbook. + * + * Generated from protobuf field string display_name = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Optional. Input of the child playbook invocation. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookInput playbook_input = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\PlaybookInput|null + */ + public function getPlaybookInput() + { + return $this->playbook_input; + } + + public function hasPlaybookInput() + { + return isset($this->playbook_input); + } + + public function clearPlaybookInput() + { + unset($this->playbook_input); + } + + /** + * Optional. Input of the child playbook invocation. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookInput playbook_input = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookInput $var + * @return $this + */ + public function setPlaybookInput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PlaybookInput::class); + $this->playbook_input = $var; + + return $this; + } + + /** + * Optional. Output of the child playbook invocation. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookOutput playbook_output = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\PlaybookOutput|null + */ + public function getPlaybookOutput() + { + return $this->playbook_output; + } + + public function hasPlaybookOutput() + { + return isset($this->playbook_output); + } + + public function clearPlaybookOutput() + { + unset($this->playbook_output); + } + + /** + * Optional. Output of the child playbook invocation. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.PlaybookOutput playbook_output = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\PlaybookOutput $var + * @return $this + */ + public function setPlaybookOutput($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\PlaybookOutput::class); + $this->playbook_output = $var; + + return $this; + } + + /** + * Required. Playbook invocation's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState playbook_state = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getPlaybookState() + { + return $this->playbook_state; + } + + /** + * Required. Playbook invocation's output state. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.OutputState playbook_state = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setPlaybookState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\OutputState::class); + $this->playbook_state = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/PlaybookOutput.php b/DialogflowCx/src/V3/PlaybookOutput.php new file mode 100644 index 000000000000..0d28987f6d64 --- /dev/null +++ b/DialogflowCx/src/V3/PlaybookOutput.php @@ -0,0 +1,67 @@ +google.cloud.dialogflow.cx.v3.PlaybookOutput + */ +class PlaybookOutput extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Summary string of the execution result of the child playbook. + * + * Generated from protobuf field string execution_summary = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $execution_summary = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $execution_summary + * Optional. Summary string of the execution result of the child playbook. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Summary string of the execution result of the child playbook. + * + * Generated from protobuf field string execution_summary = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getExecutionSummary() + { + return $this->execution_summary; + } + + /** + * Optional. Summary string of the execution result of the child playbook. + * + * Generated from protobuf field string execution_summary = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setExecutionSummary($var) + { + GPBUtil::checkString($var, True); + $this->execution_summary = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/PlaybookTransition.php b/DialogflowCx/src/V3/PlaybookTransition.php new file mode 100644 index 000000000000..50316facd635 --- /dev/null +++ b/DialogflowCx/src/V3/PlaybookTransition.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.PlaybookTransition + */ +class PlaybookTransition extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $playbook = ''; + /** + * Output only. The display name of the playbook. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $playbook + * Required. The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * @type string $display_name + * Output only. The display name of the playbook. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Required. The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getPlaybook() + { + return $this->playbook; + } + + /** + * Required. The unique identifier of the playbook. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string playbook = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setPlaybook($var) + { + GPBUtil::checkString($var, True); + $this->playbook = $var; + + return $this; + } + + /** + * Output only. The display name of the playbook. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. The display name of the playbook. + * + * Generated from protobuf field string display_name = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/PlaybookVersion.php b/DialogflowCx/src/V3/PlaybookVersion.php new file mode 100644 index 000000000000..51c9821de0f8 --- /dev/null +++ b/DialogflowCx/src/V3/PlaybookVersion.php @@ -0,0 +1,235 @@ +google.cloud.dialogflow.cx.v3.PlaybookVersion + */ +class PlaybookVersion extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Optional. The description of the playbook version. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $description = ''; + /** + * Output only. Snapshot of the playbook when the playbook version is created. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $playbook = null; + /** + * Output only. Snapshot of the examples belonging to the playbook when the + * playbook version is created. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Example examples = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $examples; + /** + * Output only. Last time the playbook version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * @type string $description + * Optional. The description of the playbook version. + * @type \Google\Cloud\Dialogflow\Cx\V3\Playbook $playbook + * Output only. Snapshot of the playbook when the playbook version is created. + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Example>|\Google\Protobuf\Internal\RepeatedField $examples + * Output only. Snapshot of the examples belonging to the playbook when the + * playbook version is created. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last time the playbook version was created or modified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Optional. The description of the playbook version. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Optional. The description of the playbook version. + * + * Generated from protobuf field string description = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * Output only. Snapshot of the playbook when the playbook version is created. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Playbook|null + */ + public function getPlaybook() + { + return $this->playbook; + } + + public function hasPlaybook() + { + return isset($this->playbook); + } + + public function clearPlaybook() + { + unset($this->playbook); + } + + /** + * Output only. Snapshot of the playbook when the playbook version is created. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Playbook $var + * @return $this + */ + public function setPlaybook($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Playbook::class); + $this->playbook = $var; + + return $this; + } + + /** + * Output only. Snapshot of the examples belonging to the playbook when the + * playbook version is created. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Example examples = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExamples() + { + return $this->examples; + } + + /** + * Output only. Snapshot of the examples belonging to the playbook when the + * playbook version is created. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Example examples = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Example>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExamples($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Example::class); + $this->examples = $arr; + + return $this; + } + + /** + * Output only. Last time the playbook version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last time the playbook version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/QueryInput.php b/DialogflowCx/src/V3/QueryInput.php index 6863f4af9a54..3e09b697faa5 100644 --- a/DialogflowCx/src/V3/QueryInput.php +++ b/DialogflowCx/src/V3/QueryInput.php @@ -48,6 +48,8 @@ class QueryInput extends \Google\Protobuf\Internal\Message * The event to be triggered. * @type \Google\Cloud\Dialogflow\Cx\V3\DtmfInput $dtmf * The DTMF event to be handled. + * @type \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult $tool_call_result + * The results of a tool executed by the client. * @type string $language_code * Required. The language of the input. See [Language * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) @@ -215,6 +217,37 @@ public function setDtmf($var) return $this; } + /** + * The results of a tool executed by the client. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolCallResult tool_call_result = 11; + * @return \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult|null + */ + public function getToolCallResult() + { + return $this->readOneof(11); + } + + public function hasToolCallResult() + { + return $this->hasOneof(11); + } + + /** + * The results of a tool executed by the client. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolCallResult tool_call_result = 11; + * @param \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult $var + * @return $this + */ + public function setToolCallResult($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult::class); + $this->writeOneof(11, $var); + + return $this; + } + /** * Required. The language of the input. See [Language * Support](https://cloud.google.com/dialogflow/cx/docs/reference/language) diff --git a/DialogflowCx/src/V3/QueryParameters.php b/DialogflowCx/src/V3/QueryParameters.php index 96d3113703c4..1bbcaa1d5f73 100644 --- a/DialogflowCx/src/V3/QueryParameters.php +++ b/DialogflowCx/src/V3/QueryParameters.php @@ -78,6 +78,16 @@ class QueryParameters extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Struct parameters = 5; */ protected $parameters = null; + /** + * Scope for the parameters. If not specified, parameters will be treated as + * session parameters. Parameters with custom scope will not be put into + * [session parameters][google.cloud.dialogflow.cx.v3.SessionInfo.parameters]. + * You can reference the parameters with custom scope in the agent with the + * following format: $parameter-scope.params.parameter-id. + * + * Generated from protobuf field string parameter_scope = 12; + */ + protected $parameter_scope = ''; /** * The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to * override the [current page][QueryResult.current_page] in the session. @@ -133,6 +143,23 @@ class QueryParameters extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated string flow_versions = 14 [(.google.api.resource_reference) = { */ private $flow_versions; + /** + * Optional. The unique identifier of the + * [playbook][google.cloud.dialogflow.cx.v3.Playbook] to start or continue the + * session with. If `current_playbook` is specified, the previous state of the + * session will be ignored by Dialogflow. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string current_playbook = 19 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $current_playbook = ''; + /** + * Optional. Use the specified LLM model settings for processing the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 21 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $llm_model_settings = null; /** * The channel which this query is for. * If specified, only the @@ -243,6 +270,12 @@ class QueryParameters extends \Google\Protobuf\Internal\Message * * MapValue value: If parameter's entity type is a composite entity then use * map from composite entity property names to property values, otherwise, * use parameter value. + * @type string $parameter_scope + * Scope for the parameters. If not specified, parameters will be treated as + * session parameters. Parameters with custom scope will not be put into + * [session parameters][google.cloud.dialogflow.cx.v3.SessionInfo.parameters]. + * You can reference the parameters with custom scope in the agent with the + * following format: $parameter-scope.params.parameter-id. * @type string $current_page * The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to * override the [current page][QueryResult.current_page] in the session. @@ -278,6 +311,15 @@ class QueryParameters extends \Google\Protobuf\Internal\Message * flow X will go through version 1 regardless of the version configuration in * the environment. Each flow can have at most one version specified in this * list. + * @type string $current_playbook + * Optional. The unique identifier of the + * [playbook][google.cloud.dialogflow.cx.v3.Playbook] to start or continue the + * session with. If `current_playbook` is specified, the previous state of the + * session will be ignored by Dialogflow. + * Format: + * `projects//locations//agents//playbooks/`. + * @type \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings $llm_model_settings + * Optional. Use the specified LLM model settings for processing the request. * @type string $channel * The channel which this query is for. * If specified, only the @@ -550,6 +592,40 @@ public function setParameters($var) return $this; } + /** + * Scope for the parameters. If not specified, parameters will be treated as + * session parameters. Parameters with custom scope will not be put into + * [session parameters][google.cloud.dialogflow.cx.v3.SessionInfo.parameters]. + * You can reference the parameters with custom scope in the agent with the + * following format: $parameter-scope.params.parameter-id. + * + * Generated from protobuf field string parameter_scope = 12; + * @return string + */ + public function getParameterScope() + { + return $this->parameter_scope; + } + + /** + * Scope for the parameters. If not specified, parameters will be treated as + * session parameters. Parameters with custom scope will not be put into + * [session parameters][google.cloud.dialogflow.cx.v3.SessionInfo.parameters]. + * You can reference the parameters with custom scope in the agent with the + * following format: $parameter-scope.params.parameter-id. + * + * Generated from protobuf field string parameter_scope = 12; + * @param string $var + * @return $this + */ + public function setParameterScope($var) + { + GPBUtil::checkString($var, True); + $this->parameter_scope = $var; + + return $this; + } + /** * The unique identifier of the [page][google.cloud.dialogflow.cx.v3.Page] to * override the [current page][QueryResult.current_page] in the session. @@ -730,6 +806,78 @@ public function setFlowVersions($var) return $this; } + /** + * Optional. The unique identifier of the + * [playbook][google.cloud.dialogflow.cx.v3.Playbook] to start or continue the + * session with. If `current_playbook` is specified, the previous state of the + * session will be ignored by Dialogflow. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string current_playbook = 19 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getCurrentPlaybook() + { + return $this->current_playbook; + } + + /** + * Optional. The unique identifier of the + * [playbook][google.cloud.dialogflow.cx.v3.Playbook] to start or continue the + * session with. If `current_playbook` is specified, the previous state of the + * session will be ignored by Dialogflow. + * Format: + * `projects//locations//agents//playbooks/`. + * + * Generated from protobuf field string current_playbook = 19 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setCurrentPlaybook($var) + { + GPBUtil::checkString($var, True); + $this->current_playbook = $var; + + return $this; + } + + /** + * Optional. Use the specified LLM model settings for processing the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings|null + */ + public function getLlmModelSettings() + { + return $this->llm_model_settings; + } + + public function hasLlmModelSettings() + { + return isset($this->llm_model_settings); + } + + public function clearLlmModelSettings() + { + unset($this->llm_model_settings); + } + + /** + * Optional. Use the specified LLM model settings for processing the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.LlmModelSettings llm_model_settings = 21 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings $var + * @return $this + */ + public function setLlmModelSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\LlmModelSettings::class); + $this->llm_model_settings = $var; + + return $this; + } + /** * The channel which this query is for. * If specified, only the diff --git a/DialogflowCx/src/V3/QueryResult.php b/DialogflowCx/src/V3/QueryResult.php index 0f7e300577b3..128462621172 100644 --- a/DialogflowCx/src/V3/QueryResult.php +++ b/DialogflowCx/src/V3/QueryResult.php @@ -50,30 +50,6 @@ class QueryResult extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.ResponseMessage response_messages = 4; */ private $response_messages; - /** - * The list of webhook ids in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_ids = 25; - */ - private $webhook_ids; - /** - * The list of webhook display names in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_display_names = 26; - */ - private $webhook_display_names; - /** - * The list of webhook latencies in the order of call sequence. - * - * Generated from protobuf field repeated .google.protobuf.Duration webhook_latencies = 27; - */ - private $webhook_latencies; - /** - * The list of webhook tags in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_tags = 29; - */ - private $webhook_tags; /** * The list of webhook call status in the order of call sequence. * @@ -240,14 +216,6 @@ class QueryResult extends \Google\Protobuf\Internal\Message * The list of rich messages returned to the client. Responses vary from * simple text messages to more sophisticated, structured payloads used * to drive complex logic. - * @type array|\Google\Protobuf\Internal\RepeatedField $webhook_ids - * The list of webhook ids in the order of call sequence. - * @type array|\Google\Protobuf\Internal\RepeatedField $webhook_display_names - * The list of webhook display names in the order of call sequence. - * @type array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $webhook_latencies - * The list of webhook latencies in the order of call sequence. - * @type array|\Google\Protobuf\Internal\RepeatedField $webhook_tags - * The list of webhook tags in the order of call sequence. * @type array<\Google\Rpc\Status>|\Google\Protobuf\Internal\RepeatedField $webhook_statuses * The list of webhook call status in the order of call sequence. * @type array<\Google\Protobuf\Struct>|\Google\Protobuf\Internal\RepeatedField $webhook_payloads @@ -615,110 +583,6 @@ public function setResponseMessages($var) return $this; } - /** - * The list of webhook ids in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_ids = 25; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getWebhookIds() - { - return $this->webhook_ids; - } - - /** - * The list of webhook ids in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_ids = 25; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setWebhookIds($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->webhook_ids = $arr; - - return $this; - } - - /** - * The list of webhook display names in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_display_names = 26; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getWebhookDisplayNames() - { - return $this->webhook_display_names; - } - - /** - * The list of webhook display names in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_display_names = 26; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setWebhookDisplayNames($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->webhook_display_names = $arr; - - return $this; - } - - /** - * The list of webhook latencies in the order of call sequence. - * - * Generated from protobuf field repeated .google.protobuf.Duration webhook_latencies = 27; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getWebhookLatencies() - { - return $this->webhook_latencies; - } - - /** - * The list of webhook latencies in the order of call sequence. - * - * Generated from protobuf field repeated .google.protobuf.Duration webhook_latencies = 27; - * @param array<\Google\Protobuf\Duration>|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setWebhookLatencies($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Protobuf\Duration::class); - $this->webhook_latencies = $arr; - - return $this; - } - - /** - * The list of webhook tags in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_tags = 29; - * @return \Google\Protobuf\Internal\RepeatedField - */ - public function getWebhookTags() - { - return $this->webhook_tags; - } - - /** - * The list of webhook tags in the order of call sequence. - * - * Generated from protobuf field repeated string webhook_tags = 29; - * @param array|\Google\Protobuf\Internal\RepeatedField $var - * @return $this - */ - public function setWebhookTags($var) - { - $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); - $this->webhook_tags = $arr; - - return $this; - } - /** * The list of webhook call status in the order of call sequence. * diff --git a/DialogflowCx/src/V3/ResponseMessage.php b/DialogflowCx/src/V3/ResponseMessage.php index d580b0250e4d..927621442c9b 100644 --- a/DialogflowCx/src/V3/ResponseMessage.php +++ b/DialogflowCx/src/V3/ResponseMessage.php @@ -86,6 +86,9 @@ class ResponseMessage extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\Dialogflow\Cx\V3\ResponseMessage\KnowledgeInfoCard $knowledge_info_card * Represents info card for knowledge answers, to be better rendered in * Dialogflow Messenger. + * @type \Google\Cloud\Dialogflow\Cx\V3\ToolCall $tool_call + * Returns the definition of a tool call that should be executed by the + * client. * @type int $response_type * Response type. * @type string $channel @@ -440,6 +443,39 @@ public function setKnowledgeInfoCard($var) return $this; } + /** + * Returns the definition of a tool call that should be executed by the + * client. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolCall tool_call = 22; + * @return \Google\Cloud\Dialogflow\Cx\V3\ToolCall|null + */ + public function getToolCall() + { + return $this->readOneof(22); + } + + public function hasToolCall() + { + return $this->hasOneof(22); + } + + /** + * Returns the definition of a tool call that should be executed by the + * client. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolCall tool_call = 22; + * @param \Google\Cloud\Dialogflow\Cx\V3\ToolCall $var + * @return $this + */ + public function setToolCall($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ToolCall::class); + $this->writeOneof(22, $var); + + return $this; + } + /** * Response type. * diff --git a/DialogflowCx/src/V3/RestorePlaybookVersionRequest.php b/DialogflowCx/src/V3/RestorePlaybookVersionRequest.php new file mode 100644 index 000000000000..4848322acf35 --- /dev/null +++ b/DialogflowCx/src/V3/RestorePlaybookVersionRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.RestorePlaybookVersionRequest + */ +class RestorePlaybookVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. Please see + * {@see PlaybooksClient::playbookVersionName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\RestorePlaybookVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the playbook version. + * Format: + * `projects//locations//agents//playbooks//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RestorePlaybookVersionResponse.php b/DialogflowCx/src/V3/RestorePlaybookVersionResponse.php new file mode 100644 index 000000000000..d1f8477a14ee --- /dev/null +++ b/DialogflowCx/src/V3/RestorePlaybookVersionResponse.php @@ -0,0 +1,78 @@ +google.cloud.dialogflow.cx.v3.RestorePlaybookVersionResponse + */ +class RestorePlaybookVersionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The updated playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 2; + */ + protected $playbook = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Playbook $playbook + * The updated playbook. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * The updated playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\Playbook|null + */ + public function getPlaybook() + { + return $this->playbook; + } + + public function hasPlaybook() + { + return isset($this->playbook); + } + + public function clearPlaybook() + { + unset($this->playbook); + } + + /** + * The updated playbook. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\Playbook $var + * @return $this + */ + public function setPlaybook($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Playbook::class); + $this->playbook = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RestoreToolVersionRequest.php b/DialogflowCx/src/V3/RestoreToolVersionRequest.php new file mode 100644 index 000000000000..501e069b0cae --- /dev/null +++ b/DialogflowCx/src/V3/RestoreToolVersionRequest.php @@ -0,0 +1,92 @@ +google.cloud.dialogflow.cx.v3.RestoreToolVersionRequest + */ +class RestoreToolVersionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. Please see + * {@see ToolsClient::toolVersionName()} for help formatting this field. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\RestoreToolVersionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The name of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/RestoreToolVersionResponse.php b/DialogflowCx/src/V3/RestoreToolVersionResponse.php new file mode 100644 index 000000000000..b7ed819c70e9 --- /dev/null +++ b/DialogflowCx/src/V3/RestoreToolVersionResponse.php @@ -0,0 +1,78 @@ +google.cloud.dialogflow.cx.v3.RestoreToolVersionResponse + */ +class RestoreToolVersionResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The updated tool. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 2; + */ + protected $tool = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool $tool + * The updated tool. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * The updated tool. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool|null + */ + public function getTool() + { + return $this->tool; + } + + public function hasTool() + { + return isset($this->tool); + } + + public function clearTool() + { + unset($this->tool); + } + + /** + * The updated tool. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool $var + * @return $this + */ + public function setTool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool::class); + $this->tool = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/SafetySettings.php b/DialogflowCx/src/V3/SafetySettings.php index 0f5f366bfe5d..b3870547e05a 100644 --- a/DialogflowCx/src/V3/SafetySettings.php +++ b/DialogflowCx/src/V3/SafetySettings.php @@ -15,12 +15,38 @@ */ class SafetySettings extends \Google\Protobuf\Internal\Message { + /** + * Optional. Default phrase match strategy for banned phrases. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.PhraseMatchStrategy default_banned_phrase_match_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $default_banned_phrase_match_strategy = 0; /** * Banned phrases for generated text. * * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SafetySettings.Phrase banned_phrases = 1; */ private $banned_phrases; + /** + * Optional. Settings for Responsible AI checks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings rai_settings = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $rai_settings = null; + /** + * Optional. Immutable. Default RAI settings to be annotated on the agent, so + * that users will be able to restore their RAI configurations to the default + * settings. Read-only field for the API proto only. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings default_rai_settings = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $default_rai_settings = null; + /** + * Optional. Settings for prompt security checks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.PromptSecuritySettings prompt_security_settings = 8 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $prompt_security_settings = null; /** * Constructor. @@ -28,8 +54,18 @@ class SafetySettings extends \Google\Protobuf\Internal\Message * @param array $data { * Optional. Data for populating the Message object. * + * @type int $default_banned_phrase_match_strategy + * Optional. Default phrase match strategy for banned phrases. * @type array<\Google\Cloud\Dialogflow\Cx\V3\SafetySettings\Phrase>|\Google\Protobuf\Internal\RepeatedField $banned_phrases * Banned phrases for generated text. + * @type \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings $rai_settings + * Optional. Settings for Responsible AI checks. + * @type \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings $default_rai_settings + * Optional. Immutable. Default RAI settings to be annotated on the agent, so + * that users will be able to restore their RAI configurations to the default + * settings. Read-only field for the API proto only. + * @type \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\PromptSecuritySettings $prompt_security_settings + * Optional. Settings for prompt security checks. * } */ public function __construct($data = NULL) { @@ -37,6 +73,32 @@ public function __construct($data = NULL) { parent::__construct($data); } + /** + * Optional. Default phrase match strategy for banned phrases. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.PhraseMatchStrategy default_banned_phrase_match_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getDefaultBannedPhraseMatchStrategy() + { + return $this->default_banned_phrase_match_strategy; + } + + /** + * Optional. Default phrase match strategy for banned phrases. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.PhraseMatchStrategy default_banned_phrase_match_strategy = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setDefaultBannedPhraseMatchStrategy($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\PhraseMatchStrategy::class); + $this->default_banned_phrase_match_strategy = $var; + + return $this; + } + /** * Banned phrases for generated text. * @@ -63,5 +125,117 @@ public function setBannedPhrases($var) return $this; } + /** + * Optional. Settings for Responsible AI checks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings rai_settings = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings|null + */ + public function getRaiSettings() + { + return $this->rai_settings; + } + + public function hasRaiSettings() + { + return isset($this->rai_settings); + } + + public function clearRaiSettings() + { + unset($this->rai_settings); + } + + /** + * Optional. Settings for Responsible AI checks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings rai_settings = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings $var + * @return $this + */ + public function setRaiSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings::class); + $this->rai_settings = $var; + + return $this; + } + + /** + * Optional. Immutable. Default RAI settings to be annotated on the agent, so + * that users will be able to restore their RAI configurations to the default + * settings. Read-only field for the API proto only. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings default_rai_settings = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = IMMUTABLE]; + * @return \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings|null + */ + public function getDefaultRaiSettings() + { + return $this->default_rai_settings; + } + + public function hasDefaultRaiSettings() + { + return isset($this->default_rai_settings); + } + + public function clearDefaultRaiSettings() + { + unset($this->default_rai_settings); + } + + /** + * Optional. Immutable. Default RAI settings to be annotated on the agent, so + * that users will be able to restore their RAI configurations to the default + * settings. Read-only field for the API proto only. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings default_rai_settings = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_behavior) = IMMUTABLE]; + * @param \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings $var + * @return $this + */ + public function setDefaultRaiSettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings::class); + $this->default_rai_settings = $var; + + return $this; + } + + /** + * Optional. Settings for prompt security checks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.PromptSecuritySettings prompt_security_settings = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\PromptSecuritySettings|null + */ + public function getPromptSecuritySettings() + { + return $this->prompt_security_settings; + } + + public function hasPromptSecuritySettings() + { + return isset($this->prompt_security_settings); + } + + public function clearPromptSecuritySettings() + { + unset($this->prompt_security_settings); + } + + /** + * Optional. Settings for prompt security checks. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.PromptSecuritySettings prompt_security_settings = 8 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\PromptSecuritySettings $var + * @return $this + */ + public function setPromptSecuritySettings($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\PromptSecuritySettings::class); + $this->prompt_security_settings = $var; + + return $this; + } + } diff --git a/DialogflowCx/src/V3/SafetySettings/PhraseMatchStrategy.php b/DialogflowCx/src/V3/SafetySettings/PhraseMatchStrategy.php new file mode 100644 index 000000000000..0d2be5dad709 --- /dev/null +++ b/DialogflowCx/src/V3/SafetySettings/PhraseMatchStrategy.php @@ -0,0 +1,64 @@ +google.cloud.dialogflow.cx.v3.SafetySettings.PhraseMatchStrategy + */ +class PhraseMatchStrategy +{ + /** + * Unspecified, defaults to PARTIAL_MATCH. + * + * Generated from protobuf enum PHRASE_MATCH_STRATEGY_UNSPECIFIED = 0; + */ + const PHRASE_MATCH_STRATEGY_UNSPECIFIED = 0; + /** + * Text that contains the phrase as a substring will be matched, e.g. "foo" + * will match "afoobar". + * + * Generated from protobuf enum PARTIAL_MATCH = 1; + */ + const PARTIAL_MATCH = 1; + /** + * Text that contains the tokenized words of the phrase will be matched, + * e.g. "foo" will match "a foo bar" and "foo bar", but not "foobar". + * + * Generated from protobuf enum WORD_MATCH = 2; + */ + const WORD_MATCH = 2; + + private static $valueToName = [ + self::PHRASE_MATCH_STRATEGY_UNSPECIFIED => 'PHRASE_MATCH_STRATEGY_UNSPECIFIED', + self::PARTIAL_MATCH => 'PARTIAL_MATCH', + self::WORD_MATCH => 'WORD_MATCH', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/SafetySettings/PromptSecuritySettings.php b/DialogflowCx/src/V3/SafetySettings/PromptSecuritySettings.php new file mode 100644 index 000000000000..403eabe7212f --- /dev/null +++ b/DialogflowCx/src/V3/SafetySettings/PromptSecuritySettings.php @@ -0,0 +1,68 @@ +google.cloud.dialogflow.cx.v3.SafetySettings.PromptSecuritySettings + */ +class PromptSecuritySettings extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Enable prompt security checks. + * + * Generated from protobuf field bool enable_prompt_security = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $enable_prompt_security = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable_prompt_security + * Optional. Enable prompt security checks. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SafetySettings::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Enable prompt security checks. + * + * Generated from protobuf field bool enable_prompt_security = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return bool + */ + public function getEnablePromptSecurity() + { + return $this->enable_prompt_security; + } + + /** + * Optional. Enable prompt security checks. + * + * Generated from protobuf field bool enable_prompt_security = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param bool $var + * @return $this + */ + public function setEnablePromptSecurity($var) + { + GPBUtil::checkBool($var); + $this->enable_prompt_security = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/SafetySettings/RaiSettings.php b/DialogflowCx/src/V3/SafetySettings/RaiSettings.php new file mode 100644 index 000000000000..023fe6af2045 --- /dev/null +++ b/DialogflowCx/src/V3/SafetySettings/RaiSettings.php @@ -0,0 +1,68 @@ +google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings + */ +class RaiSettings extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. RAI blocking configurations. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.CategoryFilter category_filters = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $category_filters; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings\CategoryFilter>|\Google\Protobuf\Internal\RepeatedField $category_filters + * Optional. RAI blocking configurations. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SafetySettings::initOnce(); + parent::__construct($data); + } + + /** + * Optional. RAI blocking configurations. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.CategoryFilter category_filters = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCategoryFilters() + { + return $this->category_filters; + } + + /** + * Optional. RAI blocking configurations. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.CategoryFilter category_filters = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings\CategoryFilter>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCategoryFilters($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings\CategoryFilter::class); + $this->category_filters = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/SafetySettings/RaiSettings/CategoryFilter.php b/DialogflowCx/src/V3/SafetySettings/RaiSettings/CategoryFilter.php new file mode 100644 index 000000000000..d4444039cd68 --- /dev/null +++ b/DialogflowCx/src/V3/SafetySettings/RaiSettings/CategoryFilter.php @@ -0,0 +1,102 @@ +google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.CategoryFilter + */ +class CategoryFilter extends \Google\Protobuf\Internal\Message +{ + /** + * RAI category to configure. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.SafetyCategory category = 1; + */ + protected $category = 0; + /** + * Blocking sensitivity level to configure for the RAI category. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.SafetyFilterLevel filter_level = 2; + */ + protected $filter_level = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $category + * RAI category to configure. + * @type int $filter_level + * Blocking sensitivity level to configure for the RAI category. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\SafetySettings::initOnce(); + parent::__construct($data); + } + + /** + * RAI category to configure. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.SafetyCategory category = 1; + * @return int + */ + public function getCategory() + { + return $this->category; + } + + /** + * RAI category to configure. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.SafetyCategory category = 1; + * @param int $var + * @return $this + */ + public function setCategory($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings\SafetyCategory::class); + $this->category = $var; + + return $this; + } + + /** + * Blocking sensitivity level to configure for the RAI category. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.SafetyFilterLevel filter_level = 2; + * @return int + */ + public function getFilterLevel() + { + return $this->filter_level; + } + + /** + * Blocking sensitivity level to configure for the RAI category. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.SafetyFilterLevel filter_level = 2; + * @param int $var + * @return $this + */ + public function setFilterLevel($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\SafetySettings\RaiSettings\SafetyFilterLevel::class); + $this->filter_level = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/SafetySettings/RaiSettings/SafetyCategory.php b/DialogflowCx/src/V3/SafetySettings/RaiSettings/SafetyCategory.php new file mode 100644 index 000000000000..7a3a23c5ec4d --- /dev/null +++ b/DialogflowCx/src/V3/SafetySettings/RaiSettings/SafetyCategory.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.SafetyCategory + */ +class SafetyCategory +{ + /** + * Unspecified. + * + * Generated from protobuf enum SAFETY_CATEGORY_UNSPECIFIED = 0; + */ + const SAFETY_CATEGORY_UNSPECIFIED = 0; + /** + * Dangerous content. + * + * Generated from protobuf enum DANGEROUS_CONTENT = 1; + */ + const DANGEROUS_CONTENT = 1; + /** + * Hate speech. + * + * Generated from protobuf enum HATE_SPEECH = 2; + */ + const HATE_SPEECH = 2; + /** + * Harassment. + * + * Generated from protobuf enum HARASSMENT = 3; + */ + const HARASSMENT = 3; + /** + * Sexually explicit content. + * + * Generated from protobuf enum SEXUALLY_EXPLICIT_CONTENT = 4; + */ + const SEXUALLY_EXPLICIT_CONTENT = 4; + + private static $valueToName = [ + self::SAFETY_CATEGORY_UNSPECIFIED => 'SAFETY_CATEGORY_UNSPECIFIED', + self::DANGEROUS_CONTENT => 'DANGEROUS_CONTENT', + self::HATE_SPEECH => 'HATE_SPEECH', + self::HARASSMENT => 'HARASSMENT', + self::SEXUALLY_EXPLICIT_CONTENT => 'SEXUALLY_EXPLICIT_CONTENT', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/SafetySettings/RaiSettings/SafetyFilterLevel.php b/DialogflowCx/src/V3/SafetySettings/RaiSettings/SafetyFilterLevel.php new file mode 100644 index 000000000000..a2d5b714370a --- /dev/null +++ b/DialogflowCx/src/V3/SafetySettings/RaiSettings/SafetyFilterLevel.php @@ -0,0 +1,76 @@ +google.cloud.dialogflow.cx.v3.SafetySettings.RaiSettings.SafetyFilterLevel + */ +class SafetyFilterLevel +{ + /** + * Unspecified -- uses default sensitivity levels. + * + * Generated from protobuf enum SAFETY_FILTER_LEVEL_UNSPECIFIED = 0; + */ + const SAFETY_FILTER_LEVEL_UNSPECIFIED = 0; + /** + * Block no text -- effectively disables the category. + * + * Generated from protobuf enum BLOCK_NONE = 1; + */ + const BLOCK_NONE = 1; + /** + * Block a few suspicious texts. + * + * Generated from protobuf enum BLOCK_FEW = 2; + */ + const BLOCK_FEW = 2; + /** + * Block some suspicious texts. + * + * Generated from protobuf enum BLOCK_SOME = 3; + */ + const BLOCK_SOME = 3; + /** + * Block most suspicious texts. + * + * Generated from protobuf enum BLOCK_MOST = 4; + */ + const BLOCK_MOST = 4; + + private static $valueToName = [ + self::SAFETY_FILTER_LEVEL_UNSPECIFIED => 'SAFETY_FILTER_LEVEL_UNSPECIFIED', + self::BLOCK_NONE => 'BLOCK_NONE', + self::BLOCK_FEW => 'BLOCK_FEW', + self::BLOCK_SOME => 'BLOCK_SOME', + self::BLOCK_MOST => 'BLOCK_MOST', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/SecuritySettings/AudioExportSettings.php b/DialogflowCx/src/V3/SecuritySettings/AudioExportSettings.php index a9f833bc172e..fbe4942c4d9d 100644 --- a/DialogflowCx/src/V3/SecuritySettings/AudioExportSettings.php +++ b/DialogflowCx/src/V3/SecuritySettings/AudioExportSettings.php @@ -27,6 +27,9 @@ class AudioExportSettings extends \Google\Protobuf\Internal\Message protected $gcs_bucket = ''; /** * Filename pattern for exported audio. + * {conversation} and {timestamp} are placeholders that will be replaced + * with the conversation ID and epoch micros of the conversation. + * For example, "{conversation}/recording_{timestamp}.mulaw". * * Generated from protobuf field string audio_export_pattern = 2; */ @@ -68,6 +71,9 @@ class AudioExportSettings extends \Google\Protobuf\Internal\Message * storage.buckets.setIamPolicy. * @type string $audio_export_pattern * Filename pattern for exported audio. + * {conversation} and {timestamp} are placeholders that will be replaced + * with the conversation ID and epoch micros of the conversation. + * For example, "{conversation}/recording_{timestamp}.mulaw". * @type bool $enable_audio_redaction * Enable audio redaction if it is true. * Note that this only redacts end-user audio data; @@ -121,6 +127,9 @@ public function setGcsBucket($var) /** * Filename pattern for exported audio. + * {conversation} and {timestamp} are placeholders that will be replaced + * with the conversation ID and epoch micros of the conversation. + * For example, "{conversation}/recording_{timestamp}.mulaw". * * Generated from protobuf field string audio_export_pattern = 2; * @return string @@ -132,6 +141,9 @@ public function getAudioExportPattern() /** * Filename pattern for exported audio. + * {conversation} and {timestamp} are placeholders that will be replaced + * with the conversation ID and epoch micros of the conversation. + * For example, "{conversation}/recording_{timestamp}.mulaw". * * Generated from protobuf field string audio_export_pattern = 2; * @param string $var diff --git a/DialogflowCx/src/V3/StreamingDetectIntentRequest.php b/DialogflowCx/src/V3/StreamingDetectIntentRequest.php index 019691f7ff2e..5a2b556d4590 100644 --- a/DialogflowCx/src/V3/StreamingDetectIntentRequest.php +++ b/DialogflowCx/src/V3/StreamingDetectIntentRequest.php @@ -95,6 +95,14 @@ class StreamingDetectIntentRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool enable_debugging_info = 8; */ protected $enable_debugging_info = false; + /** + * Optional. Specifies which fields in the + * [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] to return. If not + * set, the default is DETECT_INTENT_RESPONSE_VIEW_FULL. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponseView response_view = 16 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $response_view = 0; /** * Constructor. @@ -132,6 +140,10 @@ class StreamingDetectIntentRequest extends \Google\Protobuf\Internal\Message * responses. * @type bool $enable_debugging_info * If true, `StreamingDetectIntentResponse.debugging_info` will get populated. + * @type int $response_view + * Optional. Specifies which fields in the + * [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] to return. If not + * set, the default is DETECT_INTENT_RESPONSE_VIEW_FULL. * } */ public function __construct($data = NULL) { @@ -361,5 +373,35 @@ public function setEnableDebuggingInfo($var) return $this; } + /** + * Optional. Specifies which fields in the + * [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] to return. If not + * set, the default is DETECT_INTENT_RESPONSE_VIEW_FULL. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponseView response_view = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getResponseView() + { + return $this->response_view; + } + + /** + * Optional. Specifies which fields in the + * [QueryResult][google.cloud.dialogflow.cx.v3.QueryResult] to return. If not + * set, the default is DETECT_INTENT_RESPONSE_VIEW_FULL. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.DetectIntentResponseView response_view = 16 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setResponseView($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\DetectIntentResponseView::class); + $this->response_view = $var; + + return $this; + } + } diff --git a/DialogflowCx/src/V3/Tool.php b/DialogflowCx/src/V3/Tool.php new file mode 100644 index 000000000000..4f3563470ad2 --- /dev/null +++ b/DialogflowCx/src/V3/Tool.php @@ -0,0 +1,288 @@ +google.cloud.dialogflow.cx.v3.Tool + */ +class Tool extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of the Tool. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Required. The human-readable name of the Tool, unique within an agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Required. High level description of the Tool and its usage. + * + * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $description = ''; + /** + * Output only. The tool type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.ToolType tool_type = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $tool_type = 0; + protected $specification; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The unique identifier of the Tool. + * Format: + * `projects//locations//agents//tools/`. + * @type string $display_name + * Required. The human-readable name of the Tool, unique within an agent. + * @type string $description + * Required. High level description of the Tool and its usage. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\OpenApiTool $open_api_spec + * OpenAPI specification of the Tool. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\DataStoreTool $data_store_spec + * Data store search tool specification. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\FunctionTool $function_spec + * Client side executed function specification. + * @type int $tool_type + * Output only. The tool type. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of the Tool. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The unique identifier of the Tool. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The human-readable name of the Tool, unique within an agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The human-readable name of the Tool, unique within an agent. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. High level description of the Tool and its usage. + * + * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Required. High level description of the Tool and its usage. + * + * Generated from protobuf field string description = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * OpenAPI specification of the Tool. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.OpenApiTool open_api_spec = 4; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\OpenApiTool|null + */ + public function getOpenApiSpec() + { + return $this->readOneof(4); + } + + public function hasOpenApiSpec() + { + return $this->hasOneof(4); + } + + /** + * OpenAPI specification of the Tool. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.OpenApiTool open_api_spec = 4; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\OpenApiTool $var + * @return $this + */ + public function setOpenApiSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\OpenApiTool::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Data store search tool specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.DataStoreTool data_store_spec = 8; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\DataStoreTool|null + */ + public function getDataStoreSpec() + { + return $this->readOneof(8); + } + + public function hasDataStoreSpec() + { + return $this->hasOneof(8); + } + + /** + * Data store search tool specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.DataStoreTool data_store_spec = 8; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\DataStoreTool $var + * @return $this + */ + public function setDataStoreSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\DataStoreTool::class); + $this->writeOneof(8, $var); + + return $this; + } + + /** + * Client side executed function specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.FunctionTool function_spec = 13; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\FunctionTool|null + */ + public function getFunctionSpec() + { + return $this->readOneof(13); + } + + public function hasFunctionSpec() + { + return $this->hasOneof(13); + } + + /** + * Client side executed function specification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.FunctionTool function_spec = 13; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\FunctionTool $var + * @return $this + */ + public function setFunctionSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\FunctionTool::class); + $this->writeOneof(13, $var); + + return $this; + } + + /** + * Output only. The tool type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.ToolType tool_type = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return int + */ + public function getToolType() + { + return $this->tool_type; + } + + /** + * Output only. The tool type. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.ToolType tool_type = 12 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param int $var + * @return $this + */ + public function setToolType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\ToolType::class); + $this->tool_type = $var; + + return $this; + } + + /** + * @return string + */ + public function getSpecification() + { + return $this->whichOneof("specification"); + } + +} + diff --git a/DialogflowCx/src/V3/Tool/Authentication.php b/DialogflowCx/src/V3/Tool/Authentication.php new file mode 100644 index 000000000000..09ba832f4b24 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication.php @@ -0,0 +1,214 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication + */ +class Authentication extends \Google\Protobuf\Internal\Message +{ + protected $auth_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ApiKeyConfig $api_key_config + * Config for API key auth. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\OAuthConfig $oauth_config + * Config for OAuth. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAgentAuthConfig $service_agent_auth_config + * Config for [Diglogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent) + * auth. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\BearerTokenConfig $bearer_token_config + * Config for bearer token auth. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAccountAuthConfig $service_account_auth_config + * Configuration for service account authentication. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Config for API key auth. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ApiKeyConfig api_key_config = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ApiKeyConfig|null + */ + public function getApiKeyConfig() + { + return $this->readOneof(1); + } + + public function hasApiKeyConfig() + { + return $this->hasOneof(1); + } + + /** + * Config for API key auth. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ApiKeyConfig api_key_config = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ApiKeyConfig $var + * @return $this + */ + public function setApiKeyConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ApiKeyConfig::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Config for OAuth. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.OAuthConfig oauth_config = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\OAuthConfig|null + */ + public function getOauthConfig() + { + return $this->readOneof(2); + } + + public function hasOauthConfig() + { + return $this->hasOneof(2); + } + + /** + * Config for OAuth. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.OAuthConfig oauth_config = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\OAuthConfig $var + * @return $this + */ + public function setOauthConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\OAuthConfig::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Config for [Diglogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent) + * auth. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAgentAuthConfig service_agent_auth_config = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAgentAuthConfig|null + */ + public function getServiceAgentAuthConfig() + { + return $this->readOneof(3); + } + + public function hasServiceAgentAuthConfig() + { + return $this->hasOneof(3); + } + + /** + * Config for [Diglogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent) + * auth. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAgentAuthConfig service_agent_auth_config = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAgentAuthConfig $var + * @return $this + */ + public function setServiceAgentAuthConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAgentAuthConfig::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * Config for bearer token auth. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.BearerTokenConfig bearer_token_config = 4; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\BearerTokenConfig|null + */ + public function getBearerTokenConfig() + { + return $this->readOneof(4); + } + + public function hasBearerTokenConfig() + { + return $this->hasOneof(4); + } + + /** + * Config for bearer token auth. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.BearerTokenConfig bearer_token_config = 4; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\BearerTokenConfig $var + * @return $this + */ + public function setBearerTokenConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\BearerTokenConfig::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * Configuration for service account authentication. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAccountAuthConfig service_account_auth_config = 5; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAccountAuthConfig|null + */ + public function getServiceAccountAuthConfig() + { + return $this->readOneof(5); + } + + public function hasServiceAccountAuthConfig() + { + return $this->hasOneof(5); + } + + /** + * Configuration for service account authentication. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAccountAuthConfig service_account_auth_config = 5; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAccountAuthConfig $var + * @return $this + */ + public function setServiceAccountAuthConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAccountAuthConfig::class); + $this->writeOneof(5, $var); + + return $this; + } + + /** + * @return string + */ + public function getAuthConfig() + { + return $this->whichOneof("auth_config"); + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/Authentication/ApiKeyConfig.php b/DialogflowCx/src/V3/Tool/Authentication/ApiKeyConfig.php new file mode 100644 index 000000000000..36e5f40f4532 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication/ApiKeyConfig.php @@ -0,0 +1,190 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication.ApiKeyConfig + */ +class ApiKeyConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The parameter name or the header name of the API key. + * E.g., If the API request is "https://example.com/act?X-Api-Key=", "X-Api-Key" would be the parameter name. + * + * Generated from protobuf field string key_name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $key_name = ''; + /** + * Optional. The API key. If the `secret_version_for_api_key` field is + * set, this field will be ignored. + * + * Generated from protobuf field string api_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $api_key = ''; + /** + * Optional. The name of the SecretManager secret version resource storing + * the API key. If this field is set, the `api_key` field will be ignored. + * Format: `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_api_key = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $secret_version_for_api_key = ''; + /** + * Required. Key location in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.RequestLocation request_location = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $request_location = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $key_name + * Required. The parameter name or the header name of the API key. + * E.g., If the API request is "https://example.com/act?X-Api-Key=", "X-Api-Key" would be the parameter name. + * @type string $api_key + * Optional. The API key. If the `secret_version_for_api_key` field is + * set, this field will be ignored. + * @type string $secret_version_for_api_key + * Optional. The name of the SecretManager secret version resource storing + * the API key. If this field is set, the `api_key` field will be ignored. + * Format: `projects/{project}/secrets/{secret}/versions/{version}` + * @type int $request_location + * Required. Key location in the request. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The parameter name or the header name of the API key. + * E.g., If the API request is "https://example.com/act?X-Api-Key=", "X-Api-Key" would be the parameter name. + * + * Generated from protobuf field string key_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getKeyName() + { + return $this->key_name; + } + + /** + * Required. The parameter name or the header name of the API key. + * E.g., If the API request is "https://example.com/act?X-Api-Key=", "X-Api-Key" would be the parameter name. + * + * Generated from protobuf field string key_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setKeyName($var) + { + GPBUtil::checkString($var, True); + $this->key_name = $var; + + return $this; + } + + /** + * Optional. The API key. If the `secret_version_for_api_key` field is + * set, this field will be ignored. + * + * Generated from protobuf field string api_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getApiKey() + { + return $this->api_key; + } + + /** + * Optional. The API key. If the `secret_version_for_api_key` field is + * set, this field will be ignored. + * + * Generated from protobuf field string api_key = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setApiKey($var) + { + GPBUtil::checkString($var, True); + $this->api_key = $var; + + return $this; + } + + /** + * Optional. The name of the SecretManager secret version resource storing + * the API key. If this field is set, the `api_key` field will be ignored. + * Format: `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_api_key = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getSecretVersionForApiKey() + { + return $this->secret_version_for_api_key; + } + + /** + * Optional. The name of the SecretManager secret version resource storing + * the API key. If this field is set, the `api_key` field will be ignored. + * Format: `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_api_key = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecretVersionForApiKey($var) + { + GPBUtil::checkString($var, True); + $this->secret_version_for_api_key = $var; + + return $this; + } + + /** + * Required. Key location in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.RequestLocation request_location = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getRequestLocation() + { + return $this->request_location; + } + + /** + * Required. Key location in the request. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.RequestLocation request_location = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setRequestLocation($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\RequestLocation::class); + $this->request_location = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/Authentication/BearerTokenConfig.php b/DialogflowCx/src/V3/Tool/Authentication/BearerTokenConfig.php new file mode 100644 index 000000000000..689288a28ee7 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication/BearerTokenConfig.php @@ -0,0 +1,134 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication.BearerTokenConfig + */ +class BearerTokenConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The text token appended to the text `Bearer` to the request + * Authorization header. + * [Session parameters + * reference](https://cloud.google.com/dialogflow/cx/docs/concept/parameter#session-ref) + * can be used to pass the token dynamically, e.g. + * `$session.params.parameter-id`. + * + * Generated from protobuf field string token = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $token = ''; + /** + * Optional. The name of the SecretManager secret version resource storing + * the Bearer token. If this field is set, the `token` field will be + * ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_token = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $secret_version_for_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $token + * Optional. The text token appended to the text `Bearer` to the request + * Authorization header. + * [Session parameters + * reference](https://cloud.google.com/dialogflow/cx/docs/concept/parameter#session-ref) + * can be used to pass the token dynamically, e.g. + * `$session.params.parameter-id`. + * @type string $secret_version_for_token + * Optional. The name of the SecretManager secret version resource storing + * the Bearer token. If this field is set, the `token` field will be + * ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The text token appended to the text `Bearer` to the request + * Authorization header. + * [Session parameters + * reference](https://cloud.google.com/dialogflow/cx/docs/concept/parameter#session-ref) + * can be used to pass the token dynamically, e.g. + * `$session.params.parameter-id`. + * + * Generated from protobuf field string token = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getToken() + { + return $this->token; + } + + /** + * Optional. The text token appended to the text `Bearer` to the request + * Authorization header. + * [Session parameters + * reference](https://cloud.google.com/dialogflow/cx/docs/concept/parameter#session-ref) + * can be used to pass the token dynamically, e.g. + * `$session.params.parameter-id`. + * + * Generated from protobuf field string token = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setToken($var) + { + GPBUtil::checkString($var, True); + $this->token = $var; + + return $this; + } + + /** + * Optional. The name of the SecretManager secret version resource storing + * the Bearer token. If this field is set, the `token` field will be + * ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_token = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getSecretVersionForToken() + { + return $this->secret_version_for_token; + } + + /** + * Optional. The name of the SecretManager secret version resource storing + * the Bearer token. If this field is set, the `token` field will be + * ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_token = 2 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecretVersionForToken($var) + { + GPBUtil::checkString($var, True); + $this->secret_version_for_token = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/Authentication/OAuthConfig.php b/DialogflowCx/src/V3/Tool/Authentication/OAuthConfig.php new file mode 100644 index 000000000000..61d759333bf5 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication/OAuthConfig.php @@ -0,0 +1,262 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication.OAuthConfig + */ +class OAuthConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. OAuth grant types. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.OAuthConfig.OauthGrantType oauth_grant_type = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $oauth_grant_type = 0; + /** + * Required. The client ID from the OAuth provider. + * + * Generated from protobuf field string client_id = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $client_id = ''; + /** + * Optional. The client secret from the OAuth provider. If the + * `secret_version_for_client_secret` field is set, this field will be + * ignored. + * + * Generated from protobuf field string client_secret = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $client_secret = ''; + /** + * Optional. The name of the SecretManager secret version resource storing + * the client secret. If this field is set, the `client_secret` field will + * be ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_client_secret = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $secret_version_for_client_secret = ''; + /** + * Required. The token endpoint in the OAuth provider to exchange for an + * access token. + * + * Generated from protobuf field string token_endpoint = 4 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $token_endpoint = ''; + /** + * Optional. The OAuth scopes to grant. + * + * Generated from protobuf field repeated string scopes = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $scopes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $oauth_grant_type + * Required. OAuth grant types. + * @type string $client_id + * Required. The client ID from the OAuth provider. + * @type string $client_secret + * Optional. The client secret from the OAuth provider. If the + * `secret_version_for_client_secret` field is set, this field will be + * ignored. + * @type string $secret_version_for_client_secret + * Optional. The name of the SecretManager secret version resource storing + * the client secret. If this field is set, the `client_secret` field will + * be ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * @type string $token_endpoint + * Required. The token endpoint in the OAuth provider to exchange for an + * access token. + * @type array|\Google\Protobuf\Internal\RepeatedField $scopes + * Optional. The OAuth scopes to grant. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. OAuth grant types. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.OAuthConfig.OauthGrantType oauth_grant_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return int + */ + public function getOauthGrantType() + { + return $this->oauth_grant_type; + } + + /** + * Required. OAuth grant types. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.OAuthConfig.OauthGrantType oauth_grant_type = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param int $var + * @return $this + */ + public function setOauthGrantType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\OAuthConfig\OauthGrantType::class); + $this->oauth_grant_type = $var; + + return $this; + } + + /** + * Required. The client ID from the OAuth provider. + * + * Generated from protobuf field string client_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getClientId() + { + return $this->client_id; + } + + /** + * Required. The client ID from the OAuth provider. + * + * Generated from protobuf field string client_id = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setClientId($var) + { + GPBUtil::checkString($var, True); + $this->client_id = $var; + + return $this; + } + + /** + * Optional. The client secret from the OAuth provider. If the + * `secret_version_for_client_secret` field is set, this field will be + * ignored. + * + * Generated from protobuf field string client_secret = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getClientSecret() + { + return $this->client_secret; + } + + /** + * Optional. The client secret from the OAuth provider. If the + * `secret_version_for_client_secret` field is set, this field will be + * ignored. + * + * Generated from protobuf field string client_secret = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setClientSecret($var) + { + GPBUtil::checkString($var, True); + $this->client_secret = $var; + + return $this; + } + + /** + * Optional. The name of the SecretManager secret version resource storing + * the client secret. If this field is set, the `client_secret` field will + * be ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_client_secret = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getSecretVersionForClientSecret() + { + return $this->secret_version_for_client_secret; + } + + /** + * Optional. The name of the SecretManager secret version resource storing + * the client secret. If this field is set, the `client_secret` field will + * be ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_client_secret = 6 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecretVersionForClientSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret_version_for_client_secret = $var; + + return $this; + } + + /** + * Required. The token endpoint in the OAuth provider to exchange for an + * access token. + * + * Generated from protobuf field string token_endpoint = 4 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTokenEndpoint() + { + return $this->token_endpoint; + } + + /** + * Required. The token endpoint in the OAuth provider to exchange for an + * access token. + * + * Generated from protobuf field string token_endpoint = 4 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTokenEndpoint($var) + { + GPBUtil::checkString($var, True); + $this->token_endpoint = $var; + + return $this; + } + + /** + * Optional. The OAuth scopes to grant. + * + * Generated from protobuf field repeated string scopes = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getScopes() + { + return $this->scopes; + } + + /** + * Optional. The OAuth scopes to grant. + * + * Generated from protobuf field repeated string scopes = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setScopes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->scopes = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/Authentication/OAuthConfig/OauthGrantType.php b/DialogflowCx/src/V3/Tool/Authentication/OAuthConfig/OauthGrantType.php new file mode 100644 index 000000000000..425722c3ebe1 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication/OAuthConfig/OauthGrantType.php @@ -0,0 +1,58 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication.OAuthConfig.OauthGrantType + */ +class OauthGrantType +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum OAUTH_GRANT_TYPE_UNSPECIFIED = 0; + */ + const OAUTH_GRANT_TYPE_UNSPECIFIED = 0; + /** + * Represents the [client credential + * flow](https://oauth.net/2/grant-types/client-credentials). + * + * Generated from protobuf enum CLIENT_CREDENTIAL = 1; + */ + const CLIENT_CREDENTIAL = 1; + + private static $valueToName = [ + self::OAUTH_GRANT_TYPE_UNSPECIFIED => 'OAUTH_GRANT_TYPE_UNSPECIFIED', + self::CLIENT_CREDENTIAL => 'CLIENT_CREDENTIAL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/Tool/Authentication/RequestLocation.php b/DialogflowCx/src/V3/Tool/Authentication/RequestLocation.php new file mode 100644 index 000000000000..63fa297c6d61 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication/RequestLocation.php @@ -0,0 +1,62 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication.RequestLocation + */ +class RequestLocation +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum REQUEST_LOCATION_UNSPECIFIED = 0; + */ + const REQUEST_LOCATION_UNSPECIFIED = 0; + /** + * Represents the key in http header. + * + * Generated from protobuf enum HEADER = 1; + */ + const HEADER = 1; + /** + * Represents the key in query string. + * + * Generated from protobuf enum QUERY_STRING = 2; + */ + const QUERY_STRING = 2; + + private static $valueToName = [ + self::REQUEST_LOCATION_UNSPECIFIED => 'REQUEST_LOCATION_UNSPECIFIED', + self::HEADER => 'HEADER', + self::QUERY_STRING => 'QUERY_STRING', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/Tool/Authentication/ServiceAccountAuthConfig.php b/DialogflowCx/src/V3/Tool/Authentication/ServiceAccountAuthConfig.php new file mode 100644 index 000000000000..78dd97be7735 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication/ServiceAccountAuthConfig.php @@ -0,0 +1,96 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAccountAuthConfig + */ +class ServiceAccountAuthConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The email address of the service account used to authenticate + * the tool call. Dialogflow uses this service account to exchange an + * access token and the access token is then sent in the `Authorization` + * header of the tool request. + * The service account must have the + * `roles/iam.serviceAccountTokenCreator` role granted to the + * [Dialogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_account = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_account + * Required. The email address of the service account used to authenticate + * the tool call. Dialogflow uses this service account to exchange an + * access token and the access token is then sent in the `Authorization` + * header of the tool request. + * The service account must have the + * `roles/iam.serviceAccountTokenCreator` role granted to the + * [Dialogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The email address of the service account used to authenticate + * the tool call. Dialogflow uses this service account to exchange an + * access token and the access token is then sent in the `Authorization` + * header of the tool request. + * The service account must have the + * `roles/iam.serviceAccountTokenCreator` role granted to the + * [Dialogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Required. The email address of the service account used to authenticate + * the tool call. Dialogflow uses this service account to exchange an + * access token and the access token is then sent in the `Authorization` + * header of the tool request. + * The service account must have the + * `roles/iam.serviceAccountTokenCreator` role granted to the + * [Dialogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/Authentication/ServiceAgentAuthConfig.php b/DialogflowCx/src/V3/Tool/Authentication/ServiceAgentAuthConfig.php new file mode 100644 index 000000000000..53eef730c08d --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication/ServiceAgentAuthConfig.php @@ -0,0 +1,81 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAgentAuthConfig + */ +class ServiceAgentAuthConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Indicate the auth token type generated from the [Diglogflow + * service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * The generated token is sent in the Authorization header. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAgentAuthConfig.ServiceAgentAuth service_agent_auth = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_agent_auth = 0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $service_agent_auth + * Optional. Indicate the auth token type generated from the [Diglogflow + * service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * The generated token is sent in the Authorization header. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Optional. Indicate the auth token type generated from the [Diglogflow + * service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * The generated token is sent in the Authorization header. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAgentAuthConfig.ServiceAgentAuth service_agent_auth = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getServiceAgentAuth() + { + return $this->service_agent_auth; + } + + /** + * Optional. Indicate the auth token type generated from the [Diglogflow + * service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * The generated token is sent in the Authorization header. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAgentAuthConfig.ServiceAgentAuth service_agent_auth = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setServiceAgentAuth($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication\ServiceAgentAuthConfig\ServiceAgentAuth::class); + $this->service_agent_auth = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/Authentication/ServiceAgentAuthConfig/ServiceAgentAuth.php b/DialogflowCx/src/V3/Tool/Authentication/ServiceAgentAuthConfig/ServiceAgentAuth.php new file mode 100644 index 000000000000..d84accc84a36 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/Authentication/ServiceAgentAuthConfig/ServiceAgentAuth.php @@ -0,0 +1,71 @@ +google.cloud.dialogflow.cx.v3.Tool.Authentication.ServiceAgentAuthConfig.ServiceAgentAuth + */ +class ServiceAgentAuth +{ + /** + * Service agent auth type unspecified. Default to ID_TOKEN. + * + * Generated from protobuf enum SERVICE_AGENT_AUTH_UNSPECIFIED = 0; + */ + const SERVICE_AGENT_AUTH_UNSPECIFIED = 0; + /** + * Use [ID + * token](https://cloud.google.com/docs/authentication/token-types#id) + * generated from service agent. This can be used to access Cloud + * Function and Cloud Run after you grant Invoker role to + * `service-@gcp-sa-dialogflow.iam.gserviceaccount.com`. + * + * Generated from protobuf enum ID_TOKEN = 1; + */ + const ID_TOKEN = 1; + /** + * Use [access + * token](https://cloud.google.com/docs/authentication/token-types#access) + * generated from service agent. This can be used to access other Google + * Cloud APIs after you grant required roles to + * `service-@gcp-sa-dialogflow.iam.gserviceaccount.com`. + * + * Generated from protobuf enum ACCESS_TOKEN = 2; + */ + const ACCESS_TOKEN = 2; + + private static $valueToName = [ + self::SERVICE_AGENT_AUTH_UNSPECIFIED => 'SERVICE_AGENT_AUTH_UNSPECIFIED', + self::ID_TOKEN => 'ID_TOKEN', + self::ACCESS_TOKEN => 'ACCESS_TOKEN', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/Tool/DataStoreTool.php b/DialogflowCx/src/V3/Tool/DataStoreTool.php new file mode 100644 index 000000000000..145b24f9abc4 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/DataStoreTool.php @@ -0,0 +1,113 @@ +google.cloud.dialogflow.cx.v3.Tool.DataStoreTool + */ +class DataStoreTool extends \Google\Protobuf\Internal\Message +{ + /** + * Required. List of data stores to search. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.DataStoreConnection data_store_connections = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $data_store_connections; + /** + * Required. Fallback prompt configurations to use. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.DataStoreTool.FallbackPrompt fallback_prompt = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $fallback_prompt = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\DataStoreConnection>|\Google\Protobuf\Internal\RepeatedField $data_store_connections + * Required. List of data stores to search. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\DataStoreTool\FallbackPrompt $fallback_prompt + * Required. Fallback prompt configurations to use. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. List of data stores to search. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.DataStoreConnection data_store_connections = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataStoreConnections() + { + return $this->data_store_connections; + } + + /** + * Required. List of data stores to search. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.DataStoreConnection data_store_connections = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\DataStoreConnection>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataStoreConnections($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\DataStoreConnection::class); + $this->data_store_connections = $arr; + + return $this; + } + + /** + * Required. Fallback prompt configurations to use. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.DataStoreTool.FallbackPrompt fallback_prompt = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\DataStoreTool\FallbackPrompt|null + */ + public function getFallbackPrompt() + { + return $this->fallback_prompt; + } + + public function hasFallbackPrompt() + { + return isset($this->fallback_prompt); + } + + public function clearFallbackPrompt() + { + unset($this->fallback_prompt); + } + + /** + * Required. Fallback prompt configurations to use. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.DataStoreTool.FallbackPrompt fallback_prompt = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\DataStoreTool\FallbackPrompt $var + * @return $this + */ + public function setFallbackPrompt($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\DataStoreTool\FallbackPrompt::class); + $this->fallback_prompt = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/DataStoreTool/FallbackPrompt.php b/DialogflowCx/src/V3/Tool/DataStoreTool/FallbackPrompt.php new file mode 100644 index 000000000000..e42bb7772baa --- /dev/null +++ b/DialogflowCx/src/V3/Tool/DataStoreTool/FallbackPrompt.php @@ -0,0 +1,35 @@ +google.cloud.dialogflow.cx.v3.Tool.DataStoreTool.FallbackPrompt + */ +class FallbackPrompt extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/FunctionTool.php b/DialogflowCx/src/V3/Tool/FunctionTool.php new file mode 100644 index 000000000000..26ff9d8cd0b2 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/FunctionTool.php @@ -0,0 +1,146 @@ +google.cloud.dialogflow.cx.v3.Tool.FunctionTool + */ +class FunctionTool extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The JSON schema is encapsulated in a + * [google.protobuf.Struct][google.protobuf.Struct] to describe the input of + * the function. This input is a JSON object that contains the function's + * parameters as properties of the object. + * + * Generated from protobuf field .google.protobuf.Struct input_schema = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $input_schema = null; + /** + * Optional. The JSON schema is encapsulated in a + * [google.protobuf.Struct][google.protobuf.Struct] to describe the output + * of the function. This output is a JSON object that contains the + * function's parameters as properties of the object. + * + * Generated from protobuf field .google.protobuf.Struct output_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $output_schema = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Struct $input_schema + * Optional. The JSON schema is encapsulated in a + * [google.protobuf.Struct][google.protobuf.Struct] to describe the input of + * the function. This input is a JSON object that contains the function's + * parameters as properties of the object. + * @type \Google\Protobuf\Struct $output_schema + * Optional. The JSON schema is encapsulated in a + * [google.protobuf.Struct][google.protobuf.Struct] to describe the output + * of the function. This output is a JSON object that contains the + * function's parameters as properties of the object. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The JSON schema is encapsulated in a + * [google.protobuf.Struct][google.protobuf.Struct] to describe the input of + * the function. This input is a JSON object that contains the function's + * parameters as properties of the object. + * + * Generated from protobuf field .google.protobuf.Struct input_schema = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Struct|null + */ + public function getInputSchema() + { + return $this->input_schema; + } + + public function hasInputSchema() + { + return isset($this->input_schema); + } + + public function clearInputSchema() + { + unset($this->input_schema); + } + + /** + * Optional. The JSON schema is encapsulated in a + * [google.protobuf.Struct][google.protobuf.Struct] to describe the input of + * the function. This input is a JSON object that contains the function's + * parameters as properties of the object. + * + * Generated from protobuf field .google.protobuf.Struct input_schema = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setInputSchema($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->input_schema = $var; + + return $this; + } + + /** + * Optional. The JSON schema is encapsulated in a + * [google.protobuf.Struct][google.protobuf.Struct] to describe the output + * of the function. This output is a JSON object that contains the + * function's parameters as properties of the object. + * + * Generated from protobuf field .google.protobuf.Struct output_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Struct|null + */ + public function getOutputSchema() + { + return $this->output_schema; + } + + public function hasOutputSchema() + { + return isset($this->output_schema); + } + + public function clearOutputSchema() + { + unset($this->output_schema); + } + + /** + * Optional. The JSON schema is encapsulated in a + * [google.protobuf.Struct][google.protobuf.Struct] to describe the output + * of the function. This output is a JSON object that contains the + * function's parameters as properties of the object. + * + * Generated from protobuf field .google.protobuf.Struct output_schema = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setOutputSchema($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->output_schema = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/OpenApiTool.php b/DialogflowCx/src/V3/Tool/OpenApiTool.php new file mode 100644 index 000000000000..7fa103f43e17 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/OpenApiTool.php @@ -0,0 +1,209 @@ +google.cloud.dialogflow.cx.v3.Tool.OpenApiTool + */ +class OpenApiTool extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. Authentication information required by the API. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication authentication = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $authentication = null; + /** + * Optional. TLS configuration for the HTTPS verification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.TLSConfig tls_config = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $tls_config = null; + /** + * Optional. Service Directory configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.ServiceDirectoryConfig service_directory_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_directory_config = null; + protected $schema; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text_schema + * Required. The OpenAPI schema specified as a text. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication $authentication + * Optional. Authentication information required by the API. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\TLSConfig $tls_config + * Optional. TLS configuration for the HTTPS verification. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool\ServiceDirectoryConfig $service_directory_config + * Optional. Service Directory configuration. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The OpenAPI schema specified as a text. + * + * Generated from protobuf field string text_schema = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getTextSchema() + { + return $this->readOneof(1); + } + + public function hasTextSchema() + { + return $this->hasOneof(1); + } + + /** + * Required. The OpenAPI schema specified as a text. + * + * Generated from protobuf field string text_schema = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setTextSchema($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Optional. Authentication information required by the API. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication authentication = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication|null + */ + public function getAuthentication() + { + return $this->authentication; + } + + public function hasAuthentication() + { + return isset($this->authentication); + } + + public function clearAuthentication() + { + unset($this->authentication); + } + + /** + * Optional. Authentication information required by the API. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.Authentication authentication = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication $var + * @return $this + */ + public function setAuthentication($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\Authentication::class); + $this->authentication = $var; + + return $this; + } + + /** + * Optional. TLS configuration for the HTTPS verification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.TLSConfig tls_config = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\TLSConfig|null + */ + public function getTlsConfig() + { + return $this->tls_config; + } + + public function hasTlsConfig() + { + return isset($this->tls_config); + } + + public function clearTlsConfig() + { + unset($this->tls_config); + } + + /** + * Optional. TLS configuration for the HTTPS verification. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.TLSConfig tls_config = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\TLSConfig $var + * @return $this + */ + public function setTlsConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\TLSConfig::class); + $this->tls_config = $var; + + return $this; + } + + /** + * Optional. Service Directory configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.ServiceDirectoryConfig service_directory_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool\ServiceDirectoryConfig|null + */ + public function getServiceDirectoryConfig() + { + return $this->service_directory_config; + } + + public function hasServiceDirectoryConfig() + { + return isset($this->service_directory_config); + } + + public function clearServiceDirectoryConfig() + { + unset($this->service_directory_config); + } + + /** + * Optional. Service Directory configuration. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool.ServiceDirectoryConfig service_directory_config = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool\ServiceDirectoryConfig $var + * @return $this + */ + public function setServiceDirectoryConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool\ServiceDirectoryConfig::class); + $this->service_directory_config = $var; + + return $this; + } + + /** + * @return string + */ + public function getSchema() + { + return $this->whichOneof("schema"); + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/ServiceDirectoryConfig.php b/DialogflowCx/src/V3/Tool/ServiceDirectoryConfig.php new file mode 100644 index 000000000000..13cef5c46d80 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/ServiceDirectoryConfig.php @@ -0,0 +1,88 @@ +google.cloud.dialogflow.cx.v3.Tool.ServiceDirectoryConfig + */ +class ServiceDirectoryConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of [Service + * Directory](https://cloud.google.com/service-directory) service. + * Format: + * `projects//locations//namespaces//services/`. + * `LocationID` of the service directory must be the same as the location + * of the agent. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $service = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service + * Required. The name of [Service + * Directory](https://cloud.google.com/service-directory) service. + * Format: + * `projects//locations//namespaces//services/`. + * `LocationID` of the service directory must be the same as the location + * of the agent. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of [Service + * Directory](https://cloud.google.com/service-directory) service. + * Format: + * `projects//locations//namespaces//services/`. + * `LocationID` of the service directory must be the same as the location + * of the agent. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getService() + { + return $this->service; + } + + /** + * Required. The name of [Service + * Directory](https://cloud.google.com/service-directory) service. + * Format: + * `projects//locations//namespaces//services/`. + * `LocationID` of the service directory must be the same as the location + * of the agent. + * + * Generated from protobuf field string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setService($var) + { + GPBUtil::checkString($var, True); + $this->service = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/TLSConfig.php b/DialogflowCx/src/V3/Tool/TLSConfig.php new file mode 100644 index 000000000000..b051d4e00469 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/TLSConfig.php @@ -0,0 +1,72 @@ +google.cloud.dialogflow.cx.v3.Tool.TLSConfig + */ +class TLSConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Specifies a list of allowed custom CA certificates for HTTPS + * verification. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Tool.TLSConfig.CACert ca_certs = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private $ca_certs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\Dialogflow\Cx\V3\Tool\TLSConfig\CACert>|\Google\Protobuf\Internal\RepeatedField $ca_certs + * Required. Specifies a list of allowed custom CA certificates for HTTPS + * verification. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. Specifies a list of allowed custom CA certificates for HTTPS + * verification. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Tool.TLSConfig.CACert ca_certs = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCaCerts() + { + return $this->ca_certs; + } + + /** + * Required. Specifies a list of allowed custom CA certificates for HTTPS + * verification. + * + * Generated from protobuf field repeated .google.cloud.dialogflow.cx.v3.Tool.TLSConfig.CACert ca_certs = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\Dialogflow\Cx\V3\Tool\TLSConfig\CACert>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCaCerts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Tool\TLSConfig\CACert::class); + $this->ca_certs = $arr; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/TLSConfig/CACert.php b/DialogflowCx/src/V3/Tool/TLSConfig/CACert.php new file mode 100644 index 000000000000..5f4577b7b412 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/TLSConfig/CACert.php @@ -0,0 +1,150 @@ +google.cloud.dialogflow.cx.v3.Tool.TLSConfig.CACert + */ +class CACert extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The name of the allowed custom CA certificates. This + * can be used to disambiguate the custom CA certificates. + * + * Generated from protobuf field string display_name = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Required. The allowed custom CA certificates (in DER format) for + * HTTPS verification. This overrides the default SSL trust store. If this + * is empty or unspecified, Dialogflow will use Google's default trust + * store to verify certificates. N.B. Make sure the HTTPS server + * certificates are signed with "subject alt name". For instance a + * certificate can be self-signed using the following command: + * ``` + * openssl x509 -req -days 200 -in example.com.csr \ + * -signkey example.com.key \ + * -out example.com.crt \ + * -extfile <(printf "\nsubjectAltName='DNS:www.example.com'") + * ``` + * + * Generated from protobuf field bytes cert = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $cert = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $display_name + * Required. The name of the allowed custom CA certificates. This + * can be used to disambiguate the custom CA certificates. + * @type string $cert + * Required. The allowed custom CA certificates (in DER format) for + * HTTPS verification. This overrides the default SSL trust store. If this + * is empty or unspecified, Dialogflow will use Google's default trust + * store to verify certificates. N.B. Make sure the HTTPS server + * certificates are signed with "subject alt name". For instance a + * certificate can be self-signed using the following command: + * ``` + * openssl x509 -req -days 200 -in example.com.csr \ + * -signkey example.com.key \ + * -out example.com.crt \ + * -extfile <(printf "\nsubjectAltName='DNS:www.example.com'") + * ``` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The name of the allowed custom CA certificates. This + * can be used to disambiguate the custom CA certificates. + * + * Generated from protobuf field string display_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The name of the allowed custom CA certificates. This + * can be used to disambiguate the custom CA certificates. + * + * Generated from protobuf field string display_name = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. The allowed custom CA certificates (in DER format) for + * HTTPS verification. This overrides the default SSL trust store. If this + * is empty or unspecified, Dialogflow will use Google's default trust + * store to verify certificates. N.B. Make sure the HTTPS server + * certificates are signed with "subject alt name". For instance a + * certificate can be self-signed using the following command: + * ``` + * openssl x509 -req -days 200 -in example.com.csr \ + * -signkey example.com.key \ + * -out example.com.crt \ + * -extfile <(printf "\nsubjectAltName='DNS:www.example.com'") + * ``` + * + * Generated from protobuf field bytes cert = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getCert() + { + return $this->cert; + } + + /** + * Required. The allowed custom CA certificates (in DER format) for + * HTTPS verification. This overrides the default SSL trust store. If this + * is empty or unspecified, Dialogflow will use Google's default trust + * store to verify certificates. N.B. Make sure the HTTPS server + * certificates are signed with "subject alt name". For instance a + * certificate can be self-signed using the following command: + * ``` + * openssl x509 -req -days 200 -in example.com.csr \ + * -signkey example.com.key \ + * -out example.com.crt \ + * -extfile <(printf "\nsubjectAltName='DNS:www.example.com'") + * ``` + * + * Generated from protobuf field bytes cert = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setCert($var) + { + GPBUtil::checkString($var, False); + $this->cert = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Tool/ToolType.php b/DialogflowCx/src/V3/Tool/ToolType.php new file mode 100644 index 000000000000..bc870c581911 --- /dev/null +++ b/DialogflowCx/src/V3/Tool/ToolType.php @@ -0,0 +1,62 @@ +google.cloud.dialogflow.cx.v3.Tool.ToolType + */ +class ToolType +{ + /** + * Default value. This value is unused. + * + * Generated from protobuf enum TOOL_TYPE_UNSPECIFIED = 0; + */ + const TOOL_TYPE_UNSPECIFIED = 0; + /** + * Customer provided tool. + * + * Generated from protobuf enum CUSTOMIZED_TOOL = 1; + */ + const CUSTOMIZED_TOOL = 1; + /** + * First party built-in tool created by Dialogflow which cannot be modified. + * + * Generated from protobuf enum BUILTIN_TOOL = 2; + */ + const BUILTIN_TOOL = 2; + + private static $valueToName = [ + self::TOOL_TYPE_UNSPECIFIED => 'TOOL_TYPE_UNSPECIFIED', + self::CUSTOMIZED_TOOL => 'CUSTOMIZED_TOOL', + self::BUILTIN_TOOL => 'BUILTIN_TOOL', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DialogflowCx/src/V3/ToolCall.php b/DialogflowCx/src/V3/ToolCall.php new file mode 100644 index 000000000000..bbec4adc1857 --- /dev/null +++ b/DialogflowCx/src/V3/ToolCall.php @@ -0,0 +1,153 @@ +google.cloud.dialogflow.cx.v3.ToolCall + */ +class ToolCall extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with + * this call. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $tool = ''; + /** + * Required. The name of the tool's action associated with this call. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $action = ''; + /** + * Optional. The action's input parameters. + * + * Generated from protobuf field .google.protobuf.Struct input_parameters = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $input_parameters = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $tool + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with + * this call. Format: + * `projects//locations//agents//tools/`. + * @type string $action + * Required. The name of the tool's action associated with this call. + * @type \Google\Protobuf\Struct $input_parameters + * Optional. The action's input parameters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ToolCall::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with + * this call. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with + * this call. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTool($var) + { + GPBUtil::checkString($var, True); + $this->tool = $var; + + return $this; + } + + /** + * Required. The name of the tool's action associated with this call. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Required. The name of the tool's action associated with this call. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkString($var, True); + $this->action = $var; + + return $this; + } + + /** + * Optional. The action's input parameters. + * + * Generated from protobuf field .google.protobuf.Struct input_parameters = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Struct|null + */ + public function getInputParameters() + { + return $this->input_parameters; + } + + public function hasInputParameters() + { + return isset($this->input_parameters); + } + + public function clearInputParameters() + { + unset($this->input_parameters); + } + + /** + * Optional. The action's input parameters. + * + * Generated from protobuf field .google.protobuf.Struct input_parameters = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setInputParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->input_parameters = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ToolCallResult.php b/DialogflowCx/src/V3/ToolCallResult.php new file mode 100644 index 000000000000..c20105ba26db --- /dev/null +++ b/DialogflowCx/src/V3/ToolCallResult.php @@ -0,0 +1,184 @@ +google.cloud.dialogflow.cx.v3.ToolCallResult + */ +class ToolCallResult extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with + * this call. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $tool = ''; + /** + * Required. The name of the tool's action associated with this call. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $action = ''; + protected $result; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $tool + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with + * this call. Format: + * `projects//locations//agents//tools/`. + * @type string $action + * Required. The name of the tool's action associated with this call. + * @type \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult\Error $error + * The tool call's error. + * @type \Google\Protobuf\Struct $output_parameters + * The tool call's output parameters. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ToolCall::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with + * this call. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] associated with + * this call. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTool($var) + { + GPBUtil::checkString($var, True); + $this->tool = $var; + + return $this; + } + + /** + * Required. The name of the tool's action associated with this call. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Required. The name of the tool's action associated with this call. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkString($var, True); + $this->action = $var; + + return $this; + } + + /** + * The tool call's error. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolCallResult.Error error = 3; + * @return \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult\Error|null + */ + public function getError() + { + return $this->readOneof(3); + } + + public function hasError() + { + return $this->hasOneof(3); + } + + /** + * The tool call's error. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.ToolCallResult.Error error = 3; + * @param \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult\Error $var + * @return $this + */ + public function setError($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\ToolCallResult\Error::class); + $this->writeOneof(3, $var); + + return $this; + } + + /** + * The tool call's output parameters. + * + * Generated from protobuf field .google.protobuf.Struct output_parameters = 4; + * @return \Google\Protobuf\Struct|null + */ + public function getOutputParameters() + { + return $this->readOneof(4); + } + + public function hasOutputParameters() + { + return $this->hasOneof(4); + } + + /** + * The tool call's output parameters. + * + * Generated from protobuf field .google.protobuf.Struct output_parameters = 4; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setOutputParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->writeOneof(4, $var); + + return $this; + } + + /** + * @return string + */ + public function getResult() + { + return $this->whichOneof("result"); + } + +} + diff --git a/DialogflowCx/src/V3/ToolCallResult/Error.php b/DialogflowCx/src/V3/ToolCallResult/Error.php new file mode 100644 index 000000000000..69d499303800 --- /dev/null +++ b/DialogflowCx/src/V3/ToolCallResult/Error.php @@ -0,0 +1,68 @@ +google.cloud.dialogflow.cx.v3.ToolCallResult.Error + */ +class Error extends \Google\Protobuf\Internal\Message +{ + /** + * Optional. The error message of the function. + * + * Generated from protobuf field string message = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $message = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $message + * Optional. The error message of the function. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ToolCall::initOnce(); + parent::__construct($data); + } + + /** + * Optional. The error message of the function. + * + * Generated from protobuf field string message = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Optional. The error message of the function. + * + * Generated from protobuf field string message = 1 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setMessage($var) + { + GPBUtil::checkString($var, True); + $this->message = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/ToolUse.php b/DialogflowCx/src/V3/ToolUse.php new file mode 100644 index 000000000000..b34ac2aa0772 --- /dev/null +++ b/DialogflowCx/src/V3/ToolUse.php @@ -0,0 +1,231 @@ +google.cloud.dialogflow.cx.v3.ToolUse + */ +class ToolUse extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] that should be + * used. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $tool = ''; + /** + * Output only. The display name of the tool. + * + * Generated from protobuf field string display_name = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $display_name = ''; + /** + * Optional. Name of the action to be called during the tool use. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $action = ''; + /** + * Optional. A list of input parameters for the action. + * + * Generated from protobuf field .google.protobuf.Struct input_action_parameters = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $input_action_parameters = null; + /** + * Optional. A list of output parameters generated by the action. + * + * Generated from protobuf field .google.protobuf.Struct output_action_parameters = 6 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $output_action_parameters = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $tool + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] that should be + * used. Format: + * `projects//locations//agents//tools/`. + * @type string $display_name + * Output only. The display name of the tool. + * @type string $action + * Optional. Name of the action to be called during the tool use. + * @type \Google\Protobuf\Struct $input_action_parameters + * Optional. A list of input parameters for the action. + * @type \Google\Protobuf\Struct $output_action_parameters + * Optional. A list of output parameters generated by the action. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] that should be + * used. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * Required. The [tool][google.cloud.dialogflow.cx.v3.Tool] that should be + * used. Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setTool($var) + { + GPBUtil::checkString($var, True); + $this->tool = $var; + + return $this; + } + + /** + * Output only. The display name of the tool. + * + * Generated from protobuf field string display_name = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Output only. The display name of the tool. + * + * Generated from protobuf field string display_name = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Optional. Name of the action to be called during the tool use. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getAction() + { + return $this->action; + } + + /** + * Optional. Name of the action to be called during the tool use. + * + * Generated from protobuf field string action = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setAction($var) + { + GPBUtil::checkString($var, True); + $this->action = $var; + + return $this; + } + + /** + * Optional. A list of input parameters for the action. + * + * Generated from protobuf field .google.protobuf.Struct input_action_parameters = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Struct|null + */ + public function getInputActionParameters() + { + return $this->input_action_parameters; + } + + public function hasInputActionParameters() + { + return isset($this->input_action_parameters); + } + + public function clearInputActionParameters() + { + unset($this->input_action_parameters); + } + + /** + * Optional. A list of input parameters for the action. + * + * Generated from protobuf field .google.protobuf.Struct input_action_parameters = 5 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setInputActionParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->input_action_parameters = $var; + + return $this; + } + + /** + * Optional. A list of output parameters generated by the action. + * + * Generated from protobuf field .google.protobuf.Struct output_action_parameters = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Struct|null + */ + public function getOutputActionParameters() + { + return $this->output_action_parameters; + } + + public function hasOutputActionParameters() + { + return isset($this->output_action_parameters); + } + + public function clearOutputActionParameters() + { + unset($this->output_action_parameters); + } + + /** + * Optional. A list of output parameters generated by the action. + * + * Generated from protobuf field .google.protobuf.Struct output_action_parameters = 6 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setOutputActionParameters($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->output_action_parameters = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/ToolVersion.php b/DialogflowCx/src/V3/ToolVersion.php new file mode 100644 index 000000000000..8a483a27a00f --- /dev/null +++ b/DialogflowCx/src/V3/ToolVersion.php @@ -0,0 +1,241 @@ +google.cloud.dialogflow.cx.v3.ToolVersion + */ +class ToolVersion extends \Google\Protobuf\Internal\Message +{ + /** + * Identifier. The unique identifier of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + */ + protected $name = ''; + /** + * Required. The display name of the tool version. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Required. Snapshot of the tool to be associated with this version. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tool = null; + /** + * Output only. Last time the tool version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Last time the tool version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $update_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Identifier. The unique identifier of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * @type string $display_name + * Required. The display name of the tool version. + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool $tool + * Required. Snapshot of the tool to be associated with this version. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Last time the tool version was created or modified. + * @type \Google\Protobuf\Timestamp $update_time + * Output only. Last time the tool version was created or modified. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Identifier. The unique identifier of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Identifier. The unique identifier of the tool version. + * Format: + * `projects//locations//agents//tools//versions/`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. The display name of the tool version. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. The display name of the tool version. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Required. Snapshot of the tool to be associated with this version. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool|null + */ + public function getTool() + { + return $this->tool; + } + + public function hasTool() + { + return isset($this->tool); + } + + public function clearTool() + { + unset($this->tool); + } + + /** + * Required. Snapshot of the tool to be associated with this version. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool $var + * @return $this + */ + public function setTool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool::class); + $this->tool = $var; + + return $this; + } + + /** + * Output only. Last time the tool version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Last time the tool version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Last time the tool version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getUpdateTime() + { + return $this->update_time; + } + + public function hasUpdateTime() + { + return isset($this->update_time); + } + + public function clearUpdateTime() + { + unset($this->update_time); + } + + /** + * Output only. Last time the tool version was created or modified. + * + * Generated from protobuf field .google.protobuf.Timestamp update_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setUpdateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->update_time = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/TypeSchema.php b/DialogflowCx/src/V3/TypeSchema.php new file mode 100644 index 000000000000..5ba7d1d75bf8 --- /dev/null +++ b/DialogflowCx/src/V3/TypeSchema.php @@ -0,0 +1,109 @@ +google.cloud.dialogflow.cx.v3.TypeSchema + */ +class TypeSchema extends \Google\Protobuf\Internal\Message +{ + protected $schema; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\InlineSchema $inline_schema + * Set if this is an inline schema definition. + * @type \Google\Cloud\Dialogflow\Cx\V3\TypeSchema\SchemaReference $schema_reference + * Set if this is a schema reference. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition::initOnce(); + parent::__construct($data); + } + + /** + * Set if this is an inline schema definition. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InlineSchema inline_schema = 1; + * @return \Google\Cloud\Dialogflow\Cx\V3\InlineSchema|null + */ + public function getInlineSchema() + { + return $this->readOneof(1); + } + + public function hasInlineSchema() + { + return $this->hasOneof(1); + } + + /** + * Set if this is an inline schema definition. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.InlineSchema inline_schema = 1; + * @param \Google\Cloud\Dialogflow\Cx\V3\InlineSchema $var + * @return $this + */ + public function setInlineSchema($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\InlineSchema::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Set if this is a schema reference. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TypeSchema.SchemaReference schema_reference = 2; + * @return \Google\Cloud\Dialogflow\Cx\V3\TypeSchema\SchemaReference|null + */ + public function getSchemaReference() + { + return $this->readOneof(2); + } + + public function hasSchemaReference() + { + return $this->hasOneof(2); + } + + /** + * Set if this is a schema reference. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.TypeSchema.SchemaReference schema_reference = 2; + * @param \Google\Cloud\Dialogflow\Cx\V3\TypeSchema\SchemaReference $var + * @return $this + */ + public function setSchemaReference($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\TypeSchema\SchemaReference::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getSchema() + { + return $this->whichOneof("schema"); + } + +} + diff --git a/DialogflowCx/src/V3/TypeSchema/SchemaReference.php b/DialogflowCx/src/V3/TypeSchema/SchemaReference.php new file mode 100644 index 000000000000..e81997d6888c --- /dev/null +++ b/DialogflowCx/src/V3/TypeSchema/SchemaReference.php @@ -0,0 +1,110 @@ +google.cloud.dialogflow.cx.v3.TypeSchema.SchemaReference + */ +class SchemaReference extends \Google\Protobuf\Internal\Message +{ + /** + * The tool that contains this schema definition. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1; + */ + protected $tool = ''; + /** + * The name of the schema. + * + * Generated from protobuf field string schema = 2; + */ + protected $schema = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $tool + * The tool that contains this schema definition. + * Format: + * `projects//locations//agents//tools/`. + * @type string $schema + * The name of the schema. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\ParameterDefinition::initOnce(); + parent::__construct($data); + } + + /** + * The tool that contains this schema definition. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1; + * @return string + */ + public function getTool() + { + return $this->tool; + } + + /** + * The tool that contains this schema definition. + * Format: + * `projects//locations//agents//tools/`. + * + * Generated from protobuf field string tool = 1; + * @param string $var + * @return $this + */ + public function setTool($var) + { + GPBUtil::checkString($var, True); + $this->tool = $var; + + return $this; + } + + /** + * The name of the schema. + * + * Generated from protobuf field string schema = 2; + * @return string + */ + public function getSchema() + { + return $this->schema; + } + + /** + * The name of the schema. + * + * Generated from protobuf field string schema = 2; + * @param string $var + * @return $this + */ + public function setSchema($var) + { + GPBUtil::checkString($var, True); + $this->schema = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/UpdateExampleRequest.php b/DialogflowCx/src/V3/UpdateExampleRequest.php new file mode 100644 index 000000000000..05c035fbb18a --- /dev/null +++ b/DialogflowCx/src/V3/UpdateExampleRequest.php @@ -0,0 +1,142 @@ +google.cloud.dialogflow.cx.v3.UpdateExampleRequest + */ +class UpdateExampleRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The example to update. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Example example = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $example = null; + /** + * Optional. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Dialogflow\Cx\V3\Example $example Required. The example to update. + * @param \Google\Protobuf\FieldMask $updateMask Optional. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\UpdateExampleRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Dialogflow\Cx\V3\Example $example, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setExample($example) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Example $example + * Required. The example to update. + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Example::initOnce(); + parent::__construct($data); + } + + /** + * Required. The example to update. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Example example = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Example|null + */ + public function getExample() + { + return $this->example; + } + + public function hasExample() + { + return isset($this->example); + } + + public function clearExample() + { + unset($this->example); + } + + /** + * Required. The example to update. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Example example = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Example $var + * @return $this + */ + public function setExample($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Example::class); + $this->example = $var; + + return $this; + } + + /** + * Optional. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. The mask to control which fields get updated. If the mask is not + * present, all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/UpdatePlaybookRequest.php b/DialogflowCx/src/V3/UpdatePlaybookRequest.php new file mode 100644 index 000000000000..5cf45d0f20ea --- /dev/null +++ b/DialogflowCx/src/V3/UpdatePlaybookRequest.php @@ -0,0 +1,142 @@ +google.cloud.dialogflow.cx.v3.UpdatePlaybookRequest + */ +class UpdatePlaybookRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The playbook to update. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $playbook = null; + /** + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Dialogflow\Cx\V3\Playbook $playbook Required. The playbook to update. + * @param \Google\Protobuf\FieldMask $updateMask The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\UpdatePlaybookRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Dialogflow\Cx\V3\Playbook $playbook, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setPlaybook($playbook) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Playbook $playbook + * Required. The playbook to update. + * @type \Google\Protobuf\FieldMask $update_mask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Playbook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The playbook to update. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Playbook|null + */ + public function getPlaybook() + { + return $this->playbook; + } + + public function hasPlaybook() + { + return isset($this->playbook); + } + + public function clearPlaybook() + { + unset($this->playbook); + } + + /** + * Required. The playbook to update. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Playbook playbook = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Playbook $var + * @return $this + */ + public function setPlaybook($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Playbook::class); + $this->playbook = $var; + + return $this; + } + + /** + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/UpdateToolRequest.php b/DialogflowCx/src/V3/UpdateToolRequest.php new file mode 100644 index 000000000000..5bbc761ef2f5 --- /dev/null +++ b/DialogflowCx/src/V3/UpdateToolRequest.php @@ -0,0 +1,142 @@ +google.cloud.dialogflow.cx.v3.UpdateToolRequest + */ +class UpdateToolRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Tool to be updated. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $tool = null; + /** + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool $tool Required. The Tool to be updated. + * @param \Google\Protobuf\FieldMask $updateMask The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * + * @return \Google\Cloud\Dialogflow\Cx\V3\UpdateToolRequest + * + * @experimental + */ + public static function build(\Google\Cloud\Dialogflow\Cx\V3\Tool $tool, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setTool($tool) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\Dialogflow\Cx\V3\Tool $tool + * Required. The Tool to be updated. + * @type \Google\Protobuf\FieldMask $update_mask + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Tool::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Tool to be updated. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Tool|null + */ + public function getTool() + { + return $this->tool; + } + + public function hasTool() + { + return isset($this->tool); + } + + public function clearTool() + { + unset($this->tool); + } + + /** + * Required. The Tool to be updated. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Tool tool = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Tool $var + * @return $this + */ + public function setTool($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Tool::class); + $this->tool = $var; + + return $this; + } + + /** + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * The mask to control which fields get updated. If the mask is not present, + * all fields will be updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/UserUtterance.php b/DialogflowCx/src/V3/UserUtterance.php new file mode 100644 index 000000000000..34cdf44e590b --- /dev/null +++ b/DialogflowCx/src/V3/UserUtterance.php @@ -0,0 +1,67 @@ +google.cloud.dialogflow.cx.v3.UserUtterance + */ +class UserUtterance extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Message content in text. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $text = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * Required. Message content in text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Trace::initOnce(); + parent::__construct($data); + } + + /** + * Required. Message content in text. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getText() + { + return $this->text; + } + + /** + * Required. Message content in text. + * + * Generated from protobuf field string text = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->text = $var; + + return $this; + } + +} + diff --git a/DialogflowCx/src/V3/Webhook/GenericWebService.php b/DialogflowCx/src/V3/Webhook/GenericWebService.php index f71d6cb331c9..05a8eed29cbd 100644 --- a/DialogflowCx/src/V3/Webhook/GenericWebService.php +++ b/DialogflowCx/src/V3/Webhook/GenericWebService.php @@ -36,12 +36,30 @@ class GenericWebService extends \Google\Protobuf\Internal\Message * @deprecated */ protected $password = ''; + /** + * Optional. The SecretManager secret version resource storing the + * username:password pair for HTTP Basic authentication. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_username_password = 19 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $secret_version_for_username_password = ''; /** * The HTTP request headers to send together with webhook requests. * * Generated from protobuf field map request_headers = 4; */ private $request_headers; + /** + * Optional. The HTTP request headers to send together with webhook + * requests. Header values are stored in SecretManager secret versions. + * When the same header name is specified in both `request_headers` and + * `secret_versions_for_request_headers`, the value in + * `secret_versions_for_request_headers` will be used. + * + * Generated from protobuf field map secret_versions_for_request_headers = 20 [(.google.api.field_behavior) = OPTIONAL]; + */ + private $secret_versions_for_request_headers; /** * Optional. Specifies a list of allowed custom CA certificates (in DER * format) for HTTPS verification. This overrides the default SSL trust @@ -76,6 +94,12 @@ class GenericWebService extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Webhook.GenericWebService.ServiceAgentAuth service_agent_auth = 12 [(.google.api.field_behavior) = OPTIONAL]; */ protected $service_agent_auth = 0; + /** + * Optional. Configuration for service account authentication. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Webhook.GenericWebService.ServiceAccountAuthConfig service_account_auth_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $service_account_auth_config = null; /** * Optional. Type of the webhook. * @@ -119,8 +143,18 @@ class GenericWebService extends \Google\Protobuf\Internal\Message * The user name for HTTP Basic authentication. * @type string $password * The password for HTTP Basic authentication. + * @type string $secret_version_for_username_password + * Optional. The SecretManager secret version resource storing the + * username:password pair for HTTP Basic authentication. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` * @type array|\Google\Protobuf\Internal\MapField $request_headers * The HTTP request headers to send together with webhook requests. + * @type array|\Google\Protobuf\Internal\MapField $secret_versions_for_request_headers + * Optional. The HTTP request headers to send together with webhook + * requests. Header values are stored in SecretManager secret versions. + * When the same header name is specified in both `request_headers` and + * `secret_versions_for_request_headers`, the value in + * `secret_versions_for_request_headers` will be used. * @type array|\Google\Protobuf\Internal\RepeatedField $allowed_ca_certs * Optional. Specifies a list of allowed custom CA certificates (in DER * format) for HTTPS verification. This overrides the default SSL trust @@ -143,6 +177,8 @@ class GenericWebService extends \Google\Protobuf\Internal\Message * service * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). * The generated token is sent in the Authorization header. + * @type \Google\Cloud\Dialogflow\Cx\V3\Webhook\GenericWebService\ServiceAccountAuthConfig $service_account_auth_config + * Optional. Configuration for service account authentication. * @type int $webhook_type * Optional. Type of the webhook. * @type int $http_method @@ -255,6 +291,36 @@ public function setPassword($var) return $this; } + /** + * Optional. The SecretManager secret version resource storing the + * username:password pair for HTTP Basic authentication. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_username_password = 19 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getSecretVersionForUsernamePassword() + { + return $this->secret_version_for_username_password; + } + + /** + * Optional. The SecretManager secret version resource storing the + * username:password pair for HTTP Basic authentication. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_username_password = 19 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecretVersionForUsernamePassword($var) + { + GPBUtil::checkString($var, True); + $this->secret_version_for_username_password = $var; + + return $this; + } + /** * The HTTP request headers to send together with webhook requests. * @@ -281,6 +347,40 @@ public function setRequestHeaders($var) return $this; } + /** + * Optional. The HTTP request headers to send together with webhook + * requests. Header values are stored in SecretManager secret versions. + * When the same header name is specified in both `request_headers` and + * `secret_versions_for_request_headers`, the value in + * `secret_versions_for_request_headers` will be used. + * + * Generated from protobuf field map secret_versions_for_request_headers = 20 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getSecretVersionsForRequestHeaders() + { + return $this->secret_versions_for_request_headers; + } + + /** + * Optional. The HTTP request headers to send together with webhook + * requests. Header values are stored in SecretManager secret versions. + * When the same header name is specified in both `request_headers` and + * `secret_versions_for_request_headers`, the value in + * `secret_versions_for_request_headers` will be used. + * + * Generated from protobuf field map secret_versions_for_request_headers = 20 [(.google.api.field_behavior) = OPTIONAL]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setSecretVersionsForRequestHeaders($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Dialogflow\Cx\V3\Webhook\GenericWebService\SecretVersionHeaderValue::class); + $this->secret_versions_for_request_headers = $arr; + + return $this; + } + /** * Optional. Specifies a list of allowed custom CA certificates (in DER * format) for HTTPS verification. This overrides the default SSL trust @@ -401,6 +501,42 @@ public function setServiceAgentAuth($var) return $this; } + /** + * Optional. Configuration for service account authentication. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Webhook.GenericWebService.ServiceAccountAuthConfig service_account_auth_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Cloud\Dialogflow\Cx\V3\Webhook\GenericWebService\ServiceAccountAuthConfig|null + */ + public function getServiceAccountAuthConfig() + { + return $this->service_account_auth_config; + } + + public function hasServiceAccountAuthConfig() + { + return isset($this->service_account_auth_config); + } + + public function clearServiceAccountAuthConfig() + { + unset($this->service_account_auth_config); + } + + /** + * Optional. Configuration for service account authentication. + * + * Generated from protobuf field .google.cloud.dialogflow.cx.v3.Webhook.GenericWebService.ServiceAccountAuthConfig service_account_auth_config = 18 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Cloud\Dialogflow\Cx\V3\Webhook\GenericWebService\ServiceAccountAuthConfig $var + * @return $this + */ + public function setServiceAccountAuthConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\Dialogflow\Cx\V3\Webhook\GenericWebService\ServiceAccountAuthConfig::class); + $this->service_account_auth_config = $var; + + return $this; + } + /** * Optional. Type of the webhook. * diff --git a/DialogflowCx/src/V3/Webhook/GenericWebService/OAuthConfig.php b/DialogflowCx/src/V3/Webhook/GenericWebService/OAuthConfig.php index f7e825aad80d..3ab5ec93d7a7 100644 --- a/DialogflowCx/src/V3/Webhook/GenericWebService/OAuthConfig.php +++ b/DialogflowCx/src/V3/Webhook/GenericWebService/OAuthConfig.php @@ -28,6 +28,15 @@ class OAuthConfig extends \Google\Protobuf\Internal\Message * Generated from protobuf field string client_secret = 2 [(.google.api.field_behavior) = OPTIONAL]; */ protected $client_secret = ''; + /** + * Optional. The name of the SecretManager secret version resource storing + * the client secret. If this field is set, the `client_secret` field will + * be ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_client_secret = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + */ + protected $secret_version_for_client_secret = ''; /** * Required. The token endpoint provided by the 3rd party platform to * exchange an access token. @@ -52,6 +61,11 @@ class OAuthConfig extends \Google\Protobuf\Internal\Message * Required. The client ID provided by the 3rd party platform. * @type string $client_secret * Optional. The client secret provided by the 3rd party platform. + * @type string $secret_version_for_client_secret + * Optional. The name of the SecretManager secret version resource storing + * the client secret. If this field is set, the `client_secret` field will + * be ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` * @type string $token_endpoint * Required. The token endpoint provided by the 3rd party platform to * exchange an access token. @@ -116,6 +130,38 @@ public function setClientSecret($var) return $this; } + /** + * Optional. The name of the SecretManager secret version resource storing + * the client secret. If this field is set, the `client_secret` field will + * be ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_client_secret = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @return string + */ + public function getSecretVersionForClientSecret() + { + return $this->secret_version_for_client_secret; + } + + /** + * Optional. The name of the SecretManager secret version resource storing + * the client secret. If this field is set, the `client_secret` field will + * be ignored. Format: + * `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version_for_client_secret = 5 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecretVersionForClientSecret($var) + { + GPBUtil::checkString($var, True); + $this->secret_version_for_client_secret = $var; + + return $this; + } + /** * Required. The token endpoint provided by the 3rd party platform to * exchange an access token. diff --git a/DialogflowCx/src/V3/Webhook/GenericWebService/SecretVersionHeaderValue.php b/DialogflowCx/src/V3/Webhook/GenericWebService/SecretVersionHeaderValue.php new file mode 100644 index 000000000000..6ae5c3b091a1 --- /dev/null +++ b/DialogflowCx/src/V3/Webhook/GenericWebService/SecretVersionHeaderValue.php @@ -0,0 +1,73 @@ +google.cloud.dialogflow.cx.v3.Webhook.GenericWebService.SecretVersionHeaderValue + */ +class SecretVersionHeaderValue extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The SecretManager secret version resource storing the header + * value. Format: `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $secret_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $secret_version + * Required. The SecretManager secret version resource storing the header + * value. Format: `projects/{project}/secrets/{secret}/versions/{version}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The SecretManager secret version resource storing the header + * value. Format: `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getSecretVersion() + { + return $this->secret_version; + } + + /** + * Required. The SecretManager secret version resource storing the header + * value. Format: `projects/{project}/secrets/{secret}/versions/{version}` + * + * Generated from protobuf field string secret_version = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSecretVersion($var) + { + GPBUtil::checkString($var, True); + $this->secret_version = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/Webhook/GenericWebService/ServiceAccountAuthConfig.php b/DialogflowCx/src/V3/Webhook/GenericWebService/ServiceAccountAuthConfig.php new file mode 100644 index 000000000000..318bc9d0ab0f --- /dev/null +++ b/DialogflowCx/src/V3/Webhook/GenericWebService/ServiceAccountAuthConfig.php @@ -0,0 +1,96 @@ +google.cloud.dialogflow.cx.v3.Webhook.GenericWebService.ServiceAccountAuthConfig + */ +class ServiceAccountAuthConfig extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The email address of the service account used to authenticate + * the webhook call. Dialogflow uses this service account to exchange an + * access token and the access token is then sent in the `Authorization` + * header of the webhook request. + * The service account must have the + * `roles/iam.serviceAccountTokenCreator` role granted to the + * [Dialogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $service_account = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $service_account + * Required. The email address of the service account used to authenticate + * the webhook call. Dialogflow uses this service account to exchange an + * access token and the access token is then sent in the `Authorization` + * header of the webhook request. + * The service account must have the + * `roles/iam.serviceAccountTokenCreator` role granted to the + * [Dialogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Dialogflow\Cx\V3\Webhook::initOnce(); + parent::__construct($data); + } + + /** + * Required. The email address of the service account used to authenticate + * the webhook call. Dialogflow uses this service account to exchange an + * access token and the access token is then sent in the `Authorization` + * header of the webhook request. + * The service account must have the + * `roles/iam.serviceAccountTokenCreator` role granted to the + * [Dialogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getServiceAccount() + { + return $this->service_account; + } + + /** + * Required. The email address of the service account used to authenticate + * the webhook call. Dialogflow uses this service account to exchange an + * access token and the access token is then sent in the `Authorization` + * header of the webhook request. + * The service account must have the + * `roles/iam.serviceAccountTokenCreator` role granted to the + * [Dialogflow service + * agent](https://cloud.google.com/iam/docs/service-agents#dialogflow-service-agent). + * + * Generated from protobuf field string service_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setServiceAccount($var) + { + GPBUtil::checkString($var, True); + $this->service_account = $var; + + return $this; + } + +} + + diff --git a/DialogflowCx/src/V3/gapic_metadata.json b/DialogflowCx/src/V3/gapic_metadata.json index cc8b0dd9326f..dcab1052a7c5 100644 --- a/DialogflowCx/src/V3/gapic_metadata.json +++ b/DialogflowCx/src/V3/gapic_metadata.json @@ -682,6 +682,50 @@ } } }, + "Examples": { + "clients": { + "grpc": { + "libraryClient": "ExamplesGapicClient", + "rpcs": { + "CreateExample": { + "methods": [ + "createExample" + ] + }, + "DeleteExample": { + "methods": [ + "deleteExample" + ] + }, + "GetExample": { + "methods": [ + "getExample" + ] + }, + "ListExamples": { + "methods": [ + "listExamples" + ] + }, + "UpdateExample": { + "methods": [ + "updateExample" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + }, "Experiments": { "clients": { "grpc": { @@ -780,6 +824,85 @@ } } }, + "Playbooks": { + "clients": { + "grpc": { + "libraryClient": "PlaybooksGapicClient", + "rpcs": { + "CreatePlaybook": { + "methods": [ + "createPlaybook" + ] + }, + "CreatePlaybookVersion": { + "methods": [ + "createPlaybookVersion" + ] + }, + "DeletePlaybook": { + "methods": [ + "deletePlaybook" + ] + }, + "DeletePlaybookVersion": { + "methods": [ + "deletePlaybookVersion" + ] + }, + "ExportPlaybook": { + "methods": [ + "exportPlaybook" + ] + }, + "GetPlaybook": { + "methods": [ + "getPlaybook" + ] + }, + "GetPlaybookVersion": { + "methods": [ + "getPlaybookVersion" + ] + }, + "ImportPlaybook": { + "methods": [ + "importPlaybook" + ] + }, + "ListPlaybookVersions": { + "methods": [ + "listPlaybookVersions" + ] + }, + "ListPlaybooks": { + "methods": [ + "listPlaybooks" + ] + }, + "RestorePlaybookVersion": { + "methods": [ + "restorePlaybookVersion" + ] + }, + "UpdatePlaybook": { + "methods": [ + "updatePlaybook" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + }, "SecuritySettingsService": { "clients": { "grpc": { @@ -824,6 +947,75 @@ } } }, + "Tools": { + "clients": { + "grpc": { + "libraryClient": "ToolsGapicClient", + "rpcs": { + "CreateTool": { + "methods": [ + "createTool" + ] + }, + "CreateToolVersion": { + "methods": [ + "createToolVersion" + ] + }, + "DeleteTool": { + "methods": [ + "deleteTool" + ] + }, + "DeleteToolVersion": { + "methods": [ + "deleteToolVersion" + ] + }, + "GetTool": { + "methods": [ + "getTool" + ] + }, + "GetToolVersion": { + "methods": [ + "getToolVersion" + ] + }, + "ListToolVersions": { + "methods": [ + "listToolVersions" + ] + }, + "ListTools": { + "methods": [ + "listTools" + ] + }, + "RestoreToolVersion": { + "methods": [ + "restoreToolVersion" + ] + }, + "UpdateTool": { + "methods": [ + "updateTool" + ] + }, + "GetLocation": { + "methods": [ + "getLocation" + ] + }, + "ListLocations": { + "methods": [ + "listLocations" + ] + } + } + } + } + }, "Versions": { "clients": { "grpc": { diff --git a/DialogflowCx/src/V3/resources/agents_descriptor_config.php b/DialogflowCx/src/V3/resources/agents_descriptor_config.php index 416b02eee63b..3e25043037b2 100644 --- a/DialogflowCx/src/V3/resources/agents_descriptor_config.php +++ b/DialogflowCx/src/V3/resources/agents_descriptor_config.php @@ -220,6 +220,7 @@ 'environment' => 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}', 'flow' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}', 'location' => 'projects/{project}/locations/{location}', + 'playbook' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}', 'secretVersion' => 'projects/{project}/secrets/{secret}/versions/{version}', 'securitySettings' => 'projects/{project}/locations/{location}/securitySettings/{security_settings}', ], diff --git a/DialogflowCx/src/V3/resources/environments_descriptor_config.php b/DialogflowCx/src/V3/resources/environments_descriptor_config.php index 32c276badbdc..45165e73da6a 100644 --- a/DialogflowCx/src/V3/resources/environments_descriptor_config.php +++ b/DialogflowCx/src/V3/resources/environments_descriptor_config.php @@ -221,6 +221,7 @@ 'templateMap' => [ 'agent' => 'projects/{project}/locations/{location}/agents/{agent}', 'environment' => 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}', + 'secretVersion' => 'projects/{project}/secrets/{secret}/versions/{version}', 'service' => 'projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}', 'testCase' => 'projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}', 'version' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}', diff --git a/DialogflowCx/src/V3/resources/examples_client_config.json b/DialogflowCx/src/V3/resources/examples_client_config.json new file mode 100644 index 000000000000..9713062df156 --- /dev/null +++ b/DialogflowCx/src/V3/resources/examples_client_config.json @@ -0,0 +1,69 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3.Examples": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateExample": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteExample": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetExample": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListExamples": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateExample": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/DialogflowCx/src/V3/resources/examples_descriptor_config.php b/DialogflowCx/src/V3/resources/examples_descriptor_config.php new file mode 100644 index 000000000000..e2b7a18f3df4 --- /dev/null +++ b/DialogflowCx/src/V3/resources/examples_descriptor_config.php @@ -0,0 +1,137 @@ + [ + 'google.cloud.dialogflow.cx.v3.Examples' => [ + 'CreateExample' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Example', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteExample' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetExample' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Example', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListExamples' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getExamples', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\ListExamplesResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateExample' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Example', + 'headerParams' => [ + [ + 'keyName' => 'example.name', + 'fieldAccessors' => [ + 'getExample', + 'getName', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'example' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/examples/{example}', + 'flow' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}', + 'playbook' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}', + 'tool' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}', + ], + ], + ], +]; diff --git a/DialogflowCx/src/V3/resources/examples_rest_client_config.php b/DialogflowCx/src/V3/resources/examples_rest_client_config.php new file mode 100644 index 000000000000..7c218b650388 --- /dev/null +++ b/DialogflowCx/src/V3/resources/examples_rest_client_config.php @@ -0,0 +1,164 @@ + [ + 'google.cloud.dialogflow.cx.v3.Examples' => [ + 'CreateExample' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*/playbooks/*}/examples', + 'body' => 'example', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteExample' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/playbooks/*/examples/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetExample' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/playbooks/*/examples/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListExamples' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*/playbooks/*}/examples', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateExample' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{example.name=projects/*/locations/*/agents/*/playbooks/*/examples/*}', + 'body' => 'example', + 'placeholders' => [ + 'example.name' => [ + 'getters' => [ + 'getExample', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/operations/*}:cancel', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:cancel', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DialogflowCx/src/V3/resources/flows_descriptor_config.php b/DialogflowCx/src/V3/resources/flows_descriptor_config.php index 49e6a2600d0a..32284f82dbe7 100644 --- a/DialogflowCx/src/V3/resources/flows_descriptor_config.php +++ b/DialogflowCx/src/V3/resources/flows_descriptor_config.php @@ -214,8 +214,10 @@ 'generator' => 'projects/{project}/locations/{location}/agents/{agent}/generators/{generator}', 'intent' => 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}', 'page' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}', + 'playbook' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}', 'projectLocationAgentFlowTransitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}', 'projectLocationAgentTransitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}', + 'tool' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}', 'transitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}', 'webhook' => 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}', ], diff --git a/DialogflowCx/src/V3/resources/pages_descriptor_config.php b/DialogflowCx/src/V3/resources/pages_descriptor_config.php index a23ca148dc19..f92092c34e32 100644 --- a/DialogflowCx/src/V3/resources/pages_descriptor_config.php +++ b/DialogflowCx/src/V3/resources/pages_descriptor_config.php @@ -132,8 +132,10 @@ 'generator' => 'projects/{project}/locations/{location}/agents/{agent}/generators/{generator}', 'intent' => 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}', 'page' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}', + 'playbook' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}', 'projectLocationAgentFlowTransitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}', 'projectLocationAgentTransitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}', + 'tool' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}', 'transitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}', 'webhook' => 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}', ], diff --git a/DialogflowCx/src/V3/resources/playbooks_client_config.json b/DialogflowCx/src/V3/resources/playbooks_client_config.json new file mode 100644 index 000000000000..7ff03da48168 --- /dev/null +++ b/DialogflowCx/src/V3/resources/playbooks_client_config.json @@ -0,0 +1,104 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3.Playbooks": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreatePlaybook": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreatePlaybookVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeletePlaybook": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeletePlaybookVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ExportPlaybook": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetPlaybook": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetPlaybookVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ImportPlaybook": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListPlaybookVersions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListPlaybooks": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RestorePlaybookVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdatePlaybook": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/DialogflowCx/src/V3/resources/playbooks_descriptor_config.php b/DialogflowCx/src/V3/resources/playbooks_descriptor_config.php new file mode 100644 index 000000000000..53299fed9f5d --- /dev/null +++ b/DialogflowCx/src/V3/resources/playbooks_descriptor_config.php @@ -0,0 +1,247 @@ + [ + 'google.cloud.dialogflow.cx.v3.Playbooks' => [ + 'ExportPlaybook' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Dialogflow\Cx\V3\ExportPlaybookResponse', + 'metadataReturnType' => '\Google\Protobuf\Struct', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ImportPlaybook' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\Dialogflow\Cx\V3\ImportPlaybookResponse', + 'metadataReturnType' => '\Google\Protobuf\Struct', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreatePlaybook' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Playbook', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreatePlaybookVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeletePlaybook' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeletePlaybookVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetPlaybook' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Playbook', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetPlaybookVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\PlaybookVersion', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListPlaybookVersions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getPlaybookVersions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\ListPlaybookVersionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListPlaybooks' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getPlaybooks', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\ListPlaybooksResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'RestorePlaybookVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\RestorePlaybookVersionResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdatePlaybook' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Playbook', + 'headerParams' => [ + [ + 'keyName' => 'playbook.name', + 'fieldAccessors' => [ + 'getPlaybook', + 'getName', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'agent' => 'projects/{project}/locations/{location}/agents/{agent}', + 'example' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/examples/{example}', + 'flow' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}', + 'generator' => 'projects/{project}/locations/{location}/agents/{agent}/generators/{generator}', + 'playbook' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}', + 'playbookVersion' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}/versions/{version}', + 'tool' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}', + 'webhook' => 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}', + ], + ], + ], +]; diff --git a/DialogflowCx/src/V3/resources/playbooks_rest_client_config.php b/DialogflowCx/src/V3/resources/playbooks_rest_client_config.php new file mode 100644 index 000000000000..6fe36a1ac3eb --- /dev/null +++ b/DialogflowCx/src/V3/resources/playbooks_rest_client_config.php @@ -0,0 +1,245 @@ + [ + 'google.cloud.dialogflow.cx.v3.Playbooks' => [ + 'CreatePlaybook' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*}/playbooks', + 'body' => 'playbook', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreatePlaybookVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*/playbooks/*}/versions', + 'body' => 'playbook_version', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeletePlaybook' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/playbooks/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeletePlaybookVersion' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/playbooks/*/versions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ExportPlaybook' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/playbooks/*}:export', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetPlaybook' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/playbooks/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetPlaybookVersion' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/playbooks/*/versions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ImportPlaybook' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*}/playbooks:import', + 'body' => '*', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListPlaybookVersions' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*/playbooks/*}/versions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListPlaybooks' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*}/playbooks', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RestorePlaybookVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/playbooks/*/versions/*}:restore', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdatePlaybook' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{playbook.name=projects/*/locations/*/agents/*/playbooks/*}', + 'body' => 'playbook', + 'placeholders' => [ + 'playbook.name' => [ + 'getters' => [ + 'getPlaybook', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/operations/*}:cancel', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:cancel', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DialogflowCx/src/V3/resources/sessions_descriptor_config.php b/DialogflowCx/src/V3/resources/sessions_descriptor_config.php index 4908acbc03d5..9db999493258 100644 --- a/DialogflowCx/src/V3/resources/sessions_descriptor_config.php +++ b/DialogflowCx/src/V3/resources/sessions_descriptor_config.php @@ -134,6 +134,7 @@ 'entityType' => 'projects/{project}/locations/{location}/agents/{agent}/entityTypes/{entity_type}', 'intent' => 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}', 'page' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}', + 'playbook' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}', 'projectLocationAgentEnvironmentSession' => 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}', 'projectLocationAgentEnvironmentSessionEntityType' => 'projects/{project}/locations/{location}/agents/{agent}/environments/{environment}/sessions/{session}/entityTypes/{entity_type}', 'projectLocationAgentSession' => 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}', @@ -142,6 +143,7 @@ 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'session' => 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}', 'sessionEntityType' => 'projects/{project}/locations/{location}/agents/{agent}/sessions/{session}/entityTypes/{entity_type}', + 'tool' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}', 'version' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/versions/{version}', ], ], diff --git a/DialogflowCx/src/V3/resources/test_cases_descriptor_config.php b/DialogflowCx/src/V3/resources/test_cases_descriptor_config.php index 5cd58387f0fe..796db661b9e7 100644 --- a/DialogflowCx/src/V3/resources/test_cases_descriptor_config.php +++ b/DialogflowCx/src/V3/resources/test_cases_descriptor_config.php @@ -254,10 +254,12 @@ 'generator' => 'projects/{project}/locations/{location}/agents/{agent}/generators/{generator}', 'intent' => 'projects/{project}/locations/{location}/agents/{agent}/intents/{intent}', 'page' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}', + 'playbook' => 'projects/{project}/locations/{location}/agents/{agent}/playbooks/{playbook}', 'projectLocationAgentFlowTransitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}', 'projectLocationAgentTransitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}', 'testCase' => 'projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}', 'testCaseResult' => 'projects/{project}/locations/{location}/agents/{agent}/testCases/{test_case}/results/{result}', + 'tool' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}', 'transitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}', 'webhook' => 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}', ], diff --git a/DialogflowCx/src/V3/resources/tools_client_config.json b/DialogflowCx/src/V3/resources/tools_client_config.json new file mode 100644 index 000000000000..2d710a0fe175 --- /dev/null +++ b/DialogflowCx/src/V3/resources/tools_client_config.json @@ -0,0 +1,94 @@ +{ + "interfaces": { + "google.cloud.dialogflow.cx.v3.Tools": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000 + } + }, + "methods": { + "CreateTool": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "CreateToolVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteTool": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "DeleteToolVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetTool": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetToolVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListToolVersions": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListTools": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "RestoreToolVersion": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "UpdateTool": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "GetLocation": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + }, + "ListLocations": { + "timeout_millis": 60000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/DialogflowCx/src/V3/resources/tools_descriptor_config.php b/DialogflowCx/src/V3/resources/tools_descriptor_config.php new file mode 100644 index 000000000000..6a53fcc157d4 --- /dev/null +++ b/DialogflowCx/src/V3/resources/tools_descriptor_config.php @@ -0,0 +1,206 @@ + [ + 'google.cloud.dialogflow.cx.v3.Tools' => [ + 'CreateTool' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Tool', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'CreateToolVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\ToolVersion', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteTool' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'DeleteToolVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetTool' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Tool', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetToolVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\ToolVersion', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListToolVersions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getToolVersions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\ListToolVersionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'ListTools' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getTools', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\ListToolsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'RestoreToolVersion' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\RestoreToolVersionResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'UpdateTool' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Dialogflow\Cx\V3\Tool', + 'headerParams' => [ + [ + 'keyName' => 'tool.name', + 'fieldAccessors' => [ + 'getTool', + 'getName', + ], + ], + ], + ], + 'GetLocation' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\Location\Location', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'ListLocations' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getLocations', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\Location\ListLocationsResponse', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + 'interfaceOverride' => 'google.cloud.location.Locations', + ], + 'templateMap' => [ + 'agent' => 'projects/{project}/locations/{location}/agents/{agent}', + 'secretVersion' => 'projects/{project}/secrets/{secret}/versions/{version}', + 'service' => 'projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}', + 'tool' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}', + 'toolVersion' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}/versions/{version}', + ], + ], + ], +]; diff --git a/DialogflowCx/src/V3/resources/tools_rest_client_config.php b/DialogflowCx/src/V3/resources/tools_rest_client_config.php new file mode 100644 index 000000000000..fc7bf8c684c5 --- /dev/null +++ b/DialogflowCx/src/V3/resources/tools_rest_client_config.php @@ -0,0 +1,221 @@ + [ + 'google.cloud.dialogflow.cx.v3.Tools' => [ + 'CreateTool' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*}/tools', + 'body' => 'tool', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'CreateToolVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*/tools/*}/versions', + 'body' => 'tool_version', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteTool' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/tools/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'DeleteToolVersion' => [ + 'method' => 'delete', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/tools/*/versions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetTool' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/tools/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetToolVersion' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/tools/*/versions/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListToolVersions' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*/tools/*}/versions', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'ListTools' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{parent=projects/*/locations/*/agents/*}/tools', + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'RestoreToolVersion' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/agents/*/tools/*/versions/*}:restore', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'UpdateTool' => [ + 'method' => 'patch', + 'uriTemplate' => '/v3/{tool.name=projects/*/locations/*/agents/*/tools/*}', + 'body' => 'tool', + 'placeholders' => [ + 'tool.name' => [ + 'getters' => [ + 'getTool', + 'getName', + ], + ], + ], + ], + ], + 'google.cloud.location.Locations' => [ + 'GetLocation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListLocations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/locations', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/operations/*}:cancel', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}:cancel', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v3/{name=projects/*/locations/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DialogflowCx/src/V3/resources/transition_route_groups_descriptor_config.php b/DialogflowCx/src/V3/resources/transition_route_groups_descriptor_config.php index 461005434f5d..21a6ad39a39a 100644 --- a/DialogflowCx/src/V3/resources/transition_route_groups_descriptor_config.php +++ b/DialogflowCx/src/V3/resources/transition_route_groups_descriptor_config.php @@ -134,6 +134,7 @@ 'page' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/pages/{page}', 'projectLocationAgentFlowTransitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}', 'projectLocationAgentTransitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/transitionRouteGroups/{transition_route_group}', + 'tool' => 'projects/{project}/locations/{location}/agents/{agent}/tools/{tool}', 'transitionRouteGroup' => 'projects/{project}/locations/{location}/agents/{agent}/flows/{flow}/transitionRouteGroups/{transition_route_group}', 'webhook' => 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}', ], diff --git a/DialogflowCx/src/V3/resources/webhooks_descriptor_config.php b/DialogflowCx/src/V3/resources/webhooks_descriptor_config.php index ef3fcadb9034..13e787cc1b99 100644 --- a/DialogflowCx/src/V3/resources/webhooks_descriptor_config.php +++ b/DialogflowCx/src/V3/resources/webhooks_descriptor_config.php @@ -128,6 +128,7 @@ ], 'templateMap' => [ 'agent' => 'projects/{project}/locations/{location}/agents/{agent}', + 'secretVersion' => 'projects/{project}/secrets/{secret}/versions/{version}', 'service' => 'projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}', 'webhook' => 'projects/{project}/locations/{location}/agents/{agent}/webhooks/{webhook}', ], diff --git a/DialogflowCx/tests/Unit/V3/Client/ExamplesClientTest.php b/DialogflowCx/tests/Unit/V3/Client/ExamplesClientTest.php new file mode 100644 index 000000000000..d3e65afd4f81 --- /dev/null +++ b/DialogflowCx/tests/Unit/V3/Client/ExamplesClientTest.php @@ -0,0 +1,628 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ExamplesClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ExamplesClient($options); + } + + /** @test */ + public function createExampleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $tokenCount = 1164226743; + $languageCode = 'languageCode-412800396'; + $expectedResponse = new Example(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setTokenCount($tokenCount); + $expectedResponse->setLanguageCode($languageCode); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $example = new Example(); + $exampleActions = []; + $example->setActions($exampleActions); + $exampleDisplayName = 'exampleDisplayName1524254371'; + $example->setDisplayName($exampleDisplayName); + $exampleConversationState = OutputState::OUTPUT_STATE_UNSPECIFIED; + $example->setConversationState($exampleConversationState); + $request = (new CreateExampleRequest())->setParent($formattedParent)->setExample($example); + $response = $gapicClient->createExample($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Examples/CreateExample', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getExample(); + $this->assertProtobufEquals($example, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createExampleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $example = new Example(); + $exampleActions = []; + $example->setActions($exampleActions); + $exampleDisplayName = 'exampleDisplayName1524254371'; + $example->setDisplayName($exampleDisplayName); + $exampleConversationState = OutputState::OUTPUT_STATE_UNSPECIFIED; + $example->setConversationState($exampleConversationState); + $request = (new CreateExampleRequest())->setParent($formattedParent)->setExample($example); + try { + $gapicClient->createExample($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteExampleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->exampleName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]', '[EXAMPLE]'); + $request = (new DeleteExampleRequest())->setName($formattedName); + $gapicClient->deleteExample($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Examples/DeleteExample', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteExampleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->exampleName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]', '[EXAMPLE]'); + $request = (new DeleteExampleRequest())->setName($formattedName); + try { + $gapicClient->deleteExample($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getExampleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $tokenCount = 1164226743; + $languageCode = 'languageCode-412800396'; + $expectedResponse = new Example(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setTokenCount($tokenCount); + $expectedResponse->setLanguageCode($languageCode); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->exampleName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]', '[EXAMPLE]'); + $request = (new GetExampleRequest())->setName($formattedName); + $response = $gapicClient->getExample($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Examples/GetExample', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getExampleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->exampleName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]', '[EXAMPLE]'); + $request = (new GetExampleRequest())->setName($formattedName); + try { + $gapicClient->getExample($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listExamplesTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $examplesElement = new Example(); + $examples = [$examplesElement]; + $expectedResponse = new ListExamplesResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setExamples($examples); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new ListExamplesRequest())->setParent($formattedParent); + $response = $gapicClient->listExamples($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getExamples()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Examples/ListExamples', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listExamplesExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new ListExamplesRequest())->setParent($formattedParent); + try { + $gapicClient->listExamples($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateExampleTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $tokenCount = 1164226743; + $languageCode = 'languageCode-412800396'; + $expectedResponse = new Example(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setTokenCount($tokenCount); + $expectedResponse->setLanguageCode($languageCode); + $transport->addResponse($expectedResponse); + // Mock request + $example = new Example(); + $exampleActions = []; + $example->setActions($exampleActions); + $exampleDisplayName = 'exampleDisplayName1524254371'; + $example->setDisplayName($exampleDisplayName); + $exampleConversationState = OutputState::OUTPUT_STATE_UNSPECIFIED; + $example->setConversationState($exampleConversationState); + $request = (new UpdateExampleRequest())->setExample($example); + $response = $gapicClient->updateExample($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Examples/UpdateExample', $actualFuncCall); + $actualValue = $actualRequestObject->getExample(); + $this->assertProtobufEquals($example, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateExampleExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $example = new Example(); + $exampleActions = []; + $example->setActions($exampleActions); + $exampleDisplayName = 'exampleDisplayName1524254371'; + $example->setDisplayName($exampleDisplayName); + $exampleConversationState = OutputState::OUTPUT_STATE_UNSPECIFIED; + $example->setConversationState($exampleConversationState); + $request = (new UpdateExampleRequest())->setExample($example); + try { + $gapicClient->updateExample($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [$locationsElement]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createExampleAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $tokenCount = 1164226743; + $languageCode = 'languageCode-412800396'; + $expectedResponse = new Example(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $expectedResponse->setTokenCount($tokenCount); + $expectedResponse->setLanguageCode($languageCode); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $example = new Example(); + $exampleActions = []; + $example->setActions($exampleActions); + $exampleDisplayName = 'exampleDisplayName1524254371'; + $example->setDisplayName($exampleDisplayName); + $exampleConversationState = OutputState::OUTPUT_STATE_UNSPECIFIED; + $example->setConversationState($exampleConversationState); + $request = (new CreateExampleRequest())->setParent($formattedParent)->setExample($example); + $response = $gapicClient->createExampleAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Examples/CreateExample', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getExample(); + $this->assertProtobufEquals($example, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/DialogflowCx/tests/Unit/V3/Client/PlaybooksClientTest.php b/DialogflowCx/tests/Unit/V3/Client/PlaybooksClientTest.php new file mode 100644 index 000000000000..299fa9878cba --- /dev/null +++ b/DialogflowCx/tests/Unit/V3/Client/PlaybooksClientTest.php @@ -0,0 +1,1247 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return PlaybooksClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new PlaybooksClient($options); + } + + /** @test */ + public function createPlaybookTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $goal = 'goal3178259'; + $tokenCount = 1164226743; + $expectedResponse = new Playbook(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $expectedResponse->setTokenCount($tokenCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $playbook = new Playbook(); + $playbookDisplayName = 'playbookDisplayName-684478960'; + $playbook->setDisplayName($playbookDisplayName); + $playbookGoal = 'playbookGoal1238804688'; + $playbook->setGoal($playbookGoal); + $request = (new CreatePlaybookRequest())->setParent($formattedParent)->setPlaybook($playbook); + $response = $gapicClient->createPlaybook($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/CreatePlaybook', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPlaybook(); + $this->assertProtobufEquals($playbook, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createPlaybookExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $playbook = new Playbook(); + $playbookDisplayName = 'playbookDisplayName-684478960'; + $playbook->setDisplayName($playbookDisplayName); + $playbookGoal = 'playbookGoal1238804688'; + $playbook->setGoal($playbookGoal); + $request = (new CreatePlaybookRequest())->setParent($formattedParent)->setPlaybook($playbook); + try { + $gapicClient->createPlaybook($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createPlaybookVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $description = 'description-1724546052'; + $expectedResponse = new PlaybookVersion(); + $expectedResponse->setName($name); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $playbookVersion = new PlaybookVersion(); + $request = (new CreatePlaybookVersionRequest()) + ->setParent($formattedParent) + ->setPlaybookVersion($playbookVersion); + $response = $gapicClient->createPlaybookVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/CreatePlaybookVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPlaybookVersion(); + $this->assertProtobufEquals($playbookVersion, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createPlaybookVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $playbookVersion = new PlaybookVersion(); + $request = (new CreatePlaybookVersionRequest()) + ->setParent($formattedParent) + ->setPlaybookVersion($playbookVersion); + try { + $gapicClient->createPlaybookVersion($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deletePlaybookTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new DeletePlaybookRequest())->setName($formattedName); + $gapicClient->deletePlaybook($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/DeletePlaybook', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deletePlaybookExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new DeletePlaybookRequest())->setName($formattedName); + try { + $gapicClient->deletePlaybook($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deletePlaybookVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + $request = (new DeletePlaybookVersionRequest())->setName($formattedName); + $gapicClient->deletePlaybookVersion($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/DeletePlaybookVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deletePlaybookVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + $request = (new DeletePlaybookVersionRequest())->setName($formattedName); + try { + $gapicClient->deletePlaybookVersion($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function exportPlaybookTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/exportPlaybookTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $playbookUri2 = 'playbookUri21478511485'; + $expectedResponse = new ExportPlaybookResponse(); + $expectedResponse->setPlaybookUri($playbookUri2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/exportPlaybookTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new ExportPlaybookRequest())->setName($formattedName); + $response = $gapicClient->exportPlaybook($request); + $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.cx.v3.Playbooks/ExportPlaybook', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportPlaybookTest'); + $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 exportPlaybookExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/exportPlaybookTest'); + $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 = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new ExportPlaybookRequest())->setName($formattedName); + $response = $gapicClient->exportPlaybook($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/exportPlaybookTest'); + 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 */ + public function getPlaybookTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $goal = 'goal3178259'; + $tokenCount = 1164226743; + $expectedResponse = new Playbook(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $expectedResponse->setTokenCount($tokenCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new GetPlaybookRequest())->setName($formattedName); + $response = $gapicClient->getPlaybook($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/GetPlaybook', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPlaybookExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new GetPlaybookRequest())->setName($formattedName); + try { + $gapicClient->getPlaybook($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPlaybookVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $description = 'description-1724546052'; + $expectedResponse = new PlaybookVersion(); + $expectedResponse->setName($name2); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + $request = (new GetPlaybookVersionRequest())->setName($formattedName); + $response = $gapicClient->getPlaybookVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/GetPlaybookVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getPlaybookVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + $request = (new GetPlaybookVersionRequest())->setName($formattedName); + try { + $gapicClient->getPlaybookVersion($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function importPlaybookTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/importPlaybookTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $playbook = 'playbook1879182365'; + $expectedResponse = new ImportPlaybookResponse(); + $expectedResponse->setPlaybook($playbook); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/importPlaybookTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $request = (new ImportPlaybookRequest())->setParent($formattedParent); + $response = $gapicClient->importPlaybook($request); + $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.cx.v3.Playbooks/ImportPlaybook', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importPlaybookTest'); + $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 importPlaybookExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/importPlaybookTest'); + $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 + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $request = (new ImportPlaybookRequest())->setParent($formattedParent); + $response = $gapicClient->importPlaybook($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/importPlaybookTest'); + 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 */ + public function listPlaybookVersionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $playbookVersionsElement = new PlaybookVersion(); + $playbookVersions = [$playbookVersionsElement]; + $expectedResponse = new ListPlaybookVersionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPlaybookVersions($playbookVersions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new ListPlaybookVersionsRequest())->setParent($formattedParent); + $response = $gapicClient->listPlaybookVersions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPlaybookVersions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/ListPlaybookVersions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPlaybookVersionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->playbookName('[PROJECT]', '[LOCATION]', '[AGENT]', '[PLAYBOOK]'); + $request = (new ListPlaybookVersionsRequest())->setParent($formattedParent); + try { + $gapicClient->listPlaybookVersions($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPlaybooksTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $playbooksElement = new Playbook(); + $playbooks = [$playbooksElement]; + $expectedResponse = new ListPlaybooksResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setPlaybooks($playbooks); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $request = (new ListPlaybooksRequest())->setParent($formattedParent); + $response = $gapicClient->listPlaybooks($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getPlaybooks()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/ListPlaybooks', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listPlaybooksExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $request = (new ListPlaybooksRequest())->setParent($formattedParent); + try { + $gapicClient->listPlaybooks($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function restorePlaybookVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new RestorePlaybookVersionResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + $request = (new RestorePlaybookVersionRequest())->setName($formattedName); + $response = $gapicClient->restorePlaybookVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/RestorePlaybookVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function restorePlaybookVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->playbookVersionName( + '[PROJECT]', + '[LOCATION]', + '[AGENT]', + '[PLAYBOOK]', + '[VERSION]' + ); + $request = (new RestorePlaybookVersionRequest())->setName($formattedName); + try { + $gapicClient->restorePlaybookVersion($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updatePlaybookTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $goal = 'goal3178259'; + $tokenCount = 1164226743; + $expectedResponse = new Playbook(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $expectedResponse->setTokenCount($tokenCount); + $transport->addResponse($expectedResponse); + // Mock request + $playbook = new Playbook(); + $playbookDisplayName = 'playbookDisplayName-684478960'; + $playbook->setDisplayName($playbookDisplayName); + $playbookGoal = 'playbookGoal1238804688'; + $playbook->setGoal($playbookGoal); + $request = (new UpdatePlaybookRequest())->setPlaybook($playbook); + $response = $gapicClient->updatePlaybook($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/UpdatePlaybook', $actualFuncCall); + $actualValue = $actualRequestObject->getPlaybook(); + $this->assertProtobufEquals($playbook, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updatePlaybookExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $playbook = new Playbook(); + $playbookDisplayName = 'playbookDisplayName-684478960'; + $playbook->setDisplayName($playbookDisplayName); + $playbookGoal = 'playbookGoal1238804688'; + $playbook->setGoal($playbookGoal); + $request = (new UpdatePlaybookRequest())->setPlaybook($playbook); + try { + $gapicClient->updatePlaybook($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [$locationsElement]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createPlaybookAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $goal = 'goal3178259'; + $tokenCount = 1164226743; + $expectedResponse = new Playbook(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setGoal($goal); + $expectedResponse->setTokenCount($tokenCount); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $playbook = new Playbook(); + $playbookDisplayName = 'playbookDisplayName-684478960'; + $playbook->setDisplayName($playbookDisplayName); + $playbookGoal = 'playbookGoal1238804688'; + $playbook->setGoal($playbookGoal); + $request = (new CreatePlaybookRequest())->setParent($formattedParent)->setPlaybook($playbook); + $response = $gapicClient->createPlaybookAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Playbooks/CreatePlaybook', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getPlaybook(); + $this->assertProtobufEquals($playbook, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/DialogflowCx/tests/Unit/V3/Client/ToolsClientTest.php b/DialogflowCx/tests/Unit/V3/Client/ToolsClientTest.php new file mode 100644 index 000000000000..f3c0620d148f --- /dev/null +++ b/DialogflowCx/tests/Unit/V3/Client/ToolsClientTest.php @@ -0,0 +1,959 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ToolsClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ToolsClient($options); + } + + /** @test */ + public function createToolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new Tool(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $tool = new Tool(); + $toolDisplayName = 'toolDisplayName435004853'; + $tool->setDisplayName($toolDisplayName); + $toolDescription = 'toolDescription1291277124'; + $tool->setDescription($toolDescription); + $request = (new CreateToolRequest())->setParent($formattedParent)->setTool($tool); + $response = $gapicClient->createTool($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/CreateTool', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getTool(); + $this->assertProtobufEquals($tool, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createToolExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $tool = new Tool(); + $toolDisplayName = 'toolDisplayName435004853'; + $tool->setDisplayName($toolDisplayName); + $toolDescription = 'toolDescription1291277124'; + $tool->setDescription($toolDescription); + $request = (new CreateToolRequest())->setParent($formattedParent)->setTool($tool); + try { + $gapicClient->createTool($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createToolVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ToolVersion(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $toolVersion = new ToolVersion(); + $toolVersionDisplayName = 'toolVersionDisplayName1899387437'; + $toolVersion->setDisplayName($toolVersionDisplayName); + $toolVersionTool = new Tool(); + $toolDisplayName = 'toolDisplayName435004853'; + $toolVersionTool->setDisplayName($toolDisplayName); + $toolDescription = 'toolDescription1291277124'; + $toolVersionTool->setDescription($toolDescription); + $toolVersion->setTool($toolVersionTool); + $request = (new CreateToolVersionRequest())->setParent($formattedParent)->setToolVersion($toolVersion); + $response = $gapicClient->createToolVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/CreateToolVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getToolVersion(); + $this->assertProtobufEquals($toolVersion, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createToolVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $toolVersion = new ToolVersion(); + $toolVersionDisplayName = 'toolVersionDisplayName1899387437'; + $toolVersion->setDisplayName($toolVersionDisplayName); + $toolVersionTool = new Tool(); + $toolDisplayName = 'toolDisplayName435004853'; + $toolVersionTool->setDisplayName($toolDisplayName); + $toolDescription = 'toolDescription1291277124'; + $toolVersionTool->setDescription($toolDescription); + $toolVersion->setTool($toolVersionTool); + $request = (new CreateToolVersionRequest())->setParent($formattedParent)->setToolVersion($toolVersion); + try { + $gapicClient->createToolVersion($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteToolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $request = (new DeleteToolRequest())->setName($formattedName); + $gapicClient->deleteTool($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/DeleteTool', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteToolExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $request = (new DeleteToolRequest())->setName($formattedName); + try { + $gapicClient->deleteTool($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteToolVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->toolVersionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]', '[VERSION]'); + $request = (new DeleteToolVersionRequest())->setName($formattedName); + $gapicClient->deleteToolVersion($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/DeleteToolVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteToolVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->toolVersionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]', '[VERSION]'); + $request = (new DeleteToolVersionRequest())->setName($formattedName); + try { + $gapicClient->deleteToolVersion($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getToolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new Tool(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $request = (new GetToolRequest())->setName($formattedName); + $response = $gapicClient->getTool($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/GetTool', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getToolExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $request = (new GetToolRequest())->setName($formattedName); + try { + $gapicClient->getTool($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getToolVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new ToolVersion(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->toolVersionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]', '[VERSION]'); + $request = (new GetToolVersionRequest())->setName($formattedName); + $response = $gapicClient->getToolVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/GetToolVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getToolVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->toolVersionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]', '[VERSION]'); + $request = (new GetToolVersionRequest())->setName($formattedName); + try { + $gapicClient->getToolVersion($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listToolVersionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $toolVersionsElement = new ToolVersion(); + $toolVersions = [$toolVersionsElement]; + $expectedResponse = new ListToolVersionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setToolVersions($toolVersions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $request = (new ListToolVersionsRequest())->setParent($formattedParent); + $response = $gapicClient->listToolVersions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getToolVersions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/ListToolVersions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listToolVersionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->toolName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]'); + $request = (new ListToolVersionsRequest())->setParent($formattedParent); + try { + $gapicClient->listToolVersions($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listToolsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $toolsElement = new Tool(); + $tools = [$toolsElement]; + $expectedResponse = new ListToolsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setTools($tools); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $request = (new ListToolsRequest())->setParent($formattedParent); + $response = $gapicClient->listTools($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getTools()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/ListTools', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listToolsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $request = (new ListToolsRequest())->setParent($formattedParent); + try { + $gapicClient->listTools($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function restoreToolVersionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new RestoreToolVersionResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->toolVersionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]', '[VERSION]'); + $request = (new RestoreToolVersionRequest())->setName($formattedName); + $response = $gapicClient->restoreToolVersion($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/RestoreToolVersion', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function restoreToolVersionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->toolVersionName('[PROJECT]', '[LOCATION]', '[AGENT]', '[TOOL]', '[VERSION]'); + $request = (new RestoreToolVersionRequest())->setName($formattedName); + try { + $gapicClient->restoreToolVersion($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateToolTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new Tool(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $tool = new Tool(); + $toolDisplayName = 'toolDisplayName435004853'; + $tool->setDisplayName($toolDisplayName); + $toolDescription = 'toolDescription1291277124'; + $tool->setDescription($toolDescription); + $request = (new UpdateToolRequest())->setTool($tool); + $response = $gapicClient->updateTool($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/UpdateTool', $actualFuncCall); + $actualValue = $actualRequestObject->getTool(); + $this->assertProtobufEquals($tool, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateToolExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + // Mock request + $tool = new Tool(); + $toolDisplayName = 'toolDisplayName435004853'; + $tool->setDisplayName($toolDisplayName); + $toolDescription = 'toolDescription1291277124'; + $tool->setDescription($toolDescription); + $request = (new UpdateToolRequest())->setTool($tool); + try { + $gapicClient->updateTool($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $locationId = 'locationId552319461'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Location(); + $expectedResponse->setName($name2); + $expectedResponse->setLocationId($locationId); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + $request = new GetLocationRequest(); + $response = $gapicClient->getLocation($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/GetLocation', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getLocationExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + $request = new GetLocationRequest(); + try { + $gapicClient->getLocation($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $locationsElement = new Location(); + $locations = [$locationsElement]; + $expectedResponse = new ListLocationsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setLocations($locations); + $transport->addResponse($expectedResponse); + $request = new ListLocationsRequest(); + $response = $gapicClient->listLocations($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getLocations()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.location.Locations/ListLocations', $actualFuncCall); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listLocationsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $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 + ); + $transport->addResponse(null, $status); + $request = new ListLocationsRequest(); + try { + $gapicClient->listLocations($request); + // If the $gapicClient 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 stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createToolAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $description = 'description-1724546052'; + $expectedResponse = new Tool(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $expectedResponse->setDescription($description); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->agentName('[PROJECT]', '[LOCATION]', '[AGENT]'); + $tool = new Tool(); + $toolDisplayName = 'toolDisplayName435004853'; + $tool->setDisplayName($toolDisplayName); + $toolDescription = 'toolDescription1291277124'; + $tool->setDescription($toolDescription); + $request = (new CreateToolRequest())->setParent($formattedParent)->setTool($tool); + $response = $gapicClient->createToolAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.dialogflow.cx.v3.Tools/CreateTool', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getTool(); + $this->assertProtobufEquals($tool, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +}