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
f44b8b41
Commit
f44b8b41
authored
May 20, 2015
by
Greg Messner
Browse files
Merge pull request #9 from lonfee88/master
Fixed getTree and added getTree with file_path and ref parameters.
parents
927ea6ad
62309b4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/messners/gitlab/api/RepositoryApi.java
View file @
f44b8b41
...
...
@@ -128,14 +128,33 @@ public class RepositoryApi extends AbstractApi {
* GET /projects/:id/repository/tree
*
* @param projectId
* @return a tree with the directories and files of a project
* @throws GitLabApiException
* @return a tree with the
root
directories and files of a project
* @throws GitLabApiException
*/
public
List
<
TreeItem
>
getTree
(
Integer
projectId
)
throws
GitLabApiException
{
Response
response
=
put
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"repository"
,
"tree"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
TreeItem
>>()
{}));
return
this
.
getTree
(
projectId
,
"/"
,
"master"
);
}
/**
* Get a list of repository files and directories in a project.
*
* GET /projects/:id/repository/tree
*
* id (required) - The ID of a project
* path (optional) - The path inside repository. Used to get contend of subdirectories
* ref_name (optional) - The name of a repository branch or tag or if not given the default branch
* @return a tree with the directories and files of a project
* @throws GitLabApiException
*/
public
List
<
TreeItem
>
getTree
(
Integer
projectId
,
String
filePath
,
String
refName
)
throws
GitLabApiException
{
Form
formData
=
new
Form
();
addFormParam
(
formData
,
"id"
,
projectId
,
true
);
addFormParam
(
formData
,
"path"
,
filePath
,
false
);
addFormParam
(
formData
,
"ref_name"
,
refName
,
false
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"tree"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
TreeItem
>>()
{}));
}
/**
* Get the raw file contents for a file by commit sha and path.
...
...
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