use of com.willshex.blogwt.shared.api.blog.call.UpdatePostResponse in project blogwt by billy1380.
the class PostController method updatePost.
public void updatePost(Post post, String title, Boolean listed, Boolean commentsEnabled, String summary, String content, Boolean publish, String tags) {
final UpdatePostRequest input = SessionController.get().setSession(ApiHelper.setAccessCode(new UpdatePostRequest())).post(post.title(title).summary(summary).listed(listed).commentsEnabled(commentsEnabled).tags(TagHelper.convertToTagList(tags))).publish(publish);
input.post.content.body = content;
ApiHelper.createBlogClient().updatePost(input, new AsyncCallback<UpdatePostResponse>() {
@Override
public void onSuccess(UpdatePostResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
fetchPosts();
}
DefaultEventBus.get().fireEventFromSource(new UpdatePostSuccess(input, output), PostController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new UpdatePostFailure(input, caught), PostController.this);
}
});
}
use of com.willshex.blogwt.shared.api.blog.call.UpdatePostResponse in project blogwt by billy1380.
the class BlogService method updatePost.
public Request updatePost(UpdatePostRequest input, AsyncSuccess<UpdatePostRequest, UpdatePostResponse> onSuccess, AsyncFailure<UpdatePostRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(BlogMethodUpdatePost, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
UpdatePostResponse outputParameter = new UpdatePostResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(BlogService.this, BlogMethodUpdatePost, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodUpdatePost, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodUpdatePost, input, exception);
}
});
onCallStart(BlogService.this, BlogMethodUpdatePost, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(BlogService.this, BlogMethodUpdatePost, input, exception);
}
return handle;
}
Aggregations