Search in sources :

Example 6 with Post

use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.

the class PratilipiCoverApi method post.

@Post
public PostResponse post(PostRequest request) throws InvalidArgumentException, InsufficientAccessException, UnexpectedServerException {
    BlobEntry blobEntry = DataAccessorFactory.getBlobAccessor().newBlob(request.getName());
    blobEntry.setData(request.getData());
    blobEntry.setMimeType(request.getMimeType());
    blobEntry.setMetaName(request.getName());
    String coverImageUrl = PratilipiDataUtil.savePratilipiCover(request.pratilipiId, blobEntry);
    return new PostResponse(coverImageUrl);
}
Also used : BlobEntry(com.pratilipi.data.type.BlobEntry) Post(com.pratilipi.api.annotation.Post)

Example 7 with Post

use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.

the class AuthorApi method post.

@Post
public Response post(PostRequest request) throws InvalidArgumentException, InsufficientAccessException, UnexpectedServerException {
    Gson gson = new Gson();
    AuthorData authorData = gson.fromJson(gson.toJson(request), AuthorData.class);
    if (// New authors (added by AEEs) are ACTIVE by default
    request.getId() == null)
        authorData.setState(AuthorState.ACTIVE);
    authorData = AuthorDataUtil.saveAuthorData(authorData);
    Task task = TaskQueueFactory.newTask().setUrl("/author/process").addParam("authorId", authorData.getId().toString()).addParam("processData", "true");
    TaskQueueFactory.getAuthorTaskQueue().add(task);
    return new Response(authorData);
}
Also used : GenericResponse(com.pratilipi.api.shared.GenericResponse) Task(com.pratilipi.taskqueue.Task) AuthorData(com.pratilipi.data.client.AuthorData) Gson(com.google.gson.Gson) Post(com.pratilipi.api.annotation.Post)

Example 8 with Post

use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.

the class BlogPostApi method post.

@Post
public Response post(PostRequest request) throws InvalidArgumentException, InsufficientAccessException {
    BlogPostData blogPostData = new BlogPostData(request.blogPostId);
    blogPostData.setBlogId(request.blogId);
    blogPostData.setTitle(request.title);
    blogPostData.setTitleEn(request.titleEn);
    blogPostData.setContent(request.content);
    blogPostData.setLanguage(UxModeFilter.getFilterLanguage());
    blogPostData.setState(request.state);
    blogPostData = BlogPostDataUtil.saveBlogPostData(blogPostData);
    return new Response(blogPostData);
}
Also used : GenericResponse(com.pratilipi.api.shared.GenericResponse) BlogPostData(com.pratilipi.data.client.BlogPostData) Post(com.pratilipi.api.annotation.Post) BlogPost(com.pratilipi.data.type.BlogPost)

Example 9 with Post

use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.

the class EventApi method post.

@Post
public Response post(PostRequest request) throws InvalidArgumentException, InsufficientAccessException {
    Gson gson = new Gson();
    EventData eventData = gson.fromJson(gson.toJson(request), EventData.class);
    eventData = EventDataUtil.saveEventData(eventData);
    return new Response(eventData);
}
Also used : GenericResponse(com.pratilipi.api.shared.GenericResponse) Gson(com.google.gson.Gson) EventData(com.pratilipi.data.client.EventData) Post(com.pratilipi.api.annotation.Post)

Example 10 with Post

use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.

the class EventBannerApi method post.

@Post
public GenericResponse post(PostRequest request) throws InsufficientAccessException, UnexpectedServerException {
    BlobEntry blobEntry = DataAccessorFactory.getBlobAccessor().newBlob(request.getName());
    blobEntry.setData(request.getData());
    blobEntry.setMimeType(request.getMimeType());
    EventDataUtil.saveEventBanner(request.eventId, blobEntry);
    return new GenericResponse();
}
Also used : GenericResponse(com.pratilipi.api.shared.GenericResponse) BlobEntry(com.pratilipi.data.type.BlobEntry) Post(com.pratilipi.api.annotation.Post)

Aggregations

Post (com.pratilipi.api.annotation.Post)32 GenericResponse (com.pratilipi.api.shared.GenericResponse)22 Task (com.pratilipi.taskqueue.Task)15 DataAccessor (com.pratilipi.data.DataAccessor)6 UserData (com.pratilipi.data.client.UserData)6 Gson (com.google.gson.Gson)5 InvalidArgumentException (com.pratilipi.common.exception.InvalidArgumentException)5 BlobEntry (com.pratilipi.data.type.BlobEntry)5 InsufficientAccessException (com.pratilipi.common.exception.InsufficientAccessException)3 Author (com.pratilipi.data.type.Author)3 Page (com.pratilipi.data.type.Page)3 Pratilipi (com.pratilipi.data.type.Pratilipi)3 Date (java.util.Date)3 JsonObject (com.google.gson.JsonObject)2 GenericFileDownloadResponse (com.pratilipi.api.shared.GenericFileDownloadResponse)2 UnexpectedServerException (com.pratilipi.common.exception.UnexpectedServerException)2 AuthorData (com.pratilipi.data.client.AuthorData)2 UserAuthorData (com.pratilipi.data.client.UserAuthorData)2 AccessToken (com.pratilipi.data.type.AccessToken)2 ArrayList (java.util.ArrayList)2