io.convergence_platform.services.infrastructure.InfrastructureMicroService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of service-lib Show documentation
Show all versions of service-lib Show documentation
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;
}
}