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

io.convergence_platform.services.infrastructure.InfrastructureMicroService Maven / Gradle / Ivy

Go to download

Holds the common functionality needed by all Convergence Platform-based services written in Java.

The newest version!
package io.convergence_platform.services.infrastructure;

import io.convergence_platform.common.responses.ApiResponse;
import io.convergence_platform.services.infrastructure.dto.ServiceConnectionDetailsRequest;
import io.convergence_platform.services.infrastructure.dto.ServiceConnectionDetailsResponse;
import io.convergence_platform.services.services.BaseRetrofitExternalService;
import retrofit2.Response;

public class InfrastructureMicroService extends BaseRetrofitExternalService {
    public InfrastructureMicroService(String url, String jwt) {
        super(url, jwt);
    }

    @Override
    protected Class getApiInterface() {
        return IInfrastructureMicroServiceAPI.class;
    }

    public ApiResponse getServiceConnectionDetails(String serviceName) {
        return getServiceConnectionDetails(new ServiceConnectionDetailsRequest(serviceName));
    }

    public ApiResponse getServiceConnectionDetails(ServiceConnectionDetailsRequest request) {
        ApiResponse result = null;
        Response> callResponse = null;

        try {
            callResponse = externalService.getServiceConnectionDetails(request).execute();
            if (callResponse.isSuccessful()) {
                result = callResponse.body();
            } else {
                result = loadFailureInfo(callResponse.errorBody(), null, new ApiResponse());
            }
        } catch (Exception ex) {
            result = loadFailureInfo(null, ex, new ApiResponse());
        }

        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy