Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
9c92ffab
Commit
9c92ffab
authored
Feb 15, 2017
by
Julien Lafourcade
Browse files
Added new method to repository API to get the archive of the repository
parent
106c088f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/RepositoryApi.java
View file @
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
));
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment