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

com.merge.api.MergeApiClient Maven / Gradle / Ivy

package com.merge.api;

import com.merge.api.core.ClientOptions;
import com.merge.api.core.Suppliers;
import com.merge.api.resources.accounting.AccountingClient;
import com.merge.api.resources.ats.AtsClient;
import com.merge.api.resources.crm.CrmClient;
import com.merge.api.resources.hris.HrisClient;
import com.merge.api.resources.ticketing.TicketingClient;
import java.util.function.Supplier;

public class MergeApiClient {
    protected final ClientOptions clientOptions;

    protected final Supplier atsClient;

    protected final Supplier crmClient;

    protected final Supplier hrisClient;

    protected final Supplier ticketingClient;

    protected final Supplier accountingClient;

    public MergeApiClient(ClientOptions clientOptions) {
        this.clientOptions = clientOptions;
        this.atsClient = Suppliers.memoize(() -> new AtsClient(clientOptions));
        this.crmClient = Suppliers.memoize(() -> new CrmClient(clientOptions));
        this.hrisClient = Suppliers.memoize(() -> new HrisClient(clientOptions));
        this.ticketingClient = Suppliers.memoize(() -> new TicketingClient(clientOptions));
        this.accountingClient = Suppliers.memoize(() -> new AccountingClient(clientOptions));
    }

    public AtsClient ats() {
        return this.atsClient.get();
    }

    public CrmClient crm() {
        return this.crmClient.get();
    }

    public HrisClient hris() {
        return this.hrisClient.get();
    }

    public TicketingClient ticketing() {
        return this.ticketingClient.get();
    }

    public AccountingClient accounting() {
        return this.accountingClient.get();
    }

    public static MergeApiClientBuilder builder() {
        return new MergeApiClientBuilder();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy