From 8dd7aafecdce4a39e54e6fd2dc2798d6d5b2181f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Tue, 7 Aug 2018 16:59:44 +0200 Subject: [PATCH] Add missing documentation --- .../api/v2/resources/BranchCollectionResource.java | 11 +++++++++++ .../sonia/scm/api/v2/resources/BranchResource.java | 13 ++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchCollectionResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchCollectionResource.java index 26a7d026bc..daac7fdc28 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchCollectionResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchCollectionResource.java @@ -31,14 +31,25 @@ public class BranchCollectionResource { this.branchCollectionToDtoMapper = branchCollectionToDtoMapper; } + /** + * Returns the branches for a repository. + * + * Note: This method requires "repository" privilege. + * + * @param namespace the namespace of the repository + * @param name the name of the repository + * + */ @GET @Path("") @Produces(VndMediaType.BRANCH_COLLECTION) @TypeHint(CollectionDto.class) @StatusCodes({ @ResponseCode(code = 200, condition = "success"), + @ResponseCode(code = 400, condition = "branches not supported for given repository"), @ResponseCode(code = 401, condition = "not authenticated / invalid credentials"), @ResponseCode(code = 403, condition = "not authorized, the current user does not have the \"group\" privilege"), + @ResponseCode(code = 404, condition = "not found, no repository found for the given namespace and name"), @ResponseCode(code = 500, condition = "internal server error") }) public Response getAll(@PathParam("namespace") String namespace, @PathParam("name") String name) throws IOException, RepositoryException { diff --git a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchResource.java b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchResource.java index f7f2e4d246..9d28fbb31c 100644 --- a/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchResource.java +++ b/scm-webapp/src/main/java/sonia/scm/api/v2/resources/BranchResource.java @@ -31,15 +31,26 @@ public class BranchResource { this.branchToDtoMapper = branchToDtoMapper; } + /** + * Returns a branch for a repository. + * + * Note: This method requires "repository" privilege. + * + * @param namespace the namespace of the repository + * @param name the name of the repository + * @param branchName the name of the branch + * + */ @GET @Path("") @Produces(VndMediaType.BRANCH) @TypeHint(BranchDto.class) @StatusCodes({ @ResponseCode(code = 200, condition = "success"), + @ResponseCode(code = 400, condition = "branches not supported for given repository"), @ResponseCode(code = 401, condition = "not authenticated / invalid credentials"), @ResponseCode(code = 403, condition = "not authorized, the current user has no privileges to read the branch"), - @ResponseCode(code = 404, condition = "not found, no branch with the specified name for the repository available"), + @ResponseCode(code = 404, condition = "not found, no branch with the specified name for the repository available or repository not found"), @ResponseCode(code = 500, condition = "internal server error") }) public Response get(@PathParam("namespace") String namespace, @PathParam("name") String name, @PathParam("branch") String branchName) throws IOException, RepositoryException {