
com.vendasta.accountgroup.v1.internal.AccountValidationServiceGeneratedClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of accountgroup.v1 Show documentation
Show all versions of accountgroup.v1 Show documentation
Java SDK for service account-group
The newest version!
/**
Code generated by sdkgen
DO NOT EDIT!
*/
package com.vendasta.accountgroup.v1.internal;
import com.google.protobuf.*;
import com.vendasta.vax.Environment;
import com.vendasta.vax.EnvironmentConfig;
import com.vendasta.vax.RequestOptions;
import com.vendasta.vax.SDKException;
import com.vendasta.accountgroup.v1.Config;
import java.io.InputStream;
public class AccountValidationServiceGeneratedClient implements AccountValidationServiceClientInterface {
private AccountValidationServiceClientInterface transport;
public AccountValidationServiceGeneratedClient(Environment environment) {
this(environment, 10000);
}
public AccountValidationServiceGeneratedClient(Environment environment, Options options) {
this.transport = this.getTransportClient(environment, options);
}
public AccountValidationServiceGeneratedClient(Environment environment, float defaultTimeout) {
Options opts = new Options.Builder().setDefaultTimeout(defaultTimeout).build();
this.transport = this.getTransportClient(environment, opts);
}
public AccountValidationServiceGeneratedClient(Environment environment, InputStream serviceAccount, float defaultTimeout) {
Options opts = new Options.Builder().setDefaultTimeout(defaultTimeout).build();
this.transport = this.getTransportClient(environment, serviceAccount, opts);
}
public AccountValidationServiceGeneratedClient(Environment environment, InputStream serviceAccount, Options options) {
this.transport = this.getTransportClient(environment, serviceAccount, options);
}
private AccountValidationServiceClientInterface getTransportClient(Environment environment, Options options) {
EnvironmentConfig config = Config.getEnvironmentConfig(environment);
if (options.getUseHttp()) {
return new AccountValidationServiceHTTPClient(config.getHost(), config.getScope(), config.isSecure(), options.getDefaultTimeout());
}
try {
Class.forName("io.grpc.stub.AbstractStub");
return new AccountValidationServiceGRPCClient(config.getHost(), config.getScope(), config.isSecure(), options.getDefaultTimeout());
} catch (ClassNotFoundException e) {
return new AccountValidationServiceHTTPClient(config.getHost(), config.getScope(), config.isSecure(), options.getDefaultTimeout());
}
}
private AccountValidationServiceClientInterface getTransportClient(Environment environment, InputStream serviceAccount, Options options) {
EnvironmentConfig config = Config.getEnvironmentConfig(environment);
if (options.getUseHttp()) {
return new AccountValidationServiceHTTPClient(config.getHost(), config.getScope(), serviceAccount, config.isSecure(), options.getDefaultTimeout());
}
try {
Class.forName("io.grpc.stub.AbstractStub");
return new AccountValidationServiceGRPCClient(config.getHost(), config.getScope(), serviceAccount, config.isSecure(), options.getDefaultTimeout());
} catch (ClassNotFoundException e) {
return new AccountValidationServiceHTTPClient(config.getHost(), config.getScope(), serviceAccount, config.isSecure(), options.getDefaultTimeout());
}
}
@Override
public ValidateAddressMultiResponse ValidateAddressMulti(ValidateAddressMultiRequest req, RequestOptions.Builder options) throws SDKException {
return this.transport.ValidateAddressMulti(req, options);
}
public static class Options {
private Boolean useHttp = false;
private float defaultTimeout = 10000;
Options(Builder builder) {
if (builder.useHttp != null) {
this.useHttp = builder.useHttp;
}
if (builder.defaultTimeout != null) {
this.defaultTimeout = builder.defaultTimeout;
}
}
Boolean getUseHttp() {
return this.useHttp;
}
Float getDefaultTimeout() {
return this.defaultTimeout;
}
public static class Builder {
private Boolean useHttp;
private Float defaultTimeout;
/**
* Returns a Builder for Options, which is a mutable representation of the object. Once the
* client has built up an object they can then create an immutable Options object using the
* build function.
* @return A fresh Builder instance with no values set
**/
public static Builder newBuilder() {
return new Builder();
}
public Builder useHttp() {
this.useHttp = true;
return this;
}
public Builder setDefaultTimeout(Float defaultTimeout) {
this.defaultTimeout = defaultTimeout;
return this;
}
public Options build() {
return new Options(this);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy