use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.
the class DeleteTagsApi method addTags.
@Post
public GenericResponse addTags(PostRequest request) throws InsufficientAccessException {
AccessToken accessToken = AccessTokenFilter.getAccessToken();
if (accessToken.getUserId() != 5073076857339904L) {
Logger.getLogger(TagsApi.class.getSimpleName()).log(Level.SEVERE, "AccessToken : " + accessToken.getId());
Logger.getLogger(TagsApi.class.getSimpleName()).log(Level.SEVERE, "User Id : " + accessToken.getUserId());
throw new InsufficientAccessException();
}
TagDataUtil.removeTags(request.getIds());
return new GenericResponse();
}
use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.
the class I18nApi method post.
@Post
public static GenericResponse post(PostRequest request) throws InsufficientAccessException, UnexpectedServerException {
if (!UserAccessUtil.hasUserAccess(AccessTokenFilter.getAccessToken().getUserId(), request.language, AccessType.I18N_UPDATE))
throw new InsufficientAccessException();
DataAccessor dataAccessor = DataAccessorFactory.getDataAccessor();
List<I18n> i18nList = new ArrayList<>();
for (Entry<String, String> entry : request.keyValues.entrySet()) {
I18n i18n = dataAccessor.getI18n(entry.getKey());
if (i18n == null)
i18n = dataAccessor.newI18n(entry.getKey());
// Resetting the group if its already set
i18n.setGroup(request.group);
i18n.setI18nString(request.language, entry.getValue());
i18nList.add(i18n);
}
i18nList = dataAccessor.createOrUpdateI18nList(i18nList);
return new GenericResponse();
}
use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.
the class AuthorImageApi method post.
@Post
public GenericResponse 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 profileImageUrl = AuthorDataUtil.saveAuthorImage(request.authorId, blobEntry);
return new Response(profileImageUrl);
}
use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.
the class PratilipiContentImageApi 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 imageName = PratilipiDocUtil.saveContentImage(request.pratilipiId, blobEntry);
return new PostResponse(imageName);
}
use of com.pratilipi.api.annotation.Post in project pratilipi by Pratilipi.
the class PratilipiContentV1Api method post.
@Post
public GenericResponse post(PostRequest request) throws InvalidArgumentException, InsufficientAccessException, UnexpectedServerException {
PratilipiDocUtil.saveContentPage(request.pratilipiId, request.chapterNo, request.chapterTitle, request.pageNo == null ? 1 : request.pageNo, request.content);
Task task = TaskQueueFactory.newTask().setUrl("/pratilipi/process").addParam("pratilipiId", request.pratilipiId.toString()).addParam("processContentDoc", "true");
TaskQueueFactory.getPratilipiTaskQueue().add(task);
return new GenericResponse();
}
Aggregations