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