google-cloud-dialogflow-cx-v3 0.21.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dialogflow/cx/v3/advanced_settings_pb.rb +2 -1
  3. data/lib/google/cloud/dialogflow/cx/v3/agent_pb.rb +2 -1
  4. data/lib/google/cloud/dialogflow/cx/v3/audio_config_pb.rb +2 -1
  5. data/lib/google/cloud/dialogflow/cx/v3/entity_type_pb.rb +1 -1
  6. data/lib/google/cloud/dialogflow/cx/v3/entity_type_services_pb.rb +2 -2
  7. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +119 -119
  8. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +112 -112
  9. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +50 -50
  10. data/lib/google/cloud/dialogflow/cx/v3/flow_pb.rb +3 -1
  11. data/lib/google/cloud/dialogflow/cx/v3/fulfillment_pb.rb +3 -1
  12. data/lib/google/cloud/dialogflow/cx/v3/generator_pb.rb +60 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/generator_services_pb.rb +55 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/generators/client.rb +827 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/generators/credentials.rb +54 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/generators/paths.rb +75 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +771 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/service_stub.rb +347 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/generators/rest.rb +55 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/generators.rb +57 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/inline_pb.rb +47 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/intent_pb.rb +13 -1
  23. data/lib/google/cloud/dialogflow/cx/v3/intent_services_pb.rb +22 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +268 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/intents/operations.rb +781 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +254 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/operations.rb +892 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +120 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/intents/rest.rb +1 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +1 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/page_pb.rb +3 -1
  32. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +1 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +14 -1
  34. data/lib/google/cloud/dialogflow/cx/v3/session_services_pb.rb +3 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +101 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb +45 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +94 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +60 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  40. data/lib/google/cloud/dialogflow/cx/v3.rb +1 -0
  41. data/proto_docs/google/api/client.rb +13 -0
  42. data/proto_docs/google/cloud/dialogflow/cx/v3/advanced_settings.rb +28 -0
  43. data/proto_docs/google/cloud/dialogflow/cx/v3/agent.rb +15 -0
  44. data/proto_docs/google/cloud/dialogflow/cx/v3/audio_config.rb +47 -3
  45. data/proto_docs/google/cloud/dialogflow/cx/v3/flow.rb +4 -0
  46. data/proto_docs/google/cloud/dialogflow/cx/v3/fulfillment.rb +11 -0
  47. data/proto_docs/google/cloud/dialogflow/cx/v3/generator.rb +187 -0
  48. data/proto_docs/google/cloud/dialogflow/cx/v3/inline.rb +49 -0
  49. data/proto_docs/google/cloud/dialogflow/cx/v3/intent.rb +175 -0
  50. data/proto_docs/google/cloud/dialogflow/cx/v3/page.rb +8 -0
  51. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +192 -0
  52. metadata +17 -3
@@ -140,6 +140,12 @@ module Google
140
140
  @quota_project_id = @config.quota_project
141
141
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
142
142
 
143
+ @operations_client = Operations.new do |config|
144
+ config.credentials = credentials
145
+ config.quota_project = @quota_project_id
146
+ config.endpoint = @config.endpoint
147
+ end
148
+
143
149
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
144
150
  config.credentials = credentials
145
151
  config.quota_project = @quota_project_id
@@ -156,6 +162,13 @@ module Google
156
162
  )
157
163
  end
158
164
 
165
+ ##
166
+ # Get the associated client for long-running operations.
167
+ #
168
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Intents::Operations]
169
+ #
170
+ attr_reader :operations_client
171
+
159
172
  ##
160
173
  # Get the associated client for mix-in of the Locations.
161
174
  #
@@ -667,6 +680,247 @@ module Google
667
680
  raise ::Google::Cloud::Error.from_error(e)
668
681
  end
669
682
 
