google-cloud-dialogflow-cx-v3 0.22.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/lib/google/cloud/dialogflow/cx/v3/agent_pb.rb +2 -1
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +33 -8
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +28 -6
  6. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +35 -7
  7. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +33 -8
  8. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +14 -2
  9. data/lib/google/cloud/dialogflow/cx/v3/audio_config_pb.rb +2 -1
  10. data/lib/google/cloud/dialogflow/cx/v3/changelogs/client.rb +32 -8
  11. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +34 -7
  12. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +14 -2
  13. data/lib/google/cloud/dialogflow/cx/v3/deployments/client.rb +32 -8
  14. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +34 -7
  15. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +14 -2
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_type_pb.rb +1 -1
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_type_services_pb.rb +2 -2
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +151 -127
  19. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +146 -119
  20. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +62 -50
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +33 -8
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +28 -6
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +35 -7
  24. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +33 -8
  25. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +14 -2
  26. data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +32 -8
  27. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +34 -7
  28. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +14 -2
  29. data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +33 -8
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +28 -6
  31. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +35 -7
  32. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +33 -8
  33. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +14 -2
  34. data/lib/google/cloud/dialogflow/cx/v3/generator_pb.rb +60 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/generator_services_pb.rb +55 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/generators/client.rb +851 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/generators/credentials.rb +54 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/generators/paths.rb +75 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/client.rb +798 -0
  40. data/lib/google/cloud/dialogflow/cx/v3/generators/rest/service_stub.rb +359 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/generators/rest.rb +55 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/generators.rb +57 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +33 -8
  44. data/lib/google/cloud/dialogflow/cx/v3/intents/operations.rb +28 -6
  45. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +35 -7
  46. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/operations.rb +33 -8
  47. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +14 -2
  48. data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +32 -8
  49. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +34 -7
  50. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +14 -2
  51. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +1 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +32 -8
  53. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +34 -7
  54. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +14 -2
  55. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +32 -8
  56. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +34 -7
  57. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +14 -2
  58. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +12 -1
  59. data/lib/google/cloud/dialogflow/cx/v3/session_services_pb.rb +3 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +133 -8
  61. data/lib/google/cloud/dialogflow/cx/v3/sessions/paths.rb +45 -0
  62. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +128 -7
  63. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +74 -2
  64. data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +33 -8
  65. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +28 -6
  66. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +35 -7
  67. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +33 -8
  68. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +14 -2
  69. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +32 -8
  70. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +34 -7
  71. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +14 -2
  72. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  73. data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +33 -8
  74. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +28 -6
  75. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +35 -7
  76. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +33 -8
  77. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +14 -2
  78. data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +32 -8
  79. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +34 -7
  80. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +14 -2
  81. data/lib/google/cloud/dialogflow/cx/v3.rb +1 -0
  82. data/proto_docs/google/api/client.rb +14 -0
  83. data/proto_docs/google/cloud/dialogflow/cx/v3/agent.rb +16 -0
  84. data/proto_docs/google/cloud/dialogflow/cx/v3/audio_config.rb +47 -3
  85. data/proto_docs/google/cloud/dialogflow/cx/v3/generator.rb +187 -0
  86. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +187 -0
  87. data/proto_docs/google/cloud/dialogflow/cx/v3/validation_message.rb +1 -0
  88. data/proto_docs/google/cloud/dialogflow/cx/v3/webhook.rb +2 -0
  89. metadata +17 -7
@@ -34,6 +34,9 @@ module Google
34
34
  # Service for managing {::Google::Cloud::Dialogflow::CX::V3::EntityType EntityTypes}.
35
35
  #
36
36
  class Client
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$UNIVERSE_DOMAIN$"
39
+
37
40
  include Paths
38
41
 
39
42
  # @private
@@ -99,6 +102,15 @@ module Google
99
102
  @config
100
103
  end
101
104
 
105
+ ##
106
+ # The effective universe domain
107
+ #
108
+ # @return [String]
109
+ #
110
+ def universe_domain
111
+ @entity_types_stub.universe_domain
112
+ end
113
+
102
114
  ##
