public class

ArchiveRequest

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

Class Overview

Describes a request to download an archive of a given repository at a specified commit, optionally filtered to only include certain paths.

Summary

Nested Classes
class ArchiveRequest.Builder  
Public Methods
@Nonnull String getCommitId()
@Nonnull ArchiveFormat getFormat()
Retrieves the format to create the archive in.
@Nonnull Set<String> getPaths()
Retrieves a set of paths to filter the archive by.
@Nonnull Optional<String> getPrefix()
Retrieves a prefix to apply to each entry in the archive.
@Nonnull Repository getRepository()
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

@Nonnull public String getCommitId ()

Returns

@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

@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

@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

@Nonnull public Repository getRepository ()

Returns
  • the repository to archive