Commit 0de19add authored by Greg Messner's avatar Greg Messner Committed by GitHub
Browse files

Merge pull request #15 from jlafourc/add-get-repository-archive

Added new method to repository API to get the archive of the repository
parents 106c088f 9c92ffab
package com.messners.gitlab.api; package com.messners.gitlab.api;
import java.io.InputStream;
import java.util.List; import java.util.List;
import javax.ws.rs.core.Form; import javax.ws.rs.core.Form;
...@@ -220,4 +221,22 @@ public class RepositoryApi extends AbstractApi { ...@@ -220,4 +221,22 @@ public class RepositoryApi extends AbstractApi {
Response response = get(Response.Status.OK, null, "projects", projectId, "repository", "raw_blobs", sha); Response response = get(Response.Status.OK, null, "projects", projectId, "repository", "raw_blobs", sha);
return (response.readEntity(String.class)); return (response.readEntity(String.class));
} }
/**
* Get an archive of the complete repository by SHA (optional).
*
* GET /projects/:id/repository/archive
*
* @param projectId
* @param sha
* @return an input stream that can be used to save as a file
* or to read the content of the archive
* @throws GitLabApiException
*/
public InputStream getRepositoryArchive(Integer projectId, String sha) throws GitLabApiException {
Form formData = new Form();
addFormParam(formData, "sha", sha, false);
Response response = get(Response.Status.OK, formData.asMap(), "projects", projectId, "repository", "archive");
return (response.readEntity(InputStream.class));
}
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment