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

global.maplink.place.async.PlaceAsyncAPI Maven / Gradle / Ivy

package global.maplink.place.async;

import global.maplink.MapLinkSDK;
import global.maplink.env.Environment;
import global.maplink.place.schema.*;

import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;

import static global.maplink.MapLinkServiceRequestAsyncRunner.proxyFor;

public interface PlaceAsyncAPI {

    CompletableFuture calculate(PlaceRouteRequest request);

    CompletableFuture create(CreatePlaceRequest request);

    default CompletableFuture create(Place place) {
        return create(new CreatePlaceRequest(place));
    }

    CompletableFuture listAll(ListAllPlacesRequest request);

    default CompletableFuture listAll(int limit, int offset) {
        return listAll(ListAllPlacesRequest.builder().limit(limit).offset(offset).build());
    }

    CompletableFuture> listAllStates(ListAllStatesRequest request);

    CompletableFuture> listAllCities(ListAllCitiesRequest request);

    CompletableFuture> listAllDistricts(ListAllDistrictsRequest request);

    default CompletableFuture listAll() {
        return listAll(ListAllPlacesRequest.builder().build());
    }

    CompletableFuture> getByOriginId(PlaceByOriginIdRequest request);

    default CompletableFuture> getByOriginId(String originId) {
        return getByOriginId(PlaceByOriginIdRequest.builder().originId(originId).build());
    }

    static PlaceAsyncAPI getInstance() {
        return getInstance(null);
    }

    static PlaceAsyncAPI getInstance(Environment environment) {
        MapLinkSDK sdk = MapLinkSDK.getInstance();
        return proxyFor(
                PlaceAsyncAPI.class,
                Optional.ofNullable(environment).orElse(sdk.getEnvironment()),
                sdk
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy