diff --git a/google-cloud-dialogflow/lib/google/cloud/dialogflow/v2/intents_client.rb b/google-cloud-dialogflow/lib/google/cloud/dialogflow/v2/intents_client.rb index 82c01b259e97..5e62897d496c 100644 --- a/google-cloud-dialogflow/lib/google/cloud/dialogflow/v2/intents_client.rb +++ b/google-cloud-dialogflow/lib/google/cloud/dialogflow/v2/intents_client.rb @@ -536,14 +536,11 @@ def create_intent \ # # # TODO: Initialize `intent`: # intent = {} - # - # # TODO: Initialize `language_code`: - # language_code = '' - # response = intents_client.update_intent(intent, language_code) + # response = intents_client.update_intent(intent) def update_intent \ intent, - language_code, + language_code: nil, update_mask: nil, intent_view: nil, options: nil, @@ -597,13 +594,6 @@ def delete_intent \ # @param parent [String] # Required. The name of the agent to update or create intents in. # Format: `projects//agent`. - # @param language_code [String] - # Optional. The language of training phrases, parameters and rich messages - # defined in `intents`. If not specified, the agent's default language is - # used. [Many - # languages](https://cloud.google.com/dialogflow/docs/reference/language) - # are supported. Note: languages must be enabled in the agent before they can - # be used. # @param intent_batch_uri [String] # The URI to a Google Cloud Storage file containing intents to update or # create. The file format can either be a serialized proto (of IntentBatch @@ -612,6 +602,13 @@ def delete_intent \ # The collection of intents to update or create. # A hash of the same form as `Google::Cloud::Dialogflow::V2::IntentBatch` # can also be provided. + # @param language_code [String] + # Optional. The language of training phrases, parameters and rich messages + # defined in `intents`. If not specified, the agent's default language is + # used. [Many + # languages](https://cloud.google.com/dialogflow/docs/reference/language) + # are supported. Note: languages must be enabled in the agent before they can + # be used. # @param update_mask [Google::Protobuf::FieldMask | Hash] # Optional. The mask to control which fields get updated. # A hash of the same form as `Google::Protobuf::FieldMask` @@ -629,11 +626,8 @@ def delete_intent \ # intents_client = Google::Cloud::Dialogflow::Intents.new(version: :v2) # formatted_parent = Google::Cloud::Dialogflow::V2::IntentsClient.project_agent_path("[PROJECT]") # - # # TODO: Initialize `language_code`: - # language_code = '' - # # # Register a callback during the method call. - # operation = intents_client.batch_update_intents(formatted_parent, language_code) do |op| + # operation = intents_client.batch_update_intents(formatted_parent) do |op| # raise op.results.message if op.error? # op_results = op.results # # Process the results. @@ -661,17 +655,17 @@ def delete_intent \ def batch_update_intents \ parent, - language_code, intent_batch_uri: nil, intent_batch_inline: nil, + language_code: nil, update_mask: nil, intent_view: nil, options: nil req = { parent: parent, - language_code: language_code, intent_batch_uri: intent_batch_uri, intent_batch_inline: intent_batch_inline, + language_code: language_code, update_mask: update_mask, intent_view: intent_view }.delete_if { |_, v| v.nil? } diff --git a/google-cloud-dialogflow/synth.metadata b/google-cloud-dialogflow/synth.metadata index b9a36f257eda..3e01375ab741 100644 --- a/google-cloud-dialogflow/synth.metadata +++ b/google-cloud-dialogflow/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2020-02-06T11:40:33.101264Z", + "updateTime": "2020-02-07T11:40:22.411474Z", "sources": [ { "generator": { @@ -12,9 +12,9 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "45d2a569ab526a1fad3720f95eefb1c7330eaada", - "internalRef": "293515675", - "log": "45d2a569ab526a1fad3720f95eefb1c7330eaada\nEnable client generation for v1 ManagedIdentities API.\n\nPiperOrigin-RevId: 293515675\n\n2c17086b77e6f3bcf04a1f65758dfb0c3da1568f\nAdd the Actions on Google common types (//google/actions/type/*).\n\nPiperOrigin-RevId: 293478245\n\n781aadb932e64a12fb6ead7cd842698d99588433\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293443396\n\ne2602608c9138c2fca24162720e67f9307c30b95\nDialogflow weekly v2/v2beta1 library update:\n- Documentation updates\nImportant updates are also posted at\nhttps://cloud.google.com/dialogflow/docs/release-notes\n\nPiperOrigin-RevId: 293442964\n\nc8aef82028d06b7992278fa9294c18570dc86c3d\nAdd cc_proto_library and cc_grpc_library targets for Bigtable protos.\n\nAlso fix indentation of cc_grpc_library targets in Spanner and IAM protos.\n\nPiperOrigin-RevId: 293440538\n\ne2faab04f4cb7f9755072330866689b1943a16e9\ncloudtasks: v2 replace non-standard retry params in gapic config v2\n\nPiperOrigin-RevId: 293424055\n\ndfb4097ea628a8470292c6590a4313aee0c675bd\nerrorreporting: v1beta1 add legacy artman config for php\n\nPiperOrigin-RevId: 293423790\n\nb18aed55b45bfe5b62476292c72759e6c3e573c6\nasset: v1p1beta1 updated comment for `page_size` limit.\n\nPiperOrigin-RevId: 293421386\n\nc9ef36b7956d9859a2fc86ad35fcaa16958ab44f\nbazel: Refactor CI build scripts\n\nPiperOrigin-RevId: 293387911\n\na8ed9d921fdddc61d8467bfd7c1668f0ad90435c\nfix: set Ruby module name for OrgPolicy\n\nPiperOrigin-RevId: 293257997\n\n6c7d28509bd8315de8af0889688ee20099594269\nredis: v1beta1 add UpgradeInstance and connect_mode field to Instance\n\nPiperOrigin-RevId: 293242878\n\nae0abed4fcb4c21f5cb67a82349a049524c4ef68\nredis: v1 add connect_mode field to Instance\n\nPiperOrigin-RevId: 293241914\n\n3f7a0d29b28ee9365771da2b66edf7fa2b4e9c56\nAdds service config definition for bigqueryreservation v1beta1\n\nPiperOrigin-RevId: 293234418\n\n0c88168d5ed6fe353a8cf8cbdc6bf084f6bb66a5\naddition of BUILD & configuration for accessapproval v1\n\nPiperOrigin-RevId: 293219198\n\n39bedc2e30f4778ce81193f6ba1fec56107bcfc4\naccessapproval: v1 publish protos\n\nPiperOrigin-RevId: 293167048\n\n" + "sha": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585", + "internalRef": "293710856", + "log": "e46f761cd6ec15a9e3d5ed4ff321a4bcba8e8585\nGenerate the Bazel build file for recommendengine public api\n\nPiperOrigin-RevId: 293710856\n\n68477017c4173c98addac0373950c6aa9d7b375f\nMake `language_code` optional for UpdateIntentRequest and BatchUpdateIntentsRequest.\n\nThe comments and proto annotations describe this parameter as optional.\n\nPiperOrigin-RevId: 293703548\n\n16f823f578bca4e845a19b88bb9bc5870ea71ab2\nAdd BUILD.bazel files for managedidentities API\n\nPiperOrigin-RevId: 293698246\n\n2f53fd8178c9a9de4ad10fae8dd17a7ba36133f2\nAdd v1p1beta1 config file\n\nPiperOrigin-RevId: 293696729\n\n052b274138fce2be80f97b6dcb83ab343c7c8812\nAdd source field for user event and add field behavior annotations\n\nPiperOrigin-RevId: 293693115\n\n1e89732b2d69151b1b3418fff3d4cc0434f0dded\ndatacatalog: v1beta1 add three new RPCs to gapic v1beta1 config\n\nPiperOrigin-RevId: 293692823\n\n9c8bd09bbdc7c4160a44f1fbab279b73cd7a2337\nchange the name of AccessApproval service to AccessApprovalAdmin\n\nPiperOrigin-RevId: 293690934\n\n2e23b8fbc45f5d9e200572ca662fe1271bcd6760\nAdd ListEntryGroups method, add http bindings to support entry group tagging, and update some comments.\n\nPiperOrigin-RevId: 293666452\n\n0275e38a4ca03a13d3f47a9613aac8c8b0d3f1f2\nAdd proto_package field to managedidentities API. It is needed for APIs that still depend on artman generation.\n\nPiperOrigin-RevId: 293643323\n\n4cdfe8278cb6f308106580d70648001c9146e759\nRegenerating public protos for Data Catalog to add new Custom Type Entry feature.\n\nPiperOrigin-RevId: 293614782\n\n" } }, { diff --git a/google-cloud-dialogflow/test/google/cloud/dialogflow/v2/intents_client_test.rb b/google-cloud-dialogflow/test/google/cloud/dialogflow/v2/intents_client_test.rb index 113df3dd2f0f..d64b942ad3ca 100644 --- a/google-cloud-dialogflow/test/google/cloud/dialogflow/v2/intents_client_test.rb +++ b/google-cloud-dialogflow/test/google/cloud/dialogflow/v2/intents_client_test.rb @@ -334,7 +334,6 @@ def updater_proc it 'invokes update_intent without error' do # Create request parameters intent = {} - language_code = '' # Create expected grpc response name = "name3373707" @@ -363,7 +362,6 @@ def updater_proc mock_method = proc do |request| assert_instance_of(Google::Cloud::Dialogflow::V2::UpdateIntentRequest, request) assert_equal(Google::Gax::to_proto(intent, Google::Cloud::Dialogflow::V2::Intent), request.intent) - assert_equal(language_code, request.language_code) OpenStruct.new(execute: expected_response) end mock_stub = MockGrpcClientStub_v2.new(:update_intent, mock_method) @@ -376,13 +374,13 @@ def updater_proc client = Google::Cloud::Dialogflow::Intents.new(version: :v2) # Call method - response = client.update_intent(intent, language_code) + response = client.update_intent(intent) # Verify the response assert_equal(expected_response, response) # Call method with block - client.update_intent(intent, language_code) do |response, operation| + client.update_intent(intent) do |response, operation| # Verify the response assert_equal(expected_response, response) refute_nil(operation) @@ -394,13 +392,11 @@ def updater_proc it 'invokes update_intent with error' do # Create request parameters intent = {} - language_code = '' # Mock Grpc layer mock_method = proc do |request| assert_instance_of(Google::Cloud::Dialogflow::V2::UpdateIntentRequest, request) assert_equal(Google::Gax::to_proto(intent, Google::Cloud::Dialogflow::V2::Intent), request.intent) - assert_equal(language_code, request.language_code) raise custom_error end mock_stub = MockGrpcClientStub_v2.new(:update_intent, mock_method) @@ -414,7 +410,7 @@ def updater_proc # Call method err = assert_raises Google::Gax::GaxError, CustomTestError_v2 do - client.update_intent(intent, language_code) + client.update_intent(intent) end # Verify the GaxError wrapped the custom error that was raised. @@ -499,7 +495,6 @@ def updater_proc it 'invokes batch_update_intents without error' do # Create request parameters formatted_parent = Google::Cloud::Dialogflow::V2::IntentsClient.project_agent_path("[PROJECT]") - language_code = '' # Create expected grpc response expected_response = {} @@ -516,7 +511,6 @@ def updater_proc mock_method = proc do |request| assert_instance_of(Google::Cloud::Dialogflow::V2::BatchUpdateIntentsRequest, request) assert_equal(formatted_parent, request.parent) - assert_equal(language_code, request.language_code) OpenStruct.new(execute: operation) end mock_stub = MockGrpcClientStub_v2.new(:batch_update_intents, mock_method) @@ -529,7 +523,7 @@ def updater_proc client = Google::Cloud::Dialogflow::Intents.new(version: :v2) # Call method - response = client.batch_update_intents(formatted_parent, language_code) + response = client.batch_update_intents(formatted_parent) # Verify the response assert_equal(expected_response, response.response) @@ -540,7 +534,6 @@ def updater_proc it 'invokes batch_update_intents and returns an operation error.' do # Create request parameters formatted_parent = Google::Cloud::Dialogflow::V2::IntentsClient.project_agent_path("[PROJECT]") - language_code = '' # Create expected grpc response operation_error = Google::Rpc::Status.new( @@ -556,7 +549,6 @@ def updater_proc mock_method = proc do |request| assert_instance_of(Google::Cloud::Dialogflow::V2::BatchUpdateIntentsRequest, request) assert_equal(formatted_parent, request.parent) - assert_equal(language_code, request.language_code) OpenStruct.new(execute: operation) end mock_stub = MockGrpcClientStub_v2.new(:batch_update_intents, mock_method) @@ -569,7 +561,7 @@ def updater_proc client = Google::Cloud::Dialogflow::Intents.new(version: :v2) # Call method - response = client.batch_update_intents(formatted_parent, language_code) + response = client.batch_update_intents(formatted_parent) # Verify the response assert(response.error?) @@ -581,13 +573,11 @@ def updater_proc it 'invokes batch_update_intents with error' do # Create request parameters formatted_parent = Google::Cloud::Dialogflow::V2::IntentsClient.project_agent_path("[PROJECT]") - language_code = '' # Mock Grpc layer mock_method = proc do |request| assert_instance_of(Google::Cloud::Dialogflow::V2::BatchUpdateIntentsRequest, request) assert_equal(formatted_parent, request.parent) - assert_equal(language_code, request.language_code) raise custom_error end mock_stub = MockGrpcClientStub_v2.new(:batch_update_intents, mock_method) @@ -601,7 +591,7 @@ def updater_proc # Call method err = assert_raises Google::Gax::GaxError, CustomTestError_v2 do - client.batch_update_intents(formatted_parent, language_code) + client.batch_update_intents(formatted_parent) end # Verify the GaxError wrapped the custom error that was raised.