io.convergence_platform.services.infrastructure.EmailService 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.dto.AtomicValueDTO;
import io.convergence_platform.common.responses.ApiResponse;
import io.convergence_platform.services.infrastructure.dto.SendEmailRequest;
import io.convergence_platform.services.services.BaseRetrofitExternalService;
import retrofit2.Response;
import retrofit2.http.Body;
public class EmailService extends BaseRetrofitExternalService {
public EmailService(String discoveryServerUrl, String jwt) {
super(discoveryServerUrl, "email-service", jwt);
}
@Override
protected Class getApiInterface() {
return IEmailServiceAPI.class;
}
public ApiResponse> send(@Body SendEmailRequest request) {
ApiResponse> result = null;
Response>> callResponse = null;
try {
callResponse = externalService.send(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;
}
}