Class ArchiveRequest

java.lang.Object
com.atlassian.bitbucket.content.ArchiveRequest

public class ArchiveRequest extends Object
Describes a request to download an archive of a given repository at a specified commit, optionally filtered to only include certain paths.
Since:
5.1
  • Method Details

    • getCommitId

      @Nonnull public String getCommitId()
      Returns:
      the commit to archive, which may be identified by branch ID, tag ID or commit ID
    • getFormat

      @Nonnull public ArchiveFormat getFormat()
      Retrieves the format to create the archive in. The underlying SCM may support additional types, but every SCM which supports archives is required to support every standard format.
      Returns:
      the format to create the archive in
    • getPaths

      @Nonnull public Set<String> getPaths()
      Retrieves a set of paths to filter the archive by. The exact approach to filtering by path is SCM-specific, and SCM implementations are not required to support filtering if the underlying SCM doesn't.
      Returns:
      a set of paths to filter the archive by, which may be empty but never null
    • getPrefix

      @Nonnull public Optional<String> getPrefix()
      Retrieves a prefix to apply to each entry in the archive. If a prefix is supplied, it will be prepended to all archived files and folders.

      Since the most common use case for a prefix is to add a top-level folder to the archive, if the prefix supplied did not end with a /, one is added automatically. Otherwise, the prefix is not considered a top-level directory; instead it modifies the file names. For example, consider a repository containing the following files and folders:

       src/
         main/
           java/
             Example.java
       pom.xml
       README.md
       
      A prefix of "example" would result in an archive containing:
       examplesrc/
         main/
           java/
             Example.java
       examplepom.xml
       exampleREADME.md
       
      While a prefix of "example/" would result in:
       example/
         src/
           main/
             java/
               Example.java
         pom.xml
         README.md
       
      The prefix is normalized to add a trailing / to always produce the latter output.
      Returns:
      an optional prefix to prepend to the archive's contents, which may be empty but never null
    • getRepository

      @Nonnull public Repository getRepository()
      Returns:
      the repository to archive