Add documentation

This commit is contained in:
René Pfeuffer
2018-12-05 17:03:02 +01:00
parent ea35469008
commit 244586e121

View File

@@ -1,5 +1,7 @@
package sonia.scm.api.v2.resources;
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpStatus;
import sonia.scm.repository.NamespaceAndName;
@@ -35,6 +37,13 @@ public class MergeResource {
@Path("")
@Produces(VndMediaType.MERGE_RESULT)
@Consumes(VndMediaType.MERGE_COMMAND)
@StatusCodes({
@ResponseCode(code = 204, condition = "merge has been executed successfully"),
@ResponseCode(code = 401, condition = "not authenticated / invalid credentials"),
@ResponseCode(code = 403, condition = "not authorized, the current user does not have the privilege to write the repository"),
@ResponseCode(code = 409, condition = "The branches could not be merged automatically due to conflicts (conflicting files will be returned)"),
@ResponseCode(code = 500, condition = "internal server error")
})
public Response merge(@PathParam("namespace") String namespace, @PathParam("name") String name, @Valid MergeCommandDto mergeCommand) {
NamespaceAndName namespaceAndName = new NamespaceAndName(namespace, name);
log.info("Merge in Repository {}/{} from {} to {}", namespace, name, mergeCommand.getSourceRevision(), mergeCommand.getTargetRevision());
@@ -50,6 +59,12 @@ public class MergeResource {
@POST
@Path("dry-run/")
@StatusCodes({
@ResponseCode(code = 204, condition = "merge can be done automatically"),
@ResponseCode(code = 401, condition = "not authenticated / invalid credentials"),
@ResponseCode(code = 409, condition = "The branches can not be merged automatically due to conflicts"),
@ResponseCode(code = 500, condition = "internal server error")
})
public Response dryRun(@PathParam("namespace") String namespace, @PathParam("name") String name, @Valid MergeCommandDto mergeCommand) {
NamespaceAndName namespaceAndName = new NamespaceAndName(namespace, name);
log.info("Merge in Repository {}/{} from {} to {}", namespace, name, mergeCommand.getSourceRevision(), mergeCommand.getTargetRevision());