683
+ ##
684
+ # Imports the specified intents into the agent.
685
+ #
686
+ # This method is a [long-running
687
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
688
+ # The returned `Operation` type has the following method-specific fields:
689
+ #
690
+ # - `metadata`:
691
+ # {::Google::Cloud::Dialogflow::CX::V3::ImportIntentsMetadata ImportIntentsMetadata}
692
+ # - `response`:
693
+ # {::Google::Cloud::Dialogflow::CX::V3::ImportIntentsResponse ImportIntentsResponse}
694
+ #
695
+ # @overload import_intents(request, options = nil)
696
+ # Pass arguments to `import_intents` via a request object, either of type
697
+ # {::Google::Cloud::Dialogflow::CX::V3::ImportIntentsRequest} or an equivalent Hash.
698
+ #
699
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ImportIntentsRequest, ::Hash]
700
+ # A request object representing the call parameters. Required. To specify no
701
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
702
+ # @param options [::Gapic::CallOptions, ::Hash]
703
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
704
+ #
705
+ # @overload import_intents(parent: nil, intents_uri: nil, intents_content: nil, merge_option: nil)
706
+ # Pass arguments to `import_intents` via keyword arguments. Note that at
707
+ # least one keyword argument is required. To specify no parameters, or to keep all
708
+ # the default parameter values, pass an empty Hash as a request object (see above).
709
+ #
710
+ # @param parent [::String]
711
+ # Required. The agent to import the intents into.
712
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
713
+ # @param intents_uri [::String]
714
+ # The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
715
+ # to import intents from. The format of this URI must be
716
+ # `gs://<bucket-name>/<object-name>`.
717
+ #
718
+ # Dialogflow performs a read operation for the Cloud Storage object
719
+ # on the caller's behalf, so your request authentication must
720
+ # have read permissions for the object. For more information, see
721
+ # [Dialogflow access
722
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
723
+ # @param intents_content [::Google::Cloud::Dialogflow::CX::V3::InlineSource, ::Hash]
724
+ # Uncompressed byte content of intents.
725
+ # @param merge_option [::Google::Cloud::Dialogflow::CX::V3::ImportIntentsRequest::MergeOption]
726
+ # Merge option for importing intents. If not specified, `REJECT` is assumed.
727
+ #
728
+ # @yield [response, operation] Access the result along with the RPC operation
729
+ # @yieldparam response [::Gapic::Operation]
730
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
731
+ #
732
+ # @return [::Gapic::Operation]
733
+ #
734
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
735
+ #
736
+ # @example Basic example
737
+ # require "google/cloud/dialogflow/cx/v3"
738
+ #
739
+ # # Create a client object. The client can be reused for multiple calls.
740
+ # client = Google::Cloud::Dialogflow::CX::V3::Intents::Client.new
741
+ #
742
+ # # Create a request. To set request fields, pass in keyword arguments.
743
+ # request = Google::Cloud::Dialogflow::CX::V3::ImportIntentsRequest.new
744
+ #
745
+ # # Call the import_intents method.
746
+ # result = client.import_intents request
747
+ #
748
+ # # The returned object is of type Gapic::Operation. You can use it to
749
+ # # check the status of an operation, cancel it, or wait for results.
750
+ # # Here is how to wait for a response.
751
+ # result.wait_until_done! timeout: 60
752
+ # if result.response?
753
+ # p result.response
754
+ # else
755
+ # puts "No response received."
756
+ # end
757
+ #
758
+ def import_intents request, options = nil
759
+ raise ::ArgumentError, "request must be provided" if request.nil?
760
+
761
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ImportIntentsRequest
762
+
763
+ # Converts hash and nil to an options object
764
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
765
+
766
+ # Customize the options with defaults
767
+ metadata = @config.rpcs.import_intents.metadata.to_h
768
+
769
+ # Set x-goog-api-client and x-goog-user-project headers
770
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
771
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
772
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
773
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
774
+
775
+ header_params = {}
776
+ if request.parent
777
+ header_params["parent"] = request.parent
778
+ end
779
+
780
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
781
+ metadata[:"x-goog-request-params"] ||= request_params_header
782
+
783
+ options.apply_defaults timeout: @config.rpcs.import_intents.timeout,
784
+ metadata: metadata,
785
+ retry_policy: @config.rpcs.import_intents.retry_policy
786
+
787
+ options.apply_defaults timeout: @config.timeout,
788
+ metadata: @config.metadata,
789
+ retry_policy: @config.retry_policy
790
+
791
+ @intents_stub.call_rpc :import_intents, request, options: options do |response, operation|
792
+ response = ::Gapic::Operation.new response, @operations_client, options: options
793
+ yield response, operation if block_given?
794
+ return response
795
+ end
796
+ rescue ::GRPC::BadStatus => e
797
+ raise ::Google::Cloud::Error.from_error(e)
798
+ end
799
+
800
+ ##
801
+ # Exports the selected intents.
802
+ #
803
+ # This method is a [long-running
804
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
805
+ # The returned `Operation` type has the following method-specific fields:
806
+ #
807
+ # - `metadata`:
808
+ # {::Google::Cloud::Dialogflow::CX::V3::ExportIntentsMetadata ExportIntentsMetadata}
809
+ # - `response`:
810
+ # {::Google::Cloud::Dialogflow::CX::V3::ExportIntentsResponse ExportIntentsResponse}
811
+ #
812
+ # @overload export_intents(request, options = nil)
813
+ # Pass arguments to `export_intents` via a request object, either of type
814
+ # {::Google::Cloud::Dialogflow::CX::V3::ExportIntentsRequest} or an equivalent Hash.
815
+ #
816
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ExportIntentsRequest, ::Hash]
817
+ # A request object representing the call parameters. Required. To specify no
818
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
819
+ # @param options [::Gapic::CallOptions, ::Hash]
820
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
821
+ #
822
+ # @overload export_intents(parent: nil, intents: nil, intents_uri: nil, intents_content_inline: nil, data_format: nil)
823
+ # Pass arguments to `export_intents` via keyword arguments. Note that at
824
+ # least one keyword argument is required. To specify no parameters, or to keep all
825
+ # the default parameter values, pass an empty Hash as a request object (see above).
826
+ #
827
+ # @param parent [::String]
828
+ # Required. The name of the parent agent to export intents.
829
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
830
+ # ID>`.
831
+ # @param intents [::Array<::String>]
832
+ # Required. The name of the intents to export.
833
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
834
+ # ID>/intents/<Intent ID>`.
835
+ # @param intents_uri [::String]
836
+ # Optional. The [Google Cloud
837
+ # Storage](https://cloud.google.com/storage/docs/) URI to export the
838
+ # intents to. The format of this URI must be
839
+ # `gs://<bucket-name>/<object-name>`.
840
+ #
841
+ # Dialogflow performs a write operation for the Cloud Storage object
842
+ # on the caller's behalf, so your request authentication must
843
+ # have write permissions for the object. For more information, see
844
+ # [Dialogflow access
845
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
846
+ # @param intents_content_inline [::Boolean]
847
+ # Optional. The option to return the serialized intents inline.
848
+ # @param data_format [::Google::Cloud::Dialogflow::CX::V3::ExportIntentsRequest::DataFormat]
849
+ # Optional. The data format of the exported intents. If not specified, `BLOB`
850
+ # is assumed.
851
+ #
852
+ # @yield [response, operation] Access the result along with the RPC operation
853
+ # @yieldparam response [::Gapic::Operation]
854
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
855
+ #
856
+ # @return [::Gapic::Operation]
857
+ #
858
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
859
+ #
860
+ # @example Basic example
861
+ # require "google/cloud/dialogflow/cx/v3"
862
+ #
863
+ # # Create a client object. The client can be reused for multiple calls.
864
+ # client = Google::Cloud::Dialogflow::CX::V3::Intents::Client.new
865
+ #
866
+ # # Create a request. To set request fields, pass in keyword arguments.
867
+ # request = Google::Cloud::Dialogflow::CX::V3::ExportIntentsRequest.new
868
+ #
869
+ # # Call the export_intents method.
870
+ # result = client.export_intents request
871
+ #
872
+ # # The returned object is of type Gapic::Operation. You can use it to
873
+ # # check the status of an operation, cancel it, or wait for results.
874
+ # # Here is how to wait for a response.
875
+ # result.wait_until_done! timeout: 60
876
+ # if result.response?
877
+ # p result.response
878
+ # else
879
+ # puts "No response received."
880
+ # end
881
+ #
882
+ def export_intents request, options = nil
883
+ raise ::ArgumentError, "request must be provided" if request.nil?
884
+
885
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ExportIntentsRequest
886
+
887
+ # Converts hash and nil to an options object
888
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
889
+
890
+ # Customize the options with defaults
891
+ metadata = @config.rpcs.export_intents.metadata.to_h
892
+
893
+ # Set x-goog-api-client and x-goog-user-project headers
894
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
895
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
896
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION
897
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
898
+
899
+ header_params = {}
900
+ if request.parent
901
+ header_params["parent"] = request.parent
902
+ end
903
+
904
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
905
+ metadata[:"x-goog-request-params"] ||= request_params_header
906
+
907
+ options.apply_defaults timeout: @config.rpcs.export_intents.timeout,
908
+ metadata: metadata,
909
+ retry_policy: @config.rpcs.export_intents.retry_policy
910
+
911
+ options.apply_defaults timeout: @config.timeout,
912
+ metadata: @config.metadata,
913
+ retry_policy: @config.retry_policy
914
+
915
+ @intents_stub.call_rpc :export_intents, request, options: options do |response, operation|
916
+ response = ::Gapic::Operation.new response, @operations_client, options: options
917
+ yield response, operation if block_given?
918
+ return response
919
+ end
920
+ rescue ::GRPC::BadStatus => e
921
+ raise ::Google::Cloud::Error.from_error(e)
922
+ end
923
+
670
924
  ##
