use of com.willshex.blogwt.shared.api.notification.call.SendAdhocNotificationResponse in project blogwt by billy1380.
the class NotificationService method sendAdhocNotification.
public Request sendAdhocNotification(SendAdhocNotificationRequest input, AsyncSuccess<SendAdhocNotificationRequest, SendAdhocNotificationResponse> onSuccess, AsyncFailure<SendAdhocNotificationRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(NotificationMethodSendAdhocNotification, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
SendAdhocNotificationResponse outputParameter = new SendAdhocNotificationResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(NotificationService.this, NotificationMethodSendAdhocNotification, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(NotificationService.this, NotificationMethodSendAdhocNotification, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(NotificationService.this, NotificationMethodSendAdhocNotification, input, exception);
}
});
onCallStart(NotificationService.this, NotificationMethodSendAdhocNotification, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(NotificationService.this, NotificationMethodSendAdhocNotification, input, exception);
}
return handle;
}
Aggregations