103
115
  # Create a new EntityTypes REST client object.
104
116
  #
@@ -126,8 +138,9 @@ module Google
126
138
  credentials = @config.credentials
127
139
  # Use self-signed JWT if the endpoint is unchanged from default,
128
140
  # but only if the default endpoint does not have a region prefix.
129
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
130
- !@config.endpoint.split(".").first.include?("-")
141
+ enable_self_signed_jwt = @config.endpoint.nil? ||
142
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
143
+ !@config.endpoint.split(".").first.include?("-"))
131
144
  credentials ||= Credentials.default scope: @config.scope,
132
145
  enable_self_signed_jwt: enable_self_signed_jwt
133
146
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -141,10 +154,16 @@ module Google
141
154
  config.credentials = credentials
142
155
  config.quota_project = @quota_project_id
143
156
  config.endpoint = @config.endpoint
157
+ config.universe_domain = @config.universe_domain
144
158
  config.bindings_override = @config.bindings_override
145
159
  end
146
160
 
147
- @entity_types_stub = ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
161
+ @entity_types_stub = ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::ServiceStub.new(
162
+ endpoint: @config.endpoint,
163
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
164
+ universe_domain: @config.universe_domain,
165
+ credentials: credentials
166
+ )
148
167
  end
149
168
 
150
169
  ##
@@ -156,108 +175,6 @@ module Google
156
175
 
157
176
  # Service calls
158
177
 
159
- ##
160
- # Returns the list of all entity types in the specified agent.
161
- #
162
- # @overload list_entity_types(request, options = nil)
163
- # Pass arguments to `list_entity_types` via a request object, either of type
164
- # {::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest} or an equivalent Hash.
165
- #
166
- # @param request [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest, ::Hash]
167
- # A request object representing the call parameters. Required. To specify no
168
- # parameters, or to keep all the default parameter values, pass an empty Hash.
169
- # @param options [::Gapic::CallOptions, ::Hash]
170
- # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
171
- #
172
- # @overload list_entity_types(parent: nil, language_code: nil, page_size: nil, page_token: nil)
173
- # Pass arguments to `list_entity_types` via keyword arguments. Note that at
174
- # least one keyword argument is required. To specify no parameters, or to keep all
175
- # the default parameter values, pass an empty Hash as a request object (see above).
176
- #
177
- # @param parent [::String]
178
- # Required. The agent to list all entity types for.
179
- # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
180
- # @param language_code [::String]
181
- # The language to list entity types for. The following fields are language
182
- # dependent:
183
- #
184
- # * `EntityType.entities.value`
185
- # * `EntityType.entities.synonyms`
186
- # * `EntityType.excluded_phrases.value`
187
- #
188
- # If not specified, the agent's default language is used.
189
- # [Many
190
- # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
191
- # are supported.
192
- # Note: languages must be enabled in the agent before they can be used.
193
- # @param page_size [::Integer]
194
- # The maximum number of items to return in a single page. By default 100 and
195
- # at most 1000.
196
- # @param page_token [::String]
197
- # The next_page_token value returned from a previous list request.
198
- # @yield [result, operation] Access the result along with the TransportOperation object
199
- # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::EntityType>]
200
- # @yieldparam operation [::Gapic::Rest::TransportOperation]
201
- #
202
- # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::EntityType>]
203
- #
204
- # @raise [::Google::Cloud::Error] if the REST call is aborted.
205
- #
206
- # @example Basic example
207
- # require "google/cloud/dialogflow/cx/v3"
208
- #
209
- # # Create a client object. The client can be reused for multiple calls.
210
- # client = Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client.new
211
- #
212
- # # Create a request. To set request fields, pass in keyword arguments.
213
- # request = Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest.new
214
- #
215
- # # Call the list_entity_types method.
216
- # result = client.list_entity_types request
217
- #
218
- # # The returned object is of type Gapic::PagedEnumerable. You can iterate
219
- # # over elements, and API calls will be issued to fetch pages as needed.
220
- # result.each do |item|
221
- # # Each element is of type ::Google::Cloud::Dialogflow::CX::V3::EntityType.
222
- # p item
223
- # end
224
- #
225
- def list_entity_types request, options = nil
226
- raise ::ArgumentError, "request must be provided" if request.nil?
227
-
228
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest
229
-
230
- # Converts hash and nil to an options object
231
- options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
232
-
233
- # Customize the options with defaults
234
- call_metadata = @config.rpcs.list_entity_types.metadata.to_h
235
-
236
- # Set x-goog-api-client and x-goog-user-project headers
237
- call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
238
- lib_name: @config.lib_name, lib_version: @config.lib_version,
239
- gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
240
- transports_version_send: [:rest]
241
-
242
- call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
243
-
244
- options.apply_defaults timeout: @config.rpcs.list_entity_types.timeout,
245
- metadata: call_metadata,
246
- retry_policy: @config.rpcs.list_entity_types.retry_policy
247
-
248
- options.apply_defaults timeout: @config.timeout,
249
- metadata: @config.metadata,
250
- retry_policy: @config.retry_policy
251
-
252
- @entity_types_stub.list_entity_types request, options do |result, operation|
253
- result = ::Gapic::Rest::PagedEnumerable.new @entity_types_stub, :list_entity_types, "entity_types", request, result, options
254
- yield result, operation if block_given?
255
- return result
256
- end
257
- rescue ::Gapic::Rest::Error => e
258
- raise ::Google::Cloud::Error.from_error(e)
259
- end
260
-
261
178
  ##