671
925
  # Configuration class for the Intents API.
672
926
  #
@@ -837,6 +1091,16 @@ module Google
837
1091
  # @return [::Gapic::Config::Method]
838
1092
  #
839
1093
  attr_reader :delete_intent
1094
+ ##
1095
+ # RPC-specific configuration for `import_intents`
1096
+ # @return [::Gapic::Config::Method]
1097
+ #
1098
+ attr_reader :import_intents
1099
+ ##
1100
+ # RPC-specific configuration for `export_intents`
1101
+ # @return [::Gapic::Config::Method]
1102
+ #
1103
+ attr_reader :export_intents
840
1104
 
841
1105
  # @private
842
1106
  def initialize parent_rpcs = nil
@@ -850,6 +1114,10 @@ module Google
850
1114
  @update_intent = ::Gapic::Config::Method.new update_intent_config
851
1115
  delete_intent_config = parent_rpcs.delete_intent if parent_rpcs.respond_to? :delete_intent
852
1116
  @delete_intent = ::Gapic::Config::Method.new delete_intent_config
1117
+ import_intents_config = parent_rpcs.import_intents if parent_rpcs.respond_to? :import_intents
1118
+ @import_intents = ::Gapic::Config::Method.new import_intents_config
1119
+ export_intents_config = parent_rpcs.export_intents if parent_rpcs.respond_to? :export_intents
1120
+ @export_intents = ::Gapic::Config::Method.new export_intents_config
853
1121
 
854
1122
  yield self if block_given?
855
1123
  end