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
bcd63b71
Unverified
Commit
bcd63b71
authored
Feb 07, 2020
by
An Phi
Committed by
GitHub
Feb 07, 2020
Browse files
Add a method to get Pager of commit refs (#506)
parent
0a41a569
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/CommitsApi.java
View file @
bcd63b71
...
@@ -362,7 +362,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -362,7 +362,7 @@ public class CommitsApi extends AbstractApi {
}
}
/**
/**
* Get a
specific commit identified by the commit hash or name of a
branch or tag
as an Optional instance
* Get a
ll references (from
branch
es
or tag
s) a commit is pushed to
*
*
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs</code></pre>
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs</code></pre>
*
*
...
@@ -377,7 +377,23 @@ public class CommitsApi extends AbstractApi {
...
@@ -377,7 +377,23 @@ public class CommitsApi extends AbstractApi {
}
}
/**
/**
* Get a specific commit identified by the commit hash or name of a branch or tag as an Optional instance
* Get all references (from branches or tags) a commit is pushed to
*
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType</code></pre>
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param itemsPerPage the number of Commit instances that will be fetched per page
* @return Get all references (from branches or tags) a commit is pushed to
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @since Gitlab 10.6
*/
public
Pager
<
CommitRef
>
getCommitRefs
(
Object
projectIdOrPath
,
String
sha
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
getCommitRefs
(
projectIdOrPath
,
sha
,
RefType
.
ALL
,
itemsPerPage
));
}
/**
* Get all references (from branches or tags) a commit is pushed to
*
*
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType</code></pre>
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType</code></pre>
*
*
...
@@ -396,6 +412,24 @@ public class CommitsApi extends AbstractApi {
...
@@ -396,6 +412,24 @@ public class CommitsApi extends AbstractApi {
return
(
response
.
readEntity
(
new
GenericType
<
List
<
CommitRef
>>(){}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
CommitRef
>>(){}));
}
}
/**
* Get all references (from branches or tags) a commit is pushed to
*
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/commits/:sha/refs?type=:refType</code></pre>
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param refType the scope of commits. Possible values branch, tag, all. Default is all.
* @param itemsPerPage the number of Commit instances that will be fetched per page
* @return Get all references (from branches or tags) a commit is pushed to
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @since Gitlab 10.6
*/
public
Pager
<
CommitRef
>
getCommitRefs
(
Object
projectIdOrPath
,
String
sha
,
CommitRef
.
RefType
refType
,
int
itemsPerPage
)
throws
GitLabApiException
{
Form
form
=
new
GitLabApiForm
().
withParam
(
"type"
,
refType
);
return
(
new
Pager
<
CommitRef
>(
this
,
CommitRef
.
class
,
itemsPerPage
,
form
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"commits"
,
urlEncode
(
sha
),
"refs"
));
}
/**
/**
* Get a list of repository commit statuses that meet the provided filter.
* Get a list of repository commit statuses that meet the provided filter.
*
*
...
...
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