262
179
  # Retrieves the specified entity type.
263
180
  #
@@ -641,6 +558,108 @@ module Google
641
558
  raise ::Google::Cloud::Error.from_error(e)
642
559
  end
643
560
 
561
+ ##
562
+ # Returns the list of all entity types in the specified agent.
563
+ #
564
+ # @overload list_entity_types(request, options = nil)
565
+ # Pass arguments to `list_entity_types` via a request object, either of type
566
+ # {::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest} or an equivalent Hash.
567
+ #
568
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest, ::Hash]
569
+ # A request object representing the call parameters. Required. To specify no
570
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
571
+ # @param options [::Gapic::CallOptions, ::Hash]
572
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
573
+ #
574
+ # @overload list_entity_types(parent: nil, language_code: nil, page_size: nil, page_token: nil)
575
+ # Pass arguments to `list_entity_types` via keyword arguments. Note that at
576
+ # least one keyword argument is required. To specify no parameters, or to keep all
577
+ # the default parameter values, pass an empty Hash as a request object (see above).
578
+ #
579
+ # @param parent [::String]
580
+ # Required. The agent to list all entity types for.
581
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
582
+ # @param language_code [::String]
583
+ # The language to list entity types for. The following fields are language
584
+ # dependent:
585
+ #
586
+ # * `EntityType.entities.value`
587
+ # * `EntityType.entities.synonyms`
588
+ # * `EntityType.excluded_phrases.value`
589
+ #
590
+ # If not specified, the agent's default language is used.
591
+ # [Many
592
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
593
+ # are supported.
594
+ # Note: languages must be enabled in the agent before they can be used.
595
+ # @param page_size [::Integer]
596
+ # The maximum number of items to return in a single page. By default 100 and
597
+ # at most 1000.
598
+ # @param page_token [::String]
599
+ # The next_page_token value returned from a previous list request.
600
+ # @yield [result, operation] Access the result along with the TransportOperation object
601
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::EntityType>]
602
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
603
+ #
604
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::EntityType>]
605
+ #
606
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
607
+ #
608
+ # @example Basic example
609
+ # require "google/cloud/dialogflow/cx/v3"
610
+ #
611
+ # # Create a client object. The client can be reused for multiple calls.
612
+ # client = Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client.new
613
+ #
614
+ # # Create a request. To set request fields, pass in keyword arguments.
615
+ # request = Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest.new
616
+ #
617
+ # # Call the list_entity_types method.
618
+ # result = client.list_entity_types request
619
+ #
620
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
621
+ # # over elements, and API calls will be issued to fetch pages as needed.
622
+ # result.each do |item|
623
+ # # Each element is of type ::Google::Cloud::Dialogflow::CX::V3::EntityType.
624
+ # p item
625
+ # end
626
+ #
627
+ def list_entity_types request, options = nil
628
+ raise ::ArgumentError, "request must be provided" if request.nil?
629
+
630
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest
631
+
632
+ # Converts hash and nil to an options object
633
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
634
+
635
+ # Customize the options with defaults
636
+ call_metadata = @config.rpcs.list_entity_types.metadata.to_h
637
+
638
+ # Set x-goog-api-client and x-goog-user-project headers
639
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
640
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
641
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
642
+ transports_version_send: [:rest]
643
+
644
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
645
+
646
+ options.apply_defaults timeout: @config.rpcs.list_entity_types.timeout,
647
+ metadata: call_metadata,
648
+ retry_policy: @config.rpcs.list_entity_types.retry_policy
649
+
650
+ options.apply_defaults timeout: @config.timeout,
651
+ metadata: @config.metadata,
652
+ retry_policy: @config.retry_policy
653
+
654
+ @entity_types_stub.list_entity_types request, options do |result, operation|
655
+ result = ::Gapic::Rest::PagedEnumerable.new @entity_types_stub, :list_entity_types, "entity_types", request, result, options
656
+ yield result, operation if block_given?
657
+ return result
658
+ end
659
+ rescue ::Gapic::Rest::Error => e
660
+ raise ::Google::Cloud::Error.from_error(e)
661
+ end
662
+
644
663
  ##
