Search in sources :

Example 1 with BlogService

use of com.willshex.blogwt.client.api.blog.BlogService 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);
        }
    });
}
Also used : BlogService(com.willshex.blogwt.client.api.blog.BlogService) CreatePostRequest(com.willshex.blogwt.shared.api.blog.call.CreatePostRequest) Post(com.willshex.blogwt.shared.api.datatype.Post) CreatePostSuccess(com.willshex.blogwt.client.api.blog.event.CreatePostEventHandler.CreatePostSuccess) CreatePostFailure(com.willshex.blogwt.client.api.blog.event.CreatePostEventHandler.CreatePostFailure) PostContent(com.willshex.blogwt.shared.api.datatype.PostContent) CreatePostResponse(com.willshex.blogwt.shared.api.blog.call.CreatePostResponse)

Example 2 with BlogService

use of com.willshex.blogwt.client.api.blog.BlogService in project blogwt by billy1380.

the class PropertyController method setupBlog.

public void setupBlog(List<Property> properties, List<User> users) {
    final SetupBlogRequest input = ApiHelper.setAccessCode(new SetupBlogRequest()).properties(properties).users(users);
    BlogService blogService = ApiHelper.createBlogClient();
    blogService.setupBlog(input, new AsyncCallback<SetupBlogResponse>() {

        @Override
        public void onSuccess(SetupBlogResponse output) {
            DefaultEventBus.get().fireEventFromSource(new SetupBlogSuccess(input, output), PropertyController.this);
        }

        @Override
        public void onFailure(Throwable caught) {
            DefaultEventBus.get().fireEventFromSource(new SetupBlogFailure(input, caught), PropertyController.this);
        }
    });
}
Also used : BlogService(com.willshex.blogwt.client.api.blog.BlogService) SetupBlogRequest(com.willshex.blogwt.shared.api.blog.call.SetupBlogRequest) SetupBlogResponse(com.willshex.blogwt.shared.api.blog.call.SetupBlogResponse) SetupBlogFailure(com.willshex.blogwt.client.api.blog.event.SetupBlogEventHandler.SetupBlogFailure) SetupBlogSuccess(com.willshex.blogwt.client.api.blog.event.SetupBlogEventHandler.SetupBlogSuccess)

Example 3 with BlogService

use of com.willshex.blogwt.client.api.blog.BlogService in project blogwt by billy1380.

the class ApiHelper method createBlogClient.

public static BlogService createBlogClient() {
    BlogService service = new BlogService();
    service.setUrl(BLOG_END_POINT);
    service.setBus(DefaultEventBus.get());
    return service;
}
Also used : BlogService(com.willshex.blogwt.client.api.blog.BlogService)

Aggregations

BlogService (com.willshex.blogwt.client.api.blog.BlogService)3 CreatePostFailure (com.willshex.blogwt.client.api.blog.event.CreatePostEventHandler.CreatePostFailure)1 CreatePostSuccess (com.willshex.blogwt.client.api.blog.event.CreatePostEventHandler.CreatePostSuccess)1 SetupBlogFailure (com.willshex.blogwt.client.api.blog.event.SetupBlogEventHandler.SetupBlogFailure)1 SetupBlogSuccess (com.willshex.blogwt.client.api.blog.event.SetupBlogEventHandler.SetupBlogSuccess)1 CreatePostRequest (com.willshex.blogwt.shared.api.blog.call.CreatePostRequest)1 CreatePostResponse (com.willshex.blogwt.shared.api.blog.call.CreatePostResponse)1 SetupBlogRequest (com.willshex.blogwt.shared.api.blog.call.SetupBlogRequest)1 SetupBlogResponse (com.willshex.blogwt.shared.api.blog.call.SetupBlogResponse)1 Post (com.willshex.blogwt.shared.api.datatype.Post)1 PostContent (com.willshex.blogwt.shared.api.datatype.PostContent)1