|  | 
|  | 1 | +/* | 
|  | 2 | + * Copyright 2021 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.AnswerRecordsClient.ListAnswerRecordsPagedResponse; | 
|  | 20 | + | 
|  | 21 | +import com.google.api.core.ApiFunction; | 
|  | 22 | +import com.google.api.core.BetaApi; | 
|  | 23 | +import com.google.api.gax.core.GoogleCredentialsProvider; | 
|  | 24 | +import com.google.api.gax.core.InstantiatingExecutorProvider; | 
|  | 25 | +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; | 
|  | 26 | +import com.google.api.gax.rpc.ApiClientHeaderProvider; | 
|  | 27 | +import com.google.api.gax.rpc.ClientContext; | 
|  | 28 | +import com.google.api.gax.rpc.ClientSettings; | 
|  | 29 | +import com.google.api.gax.rpc.PagedCallSettings; | 
|  | 30 | +import com.google.api.gax.rpc.TransportChannelProvider; | 
|  | 31 | +import com.google.api.gax.rpc.UnaryCallSettings; | 
|  | 32 | +import com.google.cloud.dialogflow.v2.stub.AnswerRecordsStubSettings; | 
|  | 33 | +import java.io.IOException; | 
|  | 34 | +import java.util.List; | 
|  | 35 | +import javax.annotation.Generated; | 
|  | 36 | + | 
|  | 37 | +// AUTO-GENERATED DOCUMENTATION AND CLASS. | 
|  | 38 | +/** | 
|  | 39 | + * Settings class to configure an instance of {@link AnswerRecordsClient}. | 
|  | 40 | + * | 
|  | 41 | + * <p>The default instance has everything set to sensible defaults: | 
|  | 42 | + * | 
|  | 43 | + * <ul> | 
|  | 44 | + * <li>The default service address (dialogflow.googleapis.com) and default port (443) are used. | 
|  | 45 | + * <li>Credentials are acquired automatically through Application Default Credentials. | 
|  | 46 | + * <li>Retries are configured for idempotent methods but not for non-idempotent methods. | 
|  | 47 | + * </ul> | 
|  | 48 | + * | 
|  | 49 | + * <p>The builder of this class is recursive, so contained classes are themselves builders. When | 
|  | 50 | + * build() is called, the tree of builders is called to create the complete settings object. | 
|  | 51 | + * | 
|  | 52 | + * <p>For example, to set the total timeout of updateAnswerRecord to 30 seconds: | 
|  | 53 | + * | 
|  | 54 | + * <pre>{@code | 
|  | 55 | + * AnswerRecordsSettings.Builder answerRecordsSettingsBuilder = AnswerRecordsSettings.newBuilder(); | 
|  | 56 | + * answerRecordsSettingsBuilder | 
|  | 57 | + * .updateAnswerRecordSettings() | 
|  | 58 | + * .setRetrySettings( | 
|  | 59 | + * answerRecordsSettingsBuilder | 
|  | 60 | + * .updateAnswerRecordSettings() | 
|  | 61 | + * .getRetrySettings() | 
|  | 62 | + * .toBuilder() | 
|  | 63 | + * .setTotalTimeout(Duration.ofSeconds(30)) | 
|  | 64 | + * .build()); | 
|  | 65 | + * AnswerRecordsSettings answerRecordsSettings = answerRecordsSettingsBuilder.build(); | 
|  | 66 | + * }</pre> | 
|  | 67 | + */ | 
|  | 68 | +@Generated("by gapic-generator-java") | 
|  | 69 | +public class AnswerRecordsSettings extends ClientSettings<AnswerRecordsSettings> { | 
|  | 70 | + | 
|  | 71 | + /** Returns the object with the settings used for calls to listAnswerRecords. */ | 
|  | 72 | + public PagedCallSettings< | 
|  | 73 | + ListAnswerRecordsRequest, ListAnswerRecordsResponse, ListAnswerRecordsPagedResponse> | 
|  | 74 | + listAnswerRecordsSettings() { | 
|  | 75 | + return ((AnswerRecordsStubSettings) getStubSettings()).listAnswerRecordsSettings(); | 
|  | 76 | + } | 
|  | 77 | + | 
|  | 78 | + /** Returns the object with the settings used for calls to updateAnswerRecord. */ | 
|  | 79 | + public UnaryCallSettings<UpdateAnswerRecordRequest, AnswerRecord> updateAnswerRecordSettings() { | 
|  | 80 | + return ((AnswerRecordsStubSettings) getStubSettings()).updateAnswerRecordSettings(); | 
|  | 81 | + } | 
|  | 82 | + | 
|  | 83 | + public static final AnswerRecordsSettings create(AnswerRecordsStubSettings stub) | 
|  | 84 | + throws IOException { | 
|  | 85 | + return new AnswerRecordsSettings.Builder(stub.toBuilder()).build(); | 
|  | 86 | + } | 
|  | 87 | + | 
|  | 88 | + /** Returns a builder for the default ExecutorProvider for this service. */ | 
|  | 89 | + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { | 
|  | 90 | + return AnswerRecordsStubSettings.defaultExecutorProviderBuilder(); | 
|  | 91 | + } | 
|  | 92 | + | 
|  | 93 | + /** Returns the default service endpoint. */ | 
|  | 94 | + public static String getDefaultEndpoint() { | 
|  | 95 | + return AnswerRecordsStubSettings.getDefaultEndpoint(); | 
|  | 96 | + } | 
|  | 97 | + | 
|  | 98 | + /** Returns the default service scopes. */ | 
|  | 99 | + public static List<String> getDefaultServiceScopes() { | 
|  | 100 | + return AnswerRecordsStubSettings.getDefaultServiceScopes(); | 
|  | 101 | + } | 
|  | 102 | + | 
|  | 103 | + /** Returns a builder for the default credentials for this service. */ | 
|  | 104 | + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { | 
|  | 105 | + return AnswerRecordsStubSettings.defaultCredentialsProviderBuilder(); | 
|  | 106 | + } | 
|  | 107 | + | 
|  | 108 | + /** Returns a builder for the default ChannelProvider for this service. */ | 
|  | 109 | + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { | 
|  | 110 | + return AnswerRecordsStubSettings.defaultGrpcTransportProviderBuilder(); | 
|  | 111 | + } | 
|  | 112 | + | 
|  | 113 | + public static TransportChannelProvider defaultTransportChannelProvider() { | 
|  | 114 | + return AnswerRecordsStubSettings.defaultTransportChannelProvider(); | 
|  | 115 | + } | 
|  | 116 | + | 
|  | 117 | + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") | 
|  | 118 | + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { | 
|  | 119 | + return AnswerRecordsStubSettings.defaultApiClientHeaderProviderBuilder(); | 
|  | 120 | + } | 
|  | 121 | + | 
|  | 122 | + /** Returns a new builder for this class. */ | 
|  | 123 | + public static Builder newBuilder() { | 
|  | 124 | + return Builder.createDefault(); | 
|  | 125 | + } | 
|  | 126 | + | 
|  | 127 | + /** Returns a new builder for this class. */ | 
|  | 128 | + public static Builder newBuilder(ClientContext clientContext) { | 
|  | 129 | + return new Builder(clientContext); | 
|  | 130 | + } | 
|  | 131 | + | 
|  | 132 | + /** Returns a builder containing all the values of this settings class. */ | 
|  | 133 | + public Builder toBuilder() { | 
|  | 134 | + return new Builder(this); | 
|  | 135 | + } | 
|  | 136 | + | 
|  | 137 | + protected AnswerRecordsSettings(Builder settingsBuilder) throws IOException { | 
|  | 138 | + super(settingsBuilder); | 
|  | 139 | + } | 
|  | 140 | + | 
|  | 141 | + /** Builder for AnswerRecordsSettings. */ | 
|  | 142 | + public static class Builder extends ClientSettings.Builder<AnswerRecordsSettings, Builder> { | 
|  | 143 | + | 
|  | 144 | + protected Builder() throws IOException { | 
|  | 145 | + this(((ClientContext) null)); | 
|  | 146 | + } | 
|  | 147 | + | 
|  | 148 | + protected Builder(ClientContext clientContext) { | 
|  | 149 | + super(AnswerRecordsStubSettings.newBuilder(clientContext)); | 
|  | 150 | + } | 
|  | 151 | + | 
|  | 152 | + protected Builder(AnswerRecordsSettings settings) { | 
|  | 153 | + super(settings.getStubSettings().toBuilder()); | 
|  | 154 | + } | 
|  | 155 | + | 
|  | 156 | + protected Builder(AnswerRecordsStubSettings.Builder stubSettings) { | 
|  | 157 | + super(stubSettings); | 
|  | 158 | + } | 
|  | 159 | + | 
|  | 160 | + private static Builder createDefault() { | 
|  | 161 | + return new Builder(AnswerRecordsStubSettings.newBuilder()); | 
|  | 162 | + } | 
|  | 163 | + | 
|  | 164 | + public AnswerRecordsStubSettings.Builder getStubSettingsBuilder() { | 
|  | 165 | + return ((AnswerRecordsStubSettings.Builder) getStubSettings()); | 
|  | 166 | + } | 
|  | 167 | + | 
|  | 168 | + // NEXT_MAJOR_VER: remove 'throws Exception'. | 
|  | 169 | + /** | 
|  | 170 | + * Applies the given settings updater function to all of the unary API methods in this service. | 
|  | 171 | + * | 
|  | 172 | + * <p>Note: This method does not support applying settings to streaming methods. | 
|  | 173 | + */ | 
|  | 174 | + public Builder applyToAllUnaryMethods( | 
|  | 175 | + ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception { | 
|  | 176 | + super.applyToAllUnaryMethods( | 
|  | 177 | + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); | 
|  | 178 | + return this; | 
|  | 179 | + } | 
|  | 180 | + | 
|  | 181 | + /** Returns the builder for the settings used for calls to listAnswerRecords. */ | 
|  | 182 | + public PagedCallSettings.Builder< | 
|  | 183 | + ListAnswerRecordsRequest, ListAnswerRecordsResponse, ListAnswerRecordsPagedResponse> | 
|  | 184 | + listAnswerRecordsSettings() { | 
|  | 185 | + return getStubSettingsBuilder().listAnswerRecordsSettings(); | 
|  | 186 | + } | 
|  | 187 | + | 
|  | 188 | + /** Returns the builder for the settings used for calls to updateAnswerRecord. */ | 
|  | 189 | + public UnaryCallSettings.Builder<UpdateAnswerRecordRequest, AnswerRecord> | 
|  | 190 | + updateAnswerRecordSettings() { | 
|  | 191 | + return getStubSettingsBuilder().updateAnswerRecordSettings(); | 
|  | 192 | + } | 
|  | 193 | + | 
|  | 194 | + @Override | 
|  | 195 | + public AnswerRecordsSettings build() throws IOException { | 
|  | 196 | + return new AnswerRecordsSettings(this); | 
|  | 197 | + } | 
|  | 198 | + } | 
|  | 199 | +} | 
0 commit comments