645
664
  # Configuration class for the EntityTypes REST API.
646
665
  #
@@ -657,23 +676,23 @@ module Google
657
676
  # @example
658
677
  #
659
678
  # # Modify the global config, setting the timeout for
660
- # # list_entity_types to 20 seconds,
679
+ # # get_entity_type to 20 seconds,
661
680
  # # and all remaining timeouts to 10 seconds.
662
681
  # ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client.configure do |config|
663
682
  # config.timeout = 10.0
664
- # config.rpcs.list_entity_types.timeout = 20.0
683
+ # config.rpcs.get_entity_type.timeout = 20.0
665
684
  # end
666
685
  #
667
686
  # # Apply the above configuration only to a new client.
668
687
  # client = ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client.new do |config|
669
688
  # config.timeout = 10.0
670
- # config.rpcs.list_entity_types.timeout = 20.0
689
+ # config.rpcs.get_entity_type.timeout = 20.0
671
690
  # end
672
691
  #
673
692
  # @!attribute [rw] endpoint
674
- # The hostname or hostname:port of the service endpoint.
675
- # Defaults to `"dialogflow.googleapis.com"`.
676
- # @return [::String]
693
+ # A custom service endpoint, as a hostname or hostname:port. The default is
694
+ # nil, indicating to use the default endpoint in the current universe domain.
695
+ # @return [::String,nil]
677
696
  # @!attribute [rw] credentials
678
697
  # Credentials to send with calls. You may provide any of the following types:
679
698
  # * (`String`) The path to a service account key file in JSON format
@@ -710,13 +729,20 @@ module Google
710
729
  # @!attribute [rw] quota_project
711
730
  # A separate project against which to charge quota.
712
731
  # @return [::String]
732
+ # @!attribute [rw] universe_domain
733
+ # The universe domain within which to make requests. This determines the
734
+ # default endpoint URL. The default value of nil uses the environment
735
+ # universe (usually the default "googleapis.com" universe).
736
+ # @return [::String,nil]
713
737
  #
714
738
  class Configuration
715
739
  extend ::Gapic::Config
716
740
 
741
+ # @private
742
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
717
743
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
718
744
 
