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