This commit is contained in:
René Pfeuffer
2018-07-05 10:45:16 +02:00
parent c2effbe9c5
commit 92bd8696be

View File

@@ -10,6 +10,7 @@ import sonia.scm.web.VndMediaType;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Provider; import javax.inject.Provider;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE; import javax.ws.rs.DELETE;
import javax.ws.rs.GET; import javax.ws.rs.GET;
import javax.ws.rs.PUT; import javax.ws.rs.PUT;
@@ -80,6 +81,16 @@ public class RepositoryResource {
@PUT @PUT
@Path("") @Path("")
@Consumes(VndMediaType.REPOSITORY)
@StatusCodes({
@ResponseCode(code = 204, condition = "update success"),
@ResponseCode(code = 400, condition = "Invalid body, e.g. illegal change of namespace or name"),
@ResponseCode(code = 401, condition = "not authenticated / invalid credentials"),
@ResponseCode(code = 403, condition = "not authorized, the current user does not have the \"repository\" privilege"),
@ResponseCode(code = 404, condition = "not found, no repository with the specified namespace and name available"),
@ResponseCode(code = 500, condition = "internal server error")
})
@TypeHint(TypeHint.NO_CONTENT.class)
public Response update(@PathParam("namespace") String namespace, @PathParam("name") String name, RepositoryDto repositoryDto) { public Response update(@PathParam("namespace") String namespace, @PathParam("name") String name, RepositoryDto repositoryDto) {
return adapter.update(() -> manager.getByNamespace(namespace, name), existing -> { return adapter.update(() -> manager.getByNamespace(namespace, name), existing -> {
Repository repository = dtoToRepositoryMapper.map(repositoryDto); Repository repository = dtoToRepositoryMapper.map(repositoryDto);