use of com.willshex.blogwt.shared.api.notification.call.SetPushTokenRequest 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;
}
use of com.willshex.blogwt.shared.api.notification.call.SetPushTokenRequest in project blogwt by billy1380.
the class NotificationJsonServlet method processAction.
@Override
protected String processAction(String action, JsonObject request) {
String output = "null";
if ("UpdateMetaNotification".equals(action)) {
UpdateMetaNotificationRequest input = new UpdateMetaNotificationRequest();
input.fromJson(request);
output = new UpdateMetaNotificationActionHandler().handle(input).toString();
} else if ("AddMetaNotification".equals(action)) {
AddMetaNotificationRequest input = new AddMetaNotificationRequest();
input.fromJson(request);
output = new AddMetaNotificationActionHandler().handle(input).toString();
} else if ("GetMetaNotification".equals(action)) {
GetMetaNotificationRequest input = new GetMetaNotificationRequest();
input.fromJson(request);
output = new GetMetaNotificationActionHandler().handle(input).toString();
} else if ("GetNotifications".equals(action)) {
GetNotificationsRequest input = new GetNotificationsRequest();
input.fromJson(request);
output = new GetNotificationsActionHandler().handle(input).toString();
} else if ("GetMetaNotifications".equals(action)) {
GetMetaNotificationsRequest input = new GetMetaNotificationsRequest();
input.fromJson(request);
output = new GetMetaNotificationsActionHandler().handle(input).toString();
} else if ("GetNotificationSettings".equals(action)) {
GetNotificationSettingsRequest input = new GetNotificationSettingsRequest();
input.fromJson(request);
output = new GetNotificationSettingsActionHandler().handle(input).toString();
} else if ("SendAdhocNotification".equals(action)) {
SendAdhocNotificationRequest input = new SendAdhocNotificationRequest();
input.fromJson(request);
output = new SendAdhocNotificationActionHandler().handle(input).toString();
} else if ("UpdateNotificationSettings".equals(action)) {
UpdateNotificationSettingsRequest input = new UpdateNotificationSettingsRequest();
input.fromJson(request);
output = new UpdateNotificationSettingsActionHandler().handle(input).toString();
} else if ("SetPushToken".equals(action)) {
SetPushTokenRequest input = new SetPushTokenRequest();
input.fromJson(request);
output = new SetPushTokenActionHandler().handle(input).toString();
}
return output;
}
Aggregations