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

io.github.ferhas.users_provider.client.UsersProvider Maven / Gradle / Ivy

package io.github.ferhas.users_provider.client;

import feign.Feign;
import feign.jackson.JacksonDecoder;
import io.github.ferhas.users_provider.models.request.UsersProviderAPIOptions;
import io.github.ferhas.users_provider.models.response.UsersProviderAPIResponse;

import java.util.function.Supplier;

public class UsersProvider {

    protected final UsersAPIClient client = Feign
            .builder()
            .queryMapEncoder(new UsersAPIEncoder())
            .decoder(new JacksonDecoder())
            .target(UsersAPIClient.class, Constants.API_URL);

    public final UsersProviderAPIResponse getUsers() {
        return getUsers(UsersProviderAPIOptions.builder().build());
    }

    public final UsersProviderAPIResponse getUsers(Supplier optionSupplier) {
        UsersProviderAPIOptions options = optionSupplier.get();
        return getUsers(options);
    }

    public final UsersProviderAPIResponse getUsers(UsersProviderAPIOptions options) {
        return client.users(options);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy