All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vendasta.accountgroup.v1.internal.AccountGroupServiceGeneratedClient Maven / Gradle / Ivy

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 AccountGroupServiceGeneratedClient implements AccountGroupServiceClientInterface {
    private AccountGroupServiceClientInterface transport;

    public AccountGroupServiceGeneratedClient(Environment environment) {
        this(environment, 10000);
    }

    public AccountGroupServiceGeneratedClient(Environment environment, Options options) {
        this.transport = this.getTransportClient(environment, options);
    }

    public AccountGroupServiceGeneratedClient(Environment environment, float defaultTimeout) {
        Options opts = new Options.Builder().setDefaultTimeout(defaultTimeout).build();
        this.transport = this.getTransportClient(environment, opts);
    }

    public AccountGroupServiceGeneratedClient(Environment environment, InputStream serviceAccount, float defaultTimeout) {
        Options opts = new Options.Builder().setDefaultTimeout(defaultTimeout).build();
        this.transport = this.getTransportClient(environment, serviceAccount, opts);
    }

    public AccountGroupServiceGeneratedClient(Environment environment, InputStream serviceAccount, Options options) {
        this.transport = this.getTransportClient(environment, serviceAccount, options);
    }

    private AccountGroupServiceClientInterface getTransportClient(Environment environment, Options options) {
        EnvironmentConfig config = Config.getEnvironmentConfig(environment);
        if (options.getUseHttp()) {
            return new AccountGroupServiceHTTPClient(config.getHost(), config.getScope(), config.isSecure(), options.getDefaultTimeout());
        }
        try {
            Class.forName("io.grpc.stub.AbstractStub");
            return new AccountGroupServiceGRPCClient(config.getHost(), config.getScope(), config.isSecure(), options.getDefaultTimeout());
        } catch (ClassNotFoundException e) {
            return new AccountGroupServiceHTTPClient(config.getHost(), config.getScope(), config.isSecure(), options.getDefaultTimeout());
        }
    }

    private AccountGroupServiceClientInterface getTransportClient(Environment environment, InputStream serviceAccount, Options options) {
        EnvironmentConfig config = Config.getEnvironmentConfig(environment);
        if (options.getUseHttp()) {
            return new AccountGroupServiceHTTPClient(config.getHost(), config.getScope(), serviceAccount, config.isSecure(), options.getDefaultTimeout());
        }
        try {
            Class.forName("io.grpc.stub.AbstractStub");
            return new AccountGroupServiceGRPCClient(config.getHost(), config.getScope(), serviceAccount, config.isSecure(), options.getDefaultTimeout());
        } catch (ClassNotFoundException e) {
            return new AccountGroupServiceHTTPClient(config.getHost(), config.getScope(), serviceAccount, config.isSecure(), options.getDefaultTimeout());
        }
    }
    
    @Override
    public GetMultiResponse GetMulti(GetMultiRequest req, RequestOptions.Builder options) throws SDKException {
        return this.transport.GetMulti(req, options);
    }
    
    @Override
    public PagedResponse Lookup(LookupRequest req, RequestOptions.Builder options) throws SDKException {
        return this.transport.Lookup(req, options);
    }
    
    @Override
    public CreateAccountGroupResponse Create(CreateAccountGroupRequest req, RequestOptions.Builder options) throws SDKException {
        return this.transport.Create(req, options);
    }
    
    @Override
    public Empty Delete(DeleteAccountGroupRequest req, RequestOptions.Builder options) throws SDKException {
        return this.transport.Delete(req, options);
    }
    
    @Override
    public Empty BulkUpdate(BulkUpdateRequest req, RequestOptions.Builder options) throws SDKException {
        return this.transport.BulkUpdate(req, options);
    }
    
    @Override
    public PagedResponse List(ListRequest req, RequestOptions.Builder options) throws SDKException {
        return this.transport.List(req, options);
    }
    
    @Override
    public ListPotentialDuplicatesResponse ListPotentialDuplicates(ListPotentialDuplicatesRequest req, RequestOptions.Builder options) throws SDKException {
        return this.transport.ListPotentialDuplicates(req, options);
    }
    
    @Override
    public ListAllPotentialDuplicatesResponse ListAllPotentialDuplicates(ListAllPotentialDuplicatesRequest req, RequestOptions.Builder options) throws SDKException {
        return this.transport.ListAllPotentialDuplicates(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