719
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
745
+ config_attr :endpoint, nil, ::String, nil
720
746
  config_attr :credentials, nil do |value|
721
747
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
722
748
  allowed.any? { |klass| klass === value }
@@ -728,6 +754,7 @@ module Google
728
754
  config_attr :metadata, nil, ::Hash, nil
729
755
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
730
756
  config_attr :quota_project, nil, ::String, nil
757
+ config_attr :universe_domain, nil, ::String, nil
731
758
 
732
759
  # @private
733
760
  # Overrides for http bindings for the RPCs of this service
@@ -773,11 +800,6 @@ module Google
773
800
  # trigger a retry.
774
801
  #
775
802
  class Rpcs
776
- ##
777
- # RPC-specific configuration for `list_entity_types`
778
- # @return [::Gapic::Config::Method]
779
- #
780
- attr_reader :list_entity_types
781
803
  ##
782
804
  # RPC-specific configuration for `get_entity_type`
783
805
  # @return [::Gapic::Config::Method]
@@ -798,11 +820,14 @@ module Google
798
820
  # @return [::Gapic::Config::Method]
799
821
  #
800
822
  attr_reader :delete_entity_type
823
+ ##
824
+ # RPC-specific configuration for `list_entity_types`
825
+ # @return [::Gapic::Config::Method]
826
+ #
827
+ attr_reader :list_entity_types
801
828
 
802
829
  # @private
803
830
  def initialize parent_rpcs = nil
804
- list_entity_types_config = parent_rpcs.list_entity_types if parent_rpcs.respond_to? :list_entity_types
805
- @list_entity_types = ::Gapic::Config::Method.new list_entity_types_config
806
831
  get_entity_type_config = parent_rpcs.get_entity_type if parent_rpcs.respond_to? :get_entity_type
807
832
  @get_entity_type = ::Gapic::Config::Method.new get_entity_type_config
808
833
  create_entity_type_config = parent_rpcs.create_entity_type if parent_rpcs.respond_to? :create_entity_type
@@ -811,6 +836,8 @@ module Google
811
836
  @update_entity_type = ::Gapic::Config::Method.new update_entity_type_config
812
837
  delete_entity_type_config = parent_rpcs.delete_entity_type if parent_rpcs.respond_to? :delete_entity_type
813
838
  @delete_entity_type = ::Gapic::Config::Method.new delete_entity_type_config
839
+ list_entity_types_config = parent_rpcs.list_entity_types if parent_rpcs.respond_to? :list_entity_types
840
+ @list_entity_types = ::Gapic::Config::Method.new list_entity_types_config
814
841
 
815
842
  yield self if block_given?
816
843
  end
@@ -31,52 +31,26 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, credentials:
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
35
35
  # These require statements are intentionally placed here to initialize
36
36
  # the REST modules only when it's required.
37
37
  require "gapic/rest"
38
38
 
39
- @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
39
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
40
+ endpoint_template: endpoint_template,
41
+ universe_domain: universe_domain,
42
+ credentials: credentials,
40
43
  numeric_enums: true,
41
44
  raise_faraday_errors: false
42
45
  end
43
46
 
44
47
  ##
45
- # Baseline implementation for the list_entity_types REST call
48
+ # The effective universe domain
46
49
  #
47
- # @param request_pb [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest]
48
- # A request object representing the call parameters. Required.
49
- # @param options [::Gapic::CallOptions]
50
- # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
50
+ # @return [String]
51
51
  #
52
- # @yield [result, operation] Access the result along with the TransportOperation object
53
- # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesResponse]
54
- # @yieldparam operation [::Gapic::Rest::TransportOperation]
55
- #
56
- # @return [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesResponse]
57
- # A result object deserialized from the server's reply
58
- def list_entity_types request_pb, options = nil
59
- raise ::ArgumentError, "request must be provided" if request_pb.nil?
60
-
61
- verb, uri, query_string_params, body = ServiceStub.transcode_list_entity_types_request request_pb
62
- query_string_params = if query_string_params.any?
63
- query_string_params.to_h { |p| p.split "=", 2 }
64
- else
65
- {}
66
- end
67
-
68
- response = @client_stub.make_http_request(
69
- verb,
70
- uri: uri,
71
- body: body || "",
72
- params: query_string_params,
73
- options: options
74
- )
75
- operation = ::Gapic::Rest::TransportOperation.new response
76
- result = ::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesResponse.decode_json response.body, ignore_unknown_fields: true
77
-
78
- yield result, operation if block_given?
79
- result
52
+ def universe_domain
53
+ @client_stub.universe_domain
80
54
  end
