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.IntentsClient.ListIntentsPagedResponse; 20 import static com.google.cloud.dialogflow.v2beta1.IntentsClient.ListLocationsPagedResponse; 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.OperationCallSettings; 32 import com.google.api.gax.rpc.PagedCallSettings; 33 import com.google.api.gax.rpc.TransportChannelProvider; 34 import com.google.api.gax.rpc.UnaryCallSettings; 35 import com.google.cloud.dialogflow.v2beta1.stub.IntentsStubSettings; 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 com.google.longrunning.Operation; 41 import com.google.protobuf.Empty; 42 import com.google.protobuf.Struct; 43 import java.io.IOException; 44 import java.util.List; 45 import javax.annotation.Generated; 46 47 // AUTO-GENERATED DOCUMENTATION AND CLASS. 48 /** 49 * Settings class to configure an instance of {@link IntentsClient}. 50 * 51 * <p>The default instance has everything set to sensible defaults: 52 * 53 * <ul> 54 * <li>The default service address (dialogflow.googleapis.com) and default port (443) are used. 55 * <li>Credentials are acquired automatically through Application Default Credentials. 56 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 57 * </ul> 58 * 59 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 60 * build() is called, the tree of builders is called to create the complete settings object. 61 * 62 * <p>For example, to set the total timeout of getIntent to 30 seconds: 63 * 64 * <pre>{@code 65 * // This snippet has been automatically generated and should be regarded as a code template only. 66 * // It will require modifications to work: 67 * // - It may require correct/in-range values for request initialization. 68 * // - It may require specifying regional endpoints when creating the service client as shown in 69 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 70 * IntentsSettings.Builder intentsSettingsBuilder = IntentsSettings.newBuilder(); 71 * intentsSettingsBuilder 72 * .getIntentSettings() 73 * .setRetrySettings( 74 * intentsSettingsBuilder 75 * .getIntentSettings() 76 * .getRetrySettings() 77 * .toBuilder() 78 * .setTotalTimeout(Duration.ofSeconds(30)) 79 * .build()); 80 * IntentsSettings intentsSettings = intentsSettingsBuilder.build(); 81 * }</pre> 82 */ 83 @BetaApi 84 @Generated("by gapic-generator-java") 85 public class IntentsSettings extends ClientSettings<IntentsSettings> { 86 87 /** Returns the object with the settings used for calls to listIntents. */ 88 public PagedCallSettings<ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> listIntentsSettings()89 listIntentsSettings() { 90 return ((IntentsStubSettings) getStubSettings()).listIntentsSettings(); 91 } 92 93 /** Returns the object with the settings used for calls to getIntent. */ getIntentSettings()94 public UnaryCallSettings<GetIntentRequest, Intent> getIntentSettings() { 95 return ((IntentsStubSettings) getStubSettings()).getIntentSettings(); 96 } 97 98 /** Returns the object with the settings used for calls to createIntent. */ createIntentSettings()99 public UnaryCallSettings<CreateIntentRequest, Intent> createIntentSettings() { 100 return ((IntentsStubSettings) getStubSettings()).createIntentSettings(); 101 } 102 103 /** Returns the object with the settings used for calls to updateIntent. */ updateIntentSettings()104 public UnaryCallSettings<UpdateIntentRequest, Intent> updateIntentSettings() { 105 return ((IntentsStubSettings) getStubSettings()).updateIntentSettings(); 106 } 107 108 /** Returns the object with the settings used for calls to deleteIntent. */ deleteIntentSettings()109 public UnaryCallSettings<DeleteIntentRequest, Empty> deleteIntentSettings() { 110 return ((IntentsStubSettings) getStubSettings()).deleteIntentSettings(); 111 } 112 113 /** Returns the object with the settings used for calls to batchUpdateIntents. */ batchUpdateIntentsSettings()114 public UnaryCallSettings<BatchUpdateIntentsRequest, Operation> batchUpdateIntentsSettings() { 115 return ((IntentsStubSettings) getStubSettings()).batchUpdateIntentsSettings(); 116 } 117 118 /** Returns the object with the settings used for calls to batchUpdateIntents. */ 119 public OperationCallSettings<BatchUpdateIntentsRequest, BatchUpdateIntentsResponse, Struct> batchUpdateIntentsOperationSettings()120 batchUpdateIntentsOperationSettings() { 121 return ((IntentsStubSettings) getStubSettings()).batchUpdateIntentsOperationSettings(); 122 } 123 124 /** Returns the object with the settings used for calls to batchDeleteIntents. */ batchDeleteIntentsSettings()125 public UnaryCallSettings<BatchDeleteIntentsRequest, Operation> batchDeleteIntentsSettings() { 126 return ((IntentsStubSettings) getStubSettings()).batchDeleteIntentsSettings(); 127 } 128 129 /** Returns the object with the settings used for calls to batchDeleteIntents. */ 130 public OperationCallSettings<BatchDeleteIntentsRequest, Empty, Struct> batchDeleteIntentsOperationSettings()131 batchDeleteIntentsOperationSettings() { 132 return ((IntentsStubSettings) getStubSettings()).batchDeleteIntentsOperationSettings(); 133 } 134 135 /** Returns the object with the settings used for calls to listLocations. */ 136 public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()137 listLocationsSettings() { 138 return ((IntentsStubSettings) getStubSettings()).listLocationsSettings(); 139 } 140 141 /** Returns the object with the settings used for calls to getLocation. */ getLocationSettings()142 public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() { 143 return ((IntentsStubSettings) getStubSettings()).getLocationSettings(); 144 } 145 create(IntentsStubSettings stub)146 public static final IntentsSettings create(IntentsStubSettings stub) throws IOException { 147 return new IntentsSettings.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 IntentsStubSettings.defaultExecutorProviderBuilder(); 153 } 154 155 /** Returns the default service endpoint. */ getDefaultEndpoint()156 public static String getDefaultEndpoint() { 157 return IntentsStubSettings.getDefaultEndpoint(); 158 } 159 160 /** Returns the default service scopes. */ getDefaultServiceScopes()161 public static List<String> getDefaultServiceScopes() { 162 return IntentsStubSettings.getDefaultServiceScopes(); 163 } 164 165 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()166 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 167 return IntentsStubSettings.defaultCredentialsProviderBuilder(); 168 } 169 170 /** Returns a builder for the default gRPC ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()171 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 172 return IntentsStubSettings.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 IntentsStubSettings.defaultHttpJsonTransportProviderBuilder(); 180 } 181 defaultTransportChannelProvider()182 public static TransportChannelProvider defaultTransportChannelProvider() { 183 return IntentsStubSettings.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 IntentsStubSettings.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 IntentsSettings(Builder settingsBuilder)212 protected IntentsSettings(Builder settingsBuilder) throws IOException { 213 super(settingsBuilder); 214 } 215 216 /** Builder for IntentsSettings. */ 217 public static class Builder extends ClientSettings.Builder<IntentsSettings, Builder> { 218 Builder()219 protected Builder() throws IOException { 220 this(((ClientContext) null)); 221 } 222 Builder(ClientContext clientContext)223 protected Builder(ClientContext clientContext) { 224 super(IntentsStubSettings.newBuilder(clientContext)); 225 } 226 Builder(IntentsSettings settings)227 protected Builder(IntentsSettings settings) { 228 super(settings.getStubSettings().toBuilder()); 229 } 230 Builder(IntentsStubSettings.Builder stubSettings)231 protected Builder(IntentsStubSettings.Builder stubSettings) { 232 super(stubSettings); 233 } 234 createDefault()235 private static Builder createDefault() { 236 return new Builder(IntentsStubSettings.newBuilder()); 237 } 238 239 @BetaApi createHttpJsonDefault()240 private static Builder createHttpJsonDefault() { 241 return new Builder(IntentsStubSettings.newHttpJsonBuilder()); 242 } 243 getStubSettingsBuilder()244 public IntentsStubSettings.Builder getStubSettingsBuilder() { 245 return ((IntentsStubSettings.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 listIntents. */ 261 public PagedCallSettings.Builder< 262 ListIntentsRequest, ListIntentsResponse, ListIntentsPagedResponse> listIntentsSettings()263 listIntentsSettings() { 264 return getStubSettingsBuilder().listIntentsSettings(); 265 } 266 267 /** Returns the builder for the settings used for calls to getIntent. */ getIntentSettings()268 public UnaryCallSettings.Builder<GetIntentRequest, Intent> getIntentSettings() { 269 return getStubSettingsBuilder().getIntentSettings(); 270 } 271 272 /** Returns the builder for the settings used for calls to createIntent. */ createIntentSettings()273 public UnaryCallSettings.Builder<CreateIntentRequest, Intent> createIntentSettings() { 274 return getStubSettingsBuilder().createIntentSettings(); 275 } 276 277 /** Returns the builder for the settings used for calls to updateIntent. */ updateIntentSettings()278 public UnaryCallSettings.Builder<UpdateIntentRequest, Intent> updateIntentSettings() { 279 return getStubSettingsBuilder().updateIntentSettings(); 280 } 281 282 /** Returns the builder for the settings used for calls to deleteIntent. */ deleteIntentSettings()283 public UnaryCallSettings.Builder<DeleteIntentRequest, Empty> deleteIntentSettings() { 284 return getStubSettingsBuilder().deleteIntentSettings(); 285 } 286 287 /** Returns the builder for the settings used for calls to batchUpdateIntents. */ 288 public UnaryCallSettings.Builder<BatchUpdateIntentsRequest, Operation> batchUpdateIntentsSettings()289 batchUpdateIntentsSettings() { 290 return getStubSettingsBuilder().batchUpdateIntentsSettings(); 291 } 292 293 /** Returns the builder for the settings used for calls to batchUpdateIntents. */ 294 public OperationCallSettings.Builder< 295 BatchUpdateIntentsRequest, BatchUpdateIntentsResponse, Struct> batchUpdateIntentsOperationSettings()296 batchUpdateIntentsOperationSettings() { 297 return getStubSettingsBuilder().batchUpdateIntentsOperationSettings(); 298 } 299 300 /** Returns the builder for the settings used for calls to batchDeleteIntents. */ 301 public UnaryCallSettings.Builder<BatchDeleteIntentsRequest, Operation> batchDeleteIntentsSettings()302 batchDeleteIntentsSettings() { 303 return getStubSettingsBuilder().batchDeleteIntentsSettings(); 304 } 305 306 /** Returns the builder for the settings used for calls to batchDeleteIntents. */ 307 public OperationCallSettings.Builder<BatchDeleteIntentsRequest, Empty, Struct> batchDeleteIntentsOperationSettings()308 batchDeleteIntentsOperationSettings() { 309 return getStubSettingsBuilder().batchDeleteIntentsOperationSettings(); 310 } 311 312 /** Returns the builder for the settings used for calls to listLocations. */ 313 public PagedCallSettings.Builder< 314 ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()315 listLocationsSettings() { 316 return getStubSettingsBuilder().listLocationsSettings(); 317 } 318 319 /** Returns the builder for the settings used for calls to getLocation. */ getLocationSettings()320 public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { 321 return getStubSettingsBuilder().getLocationSettings(); 322 } 323 324 @Override build()325 public IntentsSettings build() throws IOException { 326 return new IntentsSettings(this); 327 } 328 } 329 } 330