• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.google.cloud.dialogflow.v2beta1;
18 
19 import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListLocationsPagedResponse;
20 import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListParticipantsPagedResponse;
21 import static com.google.cloud.dialogflow.v2beta1.ParticipantsClient.ListSuggestionsPagedResponse;
22 
23 import com.google.api.core.ApiFunction;
24 import com.google.api.core.BetaApi;
25 import com.google.api.gax.core.GoogleCredentialsProvider;
26 import com.google.api.gax.core.InstantiatingExecutorProvider;
27 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
28 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
29 import com.google.api.gax.rpc.ApiClientHeaderProvider;
30 import com.google.api.gax.rpc.ClientContext;
31 import com.google.api.gax.rpc.ClientSettings;
32 import com.google.api.gax.rpc.PagedCallSettings;
33 import com.google.api.gax.rpc.StreamingCallSettings;
34 import com.google.api.gax.rpc.TransportChannelProvider;
35 import com.google.api.gax.rpc.UnaryCallSettings;
36 import com.google.cloud.dialogflow.v2beta1.stub.ParticipantsStubSettings;
37 import com.google.cloud.location.GetLocationRequest;
38 import com.google.cloud.location.ListLocationsRequest;
39 import com.google.cloud.location.ListLocationsResponse;
40 import com.google.cloud.location.Location;
41 import java.io.IOException;
42 import java.util.List;
43 import javax.annotation.Generated;
44 
45 // AUTO-GENERATED DOCUMENTATION AND CLASS.
46 /**
47  * Settings class to configure an instance of {@link ParticipantsClient}.
48  *
49  * <p>The default instance has everything set to sensible defaults:
50  *
51  * <ul>
52  *   <li>The default service address (dialogflow.googleapis.com) and default port (443) are used.
53  *   <li>Credentials are acquired automatically through Application Default Credentials.
54  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
55  * </ul>
56  *
57  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
58  * build() is called, the tree of builders is called to create the complete settings object.
59  *
60  * <p>For example, to set the total timeout of createParticipant to 30 seconds:
61  *
62  * <pre>{@code
63  * // This snippet has been automatically generated and should be regarded as a code template only.
64  * // It will require modifications to work:
65  * // - It may require correct/in-range values for request initialization.
66  * // - It may require specifying regional endpoints when creating the service client as shown in
67  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
68  * ParticipantsSettings.Builder participantsSettingsBuilder = ParticipantsSettings.newBuilder();
69  * participantsSettingsBuilder
70  *     .createParticipantSettings()
71  *     .setRetrySettings(
72  *         participantsSettingsBuilder
73  *             .createParticipantSettings()
74  *             .getRetrySettings()
75  *             .toBuilder()
76  *             .setTotalTimeout(Duration.ofSeconds(30))
77  *             .build());
78  * ParticipantsSettings participantsSettings = participantsSettingsBuilder.build();
79  * }</pre>
80  */
81 @BetaApi
82 @Generated("by gapic-generator-java")
83 public class ParticipantsSettings extends ClientSettings<ParticipantsSettings> {
84 
85   /** Returns the object with the settings used for calls to createParticipant. */
createParticipantSettings()86   public UnaryCallSettings<CreateParticipantRequest, Participant> createParticipantSettings() {
87     return ((ParticipantsStubSettings) getStubSettings()).createParticipantSettings();
88   }
89 
90   /** Returns the object with the settings used for calls to getParticipant. */
getParticipantSettings()91   public UnaryCallSettings<GetParticipantRequest, Participant> getParticipantSettings() {
92     return ((ParticipantsStubSettings) getStubSettings()).getParticipantSettings();
93   }
94 
95   /** Returns the object with the settings used for calls to listParticipants. */
96   public PagedCallSettings<
97           ListParticipantsRequest, ListParticipantsResponse, ListParticipantsPagedResponse>
listParticipantsSettings()98       listParticipantsSettings() {
99     return ((ParticipantsStubSettings) getStubSettings()).listParticipantsSettings();
100   }
101 
102   /** Returns the object with the settings used for calls to updateParticipant. */
updateParticipantSettings()103   public UnaryCallSettings<UpdateParticipantRequest, Participant> updateParticipantSettings() {
104     return ((ParticipantsStubSettings) getStubSettings()).updateParticipantSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to analyzeContent. */
analyzeContentSettings()108   public UnaryCallSettings<AnalyzeContentRequest, AnalyzeContentResponse> analyzeContentSettings() {
109     return ((ParticipantsStubSettings) getStubSettings()).analyzeContentSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to streamingAnalyzeContent. */
113   public StreamingCallSettings<StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse>
streamingAnalyzeContentSettings()114       streamingAnalyzeContentSettings() {
115     return ((ParticipantsStubSettings) getStubSettings()).streamingAnalyzeContentSettings();
116   }
117 
118   /** Returns the object with the settings used for calls to suggestArticles. */
119   public UnaryCallSettings<SuggestArticlesRequest, SuggestArticlesResponse>
suggestArticlesSettings()120       suggestArticlesSettings() {
121     return ((ParticipantsStubSettings) getStubSettings()).suggestArticlesSettings();
122   }
123 
124   /** Returns the object with the settings used for calls to suggestFaqAnswers. */
125   public UnaryCallSettings<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse>
suggestFaqAnswersSettings()126       suggestFaqAnswersSettings() {
127     return ((ParticipantsStubSettings) getStubSettings()).suggestFaqAnswersSettings();
128   }
129 
130   /** Returns the object with the settings used for calls to suggestSmartReplies. */
131   public UnaryCallSettings<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse>
suggestSmartRepliesSettings()132       suggestSmartRepliesSettings() {
133     return ((ParticipantsStubSettings) getStubSettings()).suggestSmartRepliesSettings();
134   }
135 
136   /**
137    * Returns the object with the settings used for calls to listSuggestions.
138    *
139    * @deprecated This method is deprecated and will be removed in the next major version update.
140    */
141   @Deprecated
142   public PagedCallSettings<
143           ListSuggestionsRequest, ListSuggestionsResponse, ListSuggestionsPagedResponse>
listSuggestionsSettings()144       listSuggestionsSettings() {
145     return ((ParticipantsStubSettings) getStubSettings()).listSuggestionsSettings();
146   }
147 
148   /**
149    * Returns the object with the settings used for calls to compileSuggestion.
150    *
151    * @deprecated This method is deprecated and will be removed in the next major version update.
152    */
153   @Deprecated
154   public UnaryCallSettings<CompileSuggestionRequest, CompileSuggestionResponse>
compileSuggestionSettings()155       compileSuggestionSettings() {
156     return ((ParticipantsStubSettings) getStubSettings()).compileSuggestionSettings();
157   }
158 
159   /** Returns the object with the settings used for calls to listLocations. */
160   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()161       listLocationsSettings() {
162     return ((ParticipantsStubSettings) getStubSettings()).listLocationsSettings();
163   }
164 
165   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()166   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
167     return ((ParticipantsStubSettings) getStubSettings()).getLocationSettings();
168   }
169 
create(ParticipantsStubSettings stub)170   public static final ParticipantsSettings create(ParticipantsStubSettings stub)
171       throws IOException {
172     return new ParticipantsSettings.Builder(stub.toBuilder()).build();
173   }
174 
175   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()176   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
177     return ParticipantsStubSettings.defaultExecutorProviderBuilder();
178   }
179 
180   /** Returns the default service endpoint. */
getDefaultEndpoint()181   public static String getDefaultEndpoint() {
182     return ParticipantsStubSettings.getDefaultEndpoint();
183   }
184 
185   /** Returns the default service scopes. */
getDefaultServiceScopes()186   public static List<String> getDefaultServiceScopes() {
187     return ParticipantsStubSettings.getDefaultServiceScopes();
188   }
189 
190   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()191   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
192     return ParticipantsStubSettings.defaultCredentialsProviderBuilder();
193   }
194 
195   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()196   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
197     return ParticipantsStubSettings.defaultGrpcTransportProviderBuilder();
198   }
199 
200   /** Returns a builder for the default REST ChannelProvider for this service. */
201   @BetaApi
202   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()203       defaultHttpJsonTransportProviderBuilder() {
204     return ParticipantsStubSettings.defaultHttpJsonTransportProviderBuilder();
205   }
206 
defaultTransportChannelProvider()207   public static TransportChannelProvider defaultTransportChannelProvider() {
208     return ParticipantsStubSettings.defaultTransportChannelProvider();
209   }
210 
211   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()212   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
213     return ParticipantsStubSettings.defaultApiClientHeaderProviderBuilder();
214   }
215 
216   /** Returns a new gRPC builder for this class. */
newBuilder()217   public static Builder newBuilder() {
218     return Builder.createDefault();
219   }
220 
221   /** Returns a new REST builder for this class. */
222   @BetaApi
newHttpJsonBuilder()223   public static Builder newHttpJsonBuilder() {
224     return Builder.createHttpJsonDefault();
225   }
226 
227   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)228   public static Builder newBuilder(ClientContext clientContext) {
229     return new Builder(clientContext);
230   }
231 
232   /** Returns a builder containing all the values of this settings class. */
toBuilder()233   public Builder toBuilder() {
234     return new Builder(this);
235   }
236 
ParticipantsSettings(Builder settingsBuilder)237   protected ParticipantsSettings(Builder settingsBuilder) throws IOException {
238     super(settingsBuilder);
239   }
240 
241   /** Builder for ParticipantsSettings. */
242   public static class Builder extends ClientSettings.Builder<ParticipantsSettings, Builder> {
243 
Builder()244     protected Builder() throws IOException {
245       this(((ClientContext) null));
246     }
247 
Builder(ClientContext clientContext)248     protected Builder(ClientContext clientContext) {
249       super(ParticipantsStubSettings.newBuilder(clientContext));
250     }
251 
Builder(ParticipantsSettings settings)252     protected Builder(ParticipantsSettings settings) {
253       super(settings.getStubSettings().toBuilder());
254     }
255 
Builder(ParticipantsStubSettings.Builder stubSettings)256     protected Builder(ParticipantsStubSettings.Builder stubSettings) {
257       super(stubSettings);
258     }
259 
createDefault()260     private static Builder createDefault() {
261       return new Builder(ParticipantsStubSettings.newBuilder());
262     }
263 
264     @BetaApi
createHttpJsonDefault()265     private static Builder createHttpJsonDefault() {
266       return new Builder(ParticipantsStubSettings.newHttpJsonBuilder());
267     }
268 
getStubSettingsBuilder()269     public ParticipantsStubSettings.Builder getStubSettingsBuilder() {
270       return ((ParticipantsStubSettings.Builder) getStubSettings());
271     }
272 
273     /**
274      * Applies the given settings updater function to all of the unary API methods in this service.
275      *
276      * <p>Note: This method does not support applying settings to streaming methods.
277      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)278     public Builder applyToAllUnaryMethods(
279         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
280       super.applyToAllUnaryMethods(
281           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
282       return this;
283     }
284 
285     /** Returns the builder for the settings used for calls to createParticipant. */
286     public UnaryCallSettings.Builder<CreateParticipantRequest, Participant>
createParticipantSettings()287         createParticipantSettings() {
288       return getStubSettingsBuilder().createParticipantSettings();
289     }
290 
291     /** Returns the builder for the settings used for calls to getParticipant. */
getParticipantSettings()292     public UnaryCallSettings.Builder<GetParticipantRequest, Participant> getParticipantSettings() {
293       return getStubSettingsBuilder().getParticipantSettings();
294     }
295 
296     /** Returns the builder for the settings used for calls to listParticipants. */
297     public PagedCallSettings.Builder<
298             ListParticipantsRequest, ListParticipantsResponse, ListParticipantsPagedResponse>
listParticipantsSettings()299         listParticipantsSettings() {
300       return getStubSettingsBuilder().listParticipantsSettings();
301     }
302 
303     /** Returns the builder for the settings used for calls to updateParticipant. */
304     public UnaryCallSettings.Builder<UpdateParticipantRequest, Participant>
updateParticipantSettings()305         updateParticipantSettings() {
306       return getStubSettingsBuilder().updateParticipantSettings();
307     }
308 
309     /** Returns the builder for the settings used for calls to analyzeContent. */
310     public UnaryCallSettings.Builder<AnalyzeContentRequest, AnalyzeContentResponse>
analyzeContentSettings()311         analyzeContentSettings() {
312       return getStubSettingsBuilder().analyzeContentSettings();
313     }
314 
315     /** Returns the builder for the settings used for calls to streamingAnalyzeContent. */
316     public StreamingCallSettings.Builder<
317             StreamingAnalyzeContentRequest, StreamingAnalyzeContentResponse>
streamingAnalyzeContentSettings()318         streamingAnalyzeContentSettings() {
319       return getStubSettingsBuilder().streamingAnalyzeContentSettings();
320     }
321 
322     /** Returns the builder for the settings used for calls to suggestArticles. */
323     public UnaryCallSettings.Builder<SuggestArticlesRequest, SuggestArticlesResponse>
suggestArticlesSettings()324         suggestArticlesSettings() {
325       return getStubSettingsBuilder().suggestArticlesSettings();
326     }
327 
328     /** Returns the builder for the settings used for calls to suggestFaqAnswers. */
329     public UnaryCallSettings.Builder<SuggestFaqAnswersRequest, SuggestFaqAnswersResponse>
suggestFaqAnswersSettings()330         suggestFaqAnswersSettings() {
331       return getStubSettingsBuilder().suggestFaqAnswersSettings();
332     }
333 
334     /** Returns the builder for the settings used for calls to suggestSmartReplies. */
335     public UnaryCallSettings.Builder<SuggestSmartRepliesRequest, SuggestSmartRepliesResponse>
suggestSmartRepliesSettings()336         suggestSmartRepliesSettings() {
337       return getStubSettingsBuilder().suggestSmartRepliesSettings();
338     }
339 
340     /**
341      * Returns the builder for the settings used for calls to listSuggestions.
342      *
343      * @deprecated This method is deprecated and will be removed in the next major version update.
344      */
345     @Deprecated
346     public PagedCallSettings.Builder<
347             ListSuggestionsRequest, ListSuggestionsResponse, ListSuggestionsPagedResponse>
listSuggestionsSettings()348         listSuggestionsSettings() {
349       return getStubSettingsBuilder().listSuggestionsSettings();
350     }
351 
352     /**
353      * Returns the builder for the settings used for calls to compileSuggestion.
354      *
355      * @deprecated This method is deprecated and will be removed in the next major version update.
356      */
357     @Deprecated
358     public UnaryCallSettings.Builder<CompileSuggestionRequest, CompileSuggestionResponse>
compileSuggestionSettings()359         compileSuggestionSettings() {
360       return getStubSettingsBuilder().compileSuggestionSettings();
361     }
362 
363     /** Returns the builder for the settings used for calls to listLocations. */
364     public PagedCallSettings.Builder<
365             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()366         listLocationsSettings() {
367       return getStubSettingsBuilder().listLocationsSettings();
368     }
369 
370     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()371     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
372       return getStubSettingsBuilder().getLocationSettings();
373     }
374 
375     @Override
build()376     public ParticipantsSettings build() throws IOException {
377       return new ParticipantsSettings(this);
378     }
379   }
380 }
381