108 lines
6.2 KiB
Java
108 lines
6.2 KiB
Java
package com.inteligr8.alfresco.acs.api;
|
|
|
|
import com.inteligr8.alfresco.acs.model.CommentBody;
|
|
import com.inteligr8.alfresco.acs.model.CommentEntry;
|
|
import com.inteligr8.alfresco.acs.model.CommentPaging;
|
|
import com.inteligr8.alfresco.acs.model.Error;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiResponse;
|
|
import io.swagger.annotations.ApiResponses;
|
|
import java.util.List;
|
|
import javax.ws.rs.*;
|
|
|
|
/**
|
|
* Alfresco Content Services REST API
|
|
*
|
|
* <p>**Core API** Provides access to the core features of Alfresco Content Services.
|
|
*
|
|
*/
|
|
@Path("/api/-default-/public/alfresco/versions/1")
|
|
@Api(value = "/api/-default-/public/alfresco/versions/1", description = "")
|
|
public interface CommentsApi {
|
|
|
|
/**
|
|
* Create a comment
|
|
*
|
|
* Creates a comment on node **nodeId**. You specify the comment in a JSON body like this: ```JSON { \"content\": \"This is a comment\" } ``` **Note:** You can create more than one comment by specifying a list of comments in the JSON body like this: ```JSON [ { \"content\": \"This is a comment\" }, { \"content\": \"This is another comment\" } ] ``` If you specify a list as input, then a paginated list rather than an entry is returned in the response body. For example: ```JSON { \"list\": { \"pagination\": { \"count\": 2, \"hasMoreItems\": false, \"totalItems\": 2, \"skipCount\": 0, \"maxItems\": 100 }, \"entries\": [ { \"entry\": { ... } }, { \"entry\": { ... } } ] } } ```
|
|
*
|
|
*/
|
|
@POST
|
|
@Path("/nodes/{nodeId}/comments")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Create a comment", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 201, message = "Successful response", response = CommentEntry.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: **commentBodyCreate** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission to create a comment"),
|
|
@ApiResponse(code = 404, message = "**nodeId** does not exist "),
|
|
@ApiResponse(code = 405, message = "Cannot comment on a node of this type"),
|
|
@ApiResponse(code = 409, message = "**nodeId** is locked and you are not the lock owner "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public CommentEntry createComment(@PathParam("nodeId") String nodeId, CommentBody commentBodyCreate, @QueryParam("fields")List<String> fields);
|
|
|
|
/**
|
|
* Delete a comment
|
|
*
|
|
* Deletes the comment **commentId** from node **nodeId**.
|
|
*
|
|
*/
|
|
@DELETE
|
|
@Path("/nodes/{nodeId}/comments/{commentId}")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Delete a comment", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 204, message = "Successful response"),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission to delete a comment"),
|
|
@ApiResponse(code = 404, message = "**nodeId** or **commentId** does not exist "),
|
|
@ApiResponse(code = 409, message = "**nodeId** is locked and you are not the lock owner "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public void deleteComment(@PathParam("nodeId") String nodeId, @PathParam("commentId") String commentId);
|
|
|
|
/**
|
|
* List comments
|
|
*
|
|
* Gets a list of comments for the node **nodeId**, sorted chronologically with the newest comment first.
|
|
*
|
|
*/
|
|
@GET
|
|
@Path("/nodes/{nodeId}/comments")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "List comments", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 200, message = "Successful response", response = CommentPaging.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: **nodeId** exists but does not identify a file or a folder, or the value of **maxItems** is invalid, or the value of **skipCount** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission read comments on the node"),
|
|
@ApiResponse(code = 404, message = "**nodeId** does not exist "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public CommentPaging listComments(@PathParam("nodeId") String nodeId, @QueryParam("skipCount")@DefaultValue("0") Integer skipCount, @QueryParam("maxItems")@DefaultValue("100") Integer maxItems, @QueryParam("fields")List<String> fields);
|
|
|
|
/**
|
|
* Update a comment
|
|
*
|
|
* Updates an existing comment **commentId** on node **nodeId**.
|
|
*
|
|
*/
|
|
@PUT
|
|
@Path("/nodes/{nodeId}/comments/{commentId}")
|
|
@Consumes({ "application/json" })
|
|
@Produces({ "application/json" })
|
|
@ApiOperation(value = "Update a comment", tags={ })
|
|
@ApiResponses(value = {
|
|
@ApiResponse(code = 200, message = "Successful response", response = CommentEntry.class),
|
|
@ApiResponse(code = 400, message = "Invalid parameter: **commentBodyUpdate** is invalid "),
|
|
@ApiResponse(code = 401, message = "Authentication failed"),
|
|
@ApiResponse(code = 403, message = "User does not have permission to update a comment"),
|
|
@ApiResponse(code = 404, message = "**nodeId** or **commentId** does not exist "),
|
|
@ApiResponse(code = 409, message = "**nodeId** is locked and you are not the lock owner "),
|
|
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
|
public CommentEntry updateComment(@PathParam("nodeId") String nodeId, @PathParam("commentId") String commentId, CommentBody commentBodyUpdate, @QueryParam("fields")List<String> fields);
|
|
}
|
|
|