81
55
 
82
56
  ##
@@ -232,24 +206,41 @@ module Google
232
206
  end
233
207
 
234
208
  ##
235
- # @private
236
- #
237
- # GRPC transcoding helper method for the list_entity_types REST call
209
+ # Baseline implementation for the list_entity_types REST call
238
210
  #
239
211
  # @param request_pb [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest]
240
212
  # A request object representing the call parameters. Required.
241
- # @return [Array(String, [String, nil], Hash{String => String})]
242
- # Uri, Body, Query string parameters
243
- def self.transcode_list_entity_types_request request_pb
244
- transcoder = Gapic::Rest::GrpcTranscoder.new
245
- .with_bindings(
246
- uri_method: :get,
247
- uri_template: "/v3/{parent}/entityTypes",
248
- matches: [
249
- ["parent", %r{^projects/[^/]+/locations/[^/]+/agents/[^/]+/?$}, false]
250
- ]
251
- )
252
- transcoder.transcode request_pb
213
+ # @param options [::Gapic::CallOptions]
214
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
215
+ #
216
+ # @yield [result, operation] Access the result along with the TransportOperation object
217
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesResponse]
218
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
219
+ #
220
+ # @return [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesResponse]
221
+ # A result object deserialized from the server's reply
222
+ def list_entity_types request_pb, options = nil
223
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
224
+
225
+ verb, uri, query_string_params, body = ServiceStub.transcode_list_entity_types_request request_pb
226
+ query_string_params = if query_string_params.any?
227
+ query_string_params.to_h { |p| p.split "=", 2 }
228
+ else
229
+ {}
230
+ end
231
+
232
+ response = @client_stub.make_http_request(
233
+ verb,
234
+ uri: uri,
235
+ body: body || "",
236
+ params: query_string_params,
237
+ options: options
238
+ )
239
+ operation = ::Gapic::Rest::TransportOperation.new response
240
+ result = ::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesResponse.decode_json response.body, ignore_unknown_fields: true
241
+
242
+ yield result, operation if block_given?
243
+ result
253
244
  end
254
245
 
255
246
  ##
@@ -337,6 +328,27 @@ module Google
337
328
  )
338
329
  transcoder.transcode request_pb
339
330
  end
331
+
332
+ ##
333
+ # @private
334
+ #
335
+ # GRPC transcoding helper method for the list_entity_types REST call
336
+ #
337
+ # @param request_pb [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest]
338
+ # A request object representing the call parameters. Required.
339
+ # @return [Array(String, [String, nil], Hash{String => String})]
340
+ # Uri, Body, Query string parameters
341
+ def self.transcode_list_entity_types_request request_pb
342
+ transcoder = Gapic::Rest::GrpcTranscoder.new
343
+ .with_bindings(
344
+ uri_method: :get,
345
+ uri_template: "/v3/{parent}/entityTypes",
346
+ matches: [
347
+ ["parent", %r{^projects/[^/]+/locations/[^/]+/agents/[^/]+/?$}, false]
348
+ ]
349
+ )
350
+ transcoder.transcode request_pb
351
+ end
340
352
  end
341
353
  end
342
354
  end
@@ -33,6 +33,9 @@ module Google
33
33
  # {::Google::Cloud::Dialogflow::CX::V3::Environment Environments}.
34
34
  #
35
35
  class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$UNIVERSE_DOMAIN$"
38
+
36
39
  include Paths
37
40
 
