mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
Add javadoc for repository endpoint
This commit is contained in:
@@ -23,6 +23,8 @@ import java.io.IOException;
|
||||
|
||||
public class RepositoryCollectionResource {
|
||||
|
||||
private static final int DEFAULT_PAGE_SIZE = 10;
|
||||
|
||||
private final CollectionResourceManagerAdapter<Repository, RepositoryDto, RepositoryException> adapter;
|
||||
private final RepositoryCollectionToDtoMapper repositoryCollectionToDtoMapper;
|
||||
private final RepositoryDtoToRepositoryMapper dtoToRepositoryMapper;
|
||||
@@ -36,6 +38,16 @@ public class RepositoryCollectionResource {
|
||||
this.resourceLinks = resourceLinks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all repositories for a given page number with a given page size (default page size is {@value DEFAULT_PAGE_SIZE}).
|
||||
*
|
||||
* <strong>Note:</strong> This method requires "repository" privilege.
|
||||
*
|
||||
* @param page the number of the requested page
|
||||
* @param pageSize the page size (default page size is {@value DEFAULT_PAGE_SIZE})
|
||||
* @param sortBy sort parameter (if empty - undefined sorting)
|
||||
* @param desc sort direction desc or asc
|
||||
*/
|
||||
@GET
|
||||
@Path("")
|
||||
@Produces(VndMediaType.REPOSITORY_COLLECTION)
|
||||
@@ -47,13 +59,22 @@ public class RepositoryCollectionResource {
|
||||
@ResponseCode(code = 500, condition = "internal server error")
|
||||
})
|
||||
public Response getAll(@DefaultValue("0") @QueryParam("page") int page,
|
||||
@DefaultValue("10") @QueryParam("pageSize") int pageSize,
|
||||
@DefaultValue("" + DEFAULT_PAGE_SIZE) @QueryParam("pageSize") int pageSize,
|
||||
@QueryParam("sortBy") String sortBy,
|
||||
@DefaultValue("false") @QueryParam("desc") boolean desc) {
|
||||
return adapter.getAll(page, pageSize, sortBy, desc,
|
||||
pageResult -> repositoryCollectionToDtoMapper.map(page, pageSize, pageResult));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new repository.
|
||||
*
|
||||
* <strong>Note:</strong> This method requires "repository" privilege. The namespace of the given repository will
|
||||
* be ignored and set by the configured namespace strategy.
|
||||
*
|
||||
* @param repositoryDto The repository to be created.
|
||||
* @return A response with the link to the new repository (if created successfully).
|
||||
*/
|
||||
@POST
|
||||
@Path("")
|
||||
@Consumes(VndMediaType.REPOSITORY)
|
||||
|
||||
@@ -53,6 +53,15 @@ public class RepositoryResource {
|
||||
this.permissionRootResource = permissionRootResource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a repository.
|
||||
*
|
||||
* <strong>Note:</strong> This method requires "repository" privilege.
|
||||
*
|
||||
* @param namespace the namespace of the repository
|
||||
* @param name the name of the repository
|
||||
*
|
||||
*/
|
||||
@GET
|
||||
@Path("")
|
||||
@Produces(VndMediaType.REPOSITORY)
|
||||
@@ -68,6 +77,15 @@ public class RepositoryResource {
|
||||
return adapter.get(loadBy(namespace, name), repositoryToDtoMapper::map);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a repository.
|
||||
*
|
||||
* <strong>Note:</strong> This method requires "repository" privilege.
|
||||
*
|
||||
* @param namespace the namespace of the repository to delete
|
||||
* @param name the name of the repository to delete
|
||||
*
|
||||
*/
|
||||
@DELETE
|
||||
@Path("")
|
||||
@StatusCodes({
|
||||
@@ -81,6 +99,15 @@ public class RepositoryResource {
|
||||
return adapter.delete(loadBy(namespace, name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Modifies the given repository.
|
||||
*
|
||||
* <strong>Note:</strong> This method requires "repository" privilege.
|
||||
*
|
||||
* @param namespace the namespace of the repository to be modified
|
||||
* @param name the name of the repository to be modified
|
||||
* @param repositoryDto repository object to modify
|
||||
*/
|
||||
@PUT
|
||||
@Path("")
|
||||
@Consumes(VndMediaType.REPOSITORY)
|
||||
|
||||
Reference in New Issue
Block a user