213 lines
15 KiB
Java
213 lines
15 KiB
Java
package com.inteligr8.alfresco.acs.api;
|
||
|
||
import com.inteligr8.alfresco.acs.model.Error;
|
||
import com.inteligr8.alfresco.acs.model.RenditionEntry;
|
||
import com.inteligr8.alfresco.acs.model.RenditionPaging;
|
||
import com.inteligr8.alfresco.acs.model.SharedLinkBodyCreate;
|
||
import com.inteligr8.alfresco.acs.model.SharedLinkBodyEmail;
|
||
import com.inteligr8.alfresco.acs.model.SharedLinkEntry;
|
||
import com.inteligr8.alfresco.acs.model.SharedLinkPaging;
|
||
import io.swagger.annotations.Api;
|
||
import io.swagger.annotations.ApiOperation;
|
||
import io.swagger.annotations.ApiResponse;
|
||
import io.swagger.annotations.ApiResponses;
|
||
import java.io.File;
|
||
import java.util.Date;
|
||
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 SharedLinksApi {
|
||
|
||
/**
|
||
* Create a shared link to a file
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Create a shared link to the file **nodeId** in the request body. Also, an optional expiry date could be set, so the shared link would become invalid when the expiry date is reached. For example: ```JSON { \"nodeId\": \"1ff9da1a-ee2f-4b9c-8c34-3333333333\", \"expiresAt\": \"2017-03-23T23:00:00.000+0000\" } ``` **Note:** You can create shared links to more than one file specifying a list of **nodeId**s in the JSON body like this: ```JSON [ { \"nodeId\": \"1ff9da1a-ee2f-4b9c-8c34-4444444444\" }, { \"nodeId\": \"1ff9da1a-ee2f-4b9c-8c34-5555555555\" } ] ``` 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("/shared-links")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/json" })
|
||
@ApiOperation(value = "Create a shared link to a file", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 200, message = "Successful response", response = SharedLinkEntry.class),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: **nodeId** is not a valid format, or does not identify a file, or **sharedLinkBodyCreate** invalid, or the specified expiry date is invalid. E.g. the expiry date has already passed "),
|
||
@ApiResponse(code = 401, message = "Authentication failed"),
|
||
@ApiResponse(code = 403, message = "Current user does not have permission to create **sharedId** (for example, no read permission)"),
|
||
@ApiResponse(code = 404, message = "**nodeId** does not exist "),
|
||
@ApiResponse(code = 409, message = "Shared link already exists for **nodeId**"),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public SharedLinkEntry createSharedLink(SharedLinkBodyCreate sharedLinkBodyCreate, @QueryParam("include")List<String> include, @QueryParam("fields")List<String> fields);
|
||
|
||
/**
|
||
* Deletes a shared link
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Deletes the shared link with identifier **sharedId**.
|
||
*
|
||
*/
|
||
@DELETE
|
||
@Path("/shared-links/{sharedId}")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/json" })
|
||
@ApiOperation(value = "Deletes a shared link", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 204, message = "Successful response"),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: **sharedId** is not a valid format "),
|
||
@ApiResponse(code = 401, message = "Authentication failed"),
|
||
@ApiResponse(code = 403, message = "Current user does not have permission to delete **sharedId**"),
|
||
@ApiResponse(code = 404, message = "**sharedId** does not exist "),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public void deleteSharedLink(@PathParam("sharedId") String sharedId);
|
||
|
||
/**
|
||
* Email shared link
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Sends email with app-specific url including identifier **sharedId**. The client and recipientEmails properties are mandatory in the request body. For example, to email a shared link with minimum info: ```JSON { \"client\": \"myClient\", \"recipientEmails\": [\"john.doe@acme.com\", \"joe.bloggs@acme.com\"] } ``` A plain text message property can be optionally provided in the request body to customise the sent email. Also, a locale property can be optionally provided in the request body to send the emails in a particular language (if the locale is supported by Alfresco). For example, to email a shared link with a messages and a locale: ```JSON { \"client\": \"myClient\", \"recipientEmails\": [\"john.doe@acme.com\", \"joe.bloggs@acme.com\"], \"message\": \"myMessage\", \"locale\":\"en-GB\" } ``` **Note:** The client must be registered before you can send a shared link email. See [server documentation]. However, out-of-the-box share is registered as a default client, so you could pass **share** as the client name: ```JSON { \"client\": \"share\", \"recipientEmails\": [\"john.doe@acme.com\"] } ```
|
||
*
|
||
*/
|
||
@POST
|
||
@Path("/shared-links/{sharedId}/email")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/json" })
|
||
@ApiOperation(value = "Email shared link", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 202, message = "Successful response"),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: **sharedId** is not a valid format or **sharedLinkBodyEmail** invalid "),
|
||
@ApiResponse(code = 401, message = "Authentication failed"),
|
||
@ApiResponse(code = 404, message = "**sharedId** does not exist or **client** is not registered "),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public void emailSharedLink(@PathParam("sharedId") String sharedId, SharedLinkBodyEmail sharedLinkBodyEmail);
|
||
|
||
/**
|
||
* Get a shared link
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Gets minimal information for the file with shared link identifier **sharedId**. **Note:** No authentication is required to call this endpoint.
|
||
*
|
||
*/
|
||
@GET
|
||
@Path("/shared-links/{sharedId}")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/json" })
|
||
@ApiOperation(value = "Get a shared link", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 200, message = "Successful response", response = SharedLinkEntry.class),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: **sharedId** is not a valid format "),
|
||
@ApiResponse(code = 404, message = "**sharedId** does not exist "),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public SharedLinkEntry getSharedLink(@PathParam("sharedId") String sharedId, @QueryParam("fields")List<String> fields);
|
||
|
||
/**
|
||
* Get shared link content
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Gets the content of the file with shared link identifier **sharedId**. **Note:** No authentication is required to call this endpoint.
|
||
*
|
||
*/
|
||
@GET
|
||
@Path("/shared-links/{sharedId}/content")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/octet-stream" })
|
||
@ApiOperation(value = "Get shared link content", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 200, message = "Successful response", response = File.class),
|
||
@ApiResponse(code = 206, message = "Partial Content"),
|
||
@ApiResponse(code = 304, message = "Content has not been modified since the date provided in the If-Modified-Since header"),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: **sharedId** is not a valid format "),
|
||
@ApiResponse(code = 404, message = "**sharedId** does not exist "),
|
||
@ApiResponse(code = 416, message = "Range Not Satisfiable"),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public File getSharedLinkContent(@PathParam("sharedId") String sharedId, @QueryParam("attachment")@DefaultValue("true") Boolean attachment, @HeaderParam("If-Modified-Since") Date ifModifiedSince, @HeaderParam("Range") String range);
|
||
|
||
/**
|
||
* Get shared link rendition information
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Gets rendition information for the file with shared link identifier **sharedId**. This API method returns rendition information where the rendition status is CREATED, which means the rendition is available to view/download. **Note:** No authentication is required to call this endpoint.
|
||
*
|
||
*/
|
||
@GET
|
||
@Path("/shared-links/{sharedId}/renditions/{renditionId}")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/json" })
|
||
@ApiOperation(value = "Get shared link rendition information", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 200, message = "Successful response", response = RenditionEntry.class),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: **sharedId** is not a valid format, or **renditionId** is invalid "),
|
||
@ApiResponse(code = 404, message = "**sharedId** or **renditionId** does not exist (ie. not CREATED) "),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public RenditionEntry getSharedLinkRendition(@PathParam("sharedId") String sharedId, @PathParam("renditionId") String renditionId);
|
||
|
||
/**
|
||
* Get shared link rendition content
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Gets the rendition content for file with shared link identifier **sharedId**. **Note:** No authentication is required to call this endpoint.
|
||
*
|
||
*/
|
||
@GET
|
||
@Path("/shared-links/{sharedId}/renditions/{renditionId}/content")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/octet-stream" })
|
||
@ApiOperation(value = "Get shared link rendition content", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 200, message = "Successful response", response = File.class),
|
||
@ApiResponse(code = 206, message = "Partial Content"),
|
||
@ApiResponse(code = 304, message = "Content has not been modified since the date provided in the If-Modified-Since header"),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: **sharedId** is not a valid format, or **renditionId** is invalid "),
|
||
@ApiResponse(code = 404, message = "**sharedId** does not exist "),
|
||
@ApiResponse(code = 416, message = "Range Not Satisfiable"),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public File getSharedLinkRenditionContent(@PathParam("sharedId") String sharedId, @PathParam("renditionId") String renditionId, @QueryParam("attachment")@DefaultValue("true") Boolean attachment, @HeaderParam("If-Modified-Since") Date ifModifiedSince, @HeaderParam("Range") String range);
|
||
|
||
/**
|
||
* List renditions for a shared link
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Gets a list of the rendition information for the file with shared link identifier **sharedId**. This API method returns rendition information, including the rendition id, for each rendition where the rendition status is CREATED, which means the rendition is available to view/download. **Note:** No authentication is required to call this endpoint.
|
||
*
|
||
*/
|
||
@GET
|
||
@Path("/shared-links/{sharedId}/renditions")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/json" })
|
||
@ApiOperation(value = "List renditions for a shared link", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 200, message = "Successful response", response = RenditionPaging.class),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: **sharedId** is not a valid format "),
|
||
@ApiResponse(code = 404, message = "**sharedId** does not exist "),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public RenditionPaging listSharedLinkRenditions(@PathParam("sharedId") String sharedId);
|
||
|
||
/**
|
||
* List shared links
|
||
*
|
||
* **Note:** this endpoint is available in Alfresco 5.2 and newer versions. Get a list of links that the current user has read permission on source node. The list is ordered in descending modified order. **Note:** The list of links is eventually consistent so newly created shared links may not appear immediately.
|
||
*
|
||
*/
|
||
@GET
|
||
@Path("/shared-links")
|
||
@Consumes({ "application/json" })
|
||
@Produces({ "application/json" })
|
||
@ApiOperation(value = "List shared links", tags={ })
|
||
@ApiResponses(value = {
|
||
@ApiResponse(code = 200, message = "Successful response", response = SharedLinkPaging.class),
|
||
@ApiResponse(code = 400, message = "Invalid parameter: value of **maxItems** or **skipCount** is invalid "),
|
||
@ApiResponse(code = 401, message = "Authentication failed"),
|
||
@ApiResponse(code = 501, message = "Shared links are disabled for the system"),
|
||
@ApiResponse(code = 200, message = "Unexpected error", response = Error.class) })
|
||
public SharedLinkPaging listSharedLinks(@QueryParam("skipCount")@DefaultValue("0") Integer skipCount, @QueryParam("maxItems")@DefaultValue("100") Integer maxItems, @QueryParam("where")String where, @QueryParam("include")List<String> include, @QueryParam("fields")List<String> fields);
|
||
}
|
||
|