use of com.willshex.blogwt.shared.api.blog.call.DeletePostResponse in project blogwt by billy1380.
the class PostController method deletePost.
public void deletePost(Post post) {
final DeletePostRequest input = SessionController.get().setSession(ApiHelper.setAccessCode(new DeletePostRequest())).post(post);
ApiHelper.createBlogClient().deletePost(input, new AsyncCallback<DeletePostResponse>() {
@Override
public void onSuccess(DeletePostResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
if (input.post != null) {
fetchPosts();
}
}
DefaultEventBus.get().fireEventFromSource(new DeletePostSuccess(input, output), PostController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new DeletePostFailure(input, caught), PostController.this);
}
});
}
use of com.willshex.blogwt.shared.api.blog.call.DeletePostResponse in project blogwt by billy1380.
the class BlogService method deletePost.
public Request deletePost(DeletePostRequest input, AsyncSuccess<DeletePostRequest, DeletePostResponse> onSuccess, AsyncFailure<DeletePostRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(BlogMethodDeletePost, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
DeletePostResponse outputParameter = new DeletePostResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(BlogService.this, BlogMethodDeletePost, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodDeletePost, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodDeletePost, input, exception);
}
});
onCallStart(BlogService.this, BlogMethodDeletePost, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodDeletePost, input, exception);
}
return handle;
}
Aggregations