38
41
  # @private
@@ -98,6 +101,15 @@ module Google
98
101
  @config
99
102
  end
100
103
 
104
+ ##
105
+ # The effective universe domain
106
+ #
107
+ # @return [String]
108
+ #
109
+ def universe_domain
110
+ @environments_stub.universe_domain
111
+ end
112
+
101
113
  ##
102
114
  # Create a new Environments client object.
103
115
  #
@@ -131,8 +143,9 @@ module Google
131
143
  credentials = @config.credentials
132
144
  # Use self-signed JWT if the endpoint is unchanged from default,
133
145
  # but only if the default endpoint does not have a region prefix.
134
- enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
135
- !@config.endpoint.split(".").first.include?("-")
146
+ enable_self_signed_jwt = @config.endpoint.nil? ||
147
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
148
+ !@config.endpoint.split(".").first.include?("-"))
136
149
  credentials ||= Credentials.default scope: @config.scope,
137
150
  enable_self_signed_jwt: enable_self_signed_jwt
138
151
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -145,18 +158,22 @@ module Google
145
158
  config.credentials = credentials
146
159
  config.quota_project = @quota_project_id
147
160
  config.endpoint = @config.endpoint
161
+ config.universe_domain = @config.universe_domain
148
162
  end
149
163
 
150
164
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
151
165
  config.credentials = credentials
152
166
  config.quota_project = @quota_project_id
153
167
  config.endpoint = @config.endpoint
168
+ config.universe_domain = @config.universe_domain
154
169
  end
155
170
 
156
171
  @environments_stub = ::Gapic::ServiceStub.new(
157
172
  ::Google::Cloud::Dialogflow::CX::V3::Environments::Stub,
158
- credentials: credentials,
159
- endpoint: @config.endpoint,
173
+ credentials: credentials,
174
+ endpoint: @config.endpoint,
175
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
176
+ universe_domain: @config.universe_domain,
160
177
  channel_args: @config.channel_args,
161
178
  interceptors: @config.interceptors,
162
179
  channel_pool_config: @config.channel_pool
@@ -1103,9 +1120,9 @@ module Google
1103
1120
  # end
1104
1121
  #
1105
1122
  # @!attribute [rw] endpoint
1106
- # The hostname or hostname:port of the service endpoint.
1107
- # Defaults to `"dialogflow.googleapis.com"`.
1108
- # @return [::String]
1123
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1124
+ # nil, indicating to use the default endpoint in the current universe domain.
1125
+ # @return [::String,nil]
1109
1126
  # @!attribute [rw] credentials
1110
1127
  # Credentials to send with calls. You may provide any of the following types:
1111
1128
  # * (`String`) The path to a service account key file in JSON format
@@ -1151,13 +1168,20 @@ module Google
1151
1168
  # @!attribute [rw] quota_project
1152
1169
  # A separate project against which to charge quota.
1153
1170
  # @return [::String]
1171
+ # @!attribute [rw] universe_domain
1172
+ # The universe domain within which to make requests. This determines the
1173
+ # default endpoint URL. The default value of nil uses the environment
1174
+ # universe (usually the default "googleapis.com" universe).
1175
+ # @return [::String,nil]
1154
1176
  #
1155
1177
  class Configuration
1156
1178
  extend ::Gapic::Config
1157
1179
 
1180
+ # @private
1181
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1158
1182
  DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
1159
1183
 
1160
- config_attr :endpoint, DEFAULT_ENDPOINT, ::String
1184
+ config_attr :endpoint, nil, ::String, nil
1161
1185
  config_attr :credentials, nil do |value|
1162
1186
  allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1163
1187
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
@@ -1172,6 +1196,7 @@ module Google
1172
1196
  config_attr :metadata, nil, ::Hash, nil
1173
1197
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1174
1198
  config_attr :quota_project, nil, ::String, nil
1199
+ config_attr :universe_domain, nil, ::String, nil
1175
1200
 
1176
1201
  # @private
1177
1202
  def initialize parent_config = nil