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