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
ca6542de
Commit
ca6542de
authored
Nov 27, 2018
by
Greg Messner
Browse files
Updated all methods to use projectIdOrPath (#274).
parent
69d1cf7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/CommitsApi.java
View file @
ca6542de
...
@@ -36,12 +36,12 @@ public class CommitsApi extends AbstractApi {
...
@@ -36,12 +36,12 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @return a list containing the commits for the specified project ID
* @return a list containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Commit
>
getCommits
(
in
t
projectId
)
throws
GitLabApiException
{
public
List
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
)
throws
GitLabApiException
{
return
(
getCommits
(
projectId
,
null
,
null
,
null
));
return
(
getCommits
(
projectId
OrPath
,
null
,
null
,
null
));
}
}
/**
/**
...
@@ -49,14 +49,14 @@ public class CommitsApi extends AbstractApi {
...
@@ -49,14 +49,14 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param page the page to get
* @param page the page to get
* @param perPage the number of commits per page
* @param perPage the number of commits per page
* @return a list containing the commits for the specified project ID
* @return a list containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Commit
>
getCommits
(
in
t
projectId
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
return
(
getCommits
(
projectId
,
null
,
null
,
null
,
page
,
perPage
));
return
(
getCommits
(
projectId
OrPath
,
null
,
null
,
null
,
page
,
perPage
));
}
}
/**
/**
...
@@ -64,13 +64,13 @@ public class CommitsApi extends AbstractApi {
...
@@ -64,13 +64,13 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param itemsPerPage the number of Commit instances that will be fetched per page
* @param itemsPerPage the number of Commit instances that will be fetched per page
* @return a Pager containing the commits for the specified project ID
* @return a Pager containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Commit
>
getCommits
(
in
t
projectId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
getCommits
(
projectId
,
null
,
null
,
null
,
itemsPerPage
));
return
(
getCommits
(
projectId
OrPath
,
null
,
null
,
null
,
itemsPerPage
));
}
}
/**
/**
...
@@ -78,20 +78,20 @@ public class CommitsApi extends AbstractApi {
...
@@ -78,20 +78,20 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param ref the name of a repository branch or tag or if not given the default branch
* @param ref the name of a repository branch or tag or if not given the default branch
* @param since only commits after or on this date will be returned
* @param since only commits after or on this date will be returned
* @param until only commits before or on this date will be returned
* @param until only commits before or on this date will be returned
* @return a list containing the commits for the specified project ID
* @return a list containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Commit
>
getCommits
(
in
t
projectId
,
String
ref
,
Date
since
,
Date
until
)
throws
GitLabApiException
{
public
List
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
String
ref
,
Date
since
,
Date
until
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"since"
,
ISO8601
.
toString
(
since
,
false
))
.
withParam
(
"since"
,
ISO8601
.
toString
(
since
,
false
))
.
withParam
(
"until"
,
ISO8601
.
toString
(
until
,
false
))
.
withParam
(
"until"
,
ISO8601
.
toString
(
until
,
false
))
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"commits"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Commit
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Commit
>>()
{}));
}
}
...
@@ -100,7 +100,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -100,7 +100,7 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param ref the name of a repository branch or tag or if not given the default branch
* @param ref the name of a repository branch or tag or if not given the default branch
* @param since only commits after or on this date will be returned
* @param since only commits after or on this date will be returned
* @param until only commits before or on this date will be returned
* @param until only commits before or on this date will be returned
...
@@ -108,14 +108,14 @@ public class CommitsApi extends AbstractApi {
...
@@ -108,14 +108,14 @@ public class CommitsApi extends AbstractApi {
* @return a list containing the commits for the specified project ID
* @return a list containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Commit
>
getCommits
(
in
t
projectId
,
String
ref
,
Date
since
,
Date
until
,
String
path
)
throws
GitLabApiException
{
public
List
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
String
ref
,
Date
since
,
Date
until
,
String
path
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
())
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
())
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"since"
,
ISO8601
.
toString
(
since
,
false
))
.
withParam
(
"since"
,
ISO8601
.
toString
(
since
,
false
))
.
withParam
(
"until"
,
ISO8601
.
toString
(
until
,
false
))
.
withParam
(
"until"
,
ISO8601
.
toString
(
until
,
false
))
.
withParam
(
"path"
,
(
path
==
null
?
null
:
urlEncode
(
path
)));
.
withParam
(
"path"
,
(
path
==
null
?
null
:
urlEncode
(
path
)));
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"commits"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Commit
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Commit
>>()
{}));
}
}
...
@@ -124,18 +124,18 @@ public class CommitsApi extends AbstractApi {
...
@@ -124,18 +124,18 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits?path=:file_path
* GET /projects/:id/repository/commits?path=:file_path
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param ref the name of a repository branch or tag or if not given the default branch
* @param ref the name of a repository branch or tag or if not given the default branch
* @param path the path to file of a project
* @param path the path to file of a project
* @return a list containing the commits for the specified project ID and file
* @return a list containing the commits for the specified project ID and file
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Commit
>
getCommits
(
in
t
projectId
,
String
ref
,
String
path
)
throws
GitLabApiException
{
public
List
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
String
ref
,
String
path
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
())
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
())
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"path"
,
(
path
==
null
?
null
:
urlEncode
(
path
)));
.
withParam
(
"path"
,
(
path
==
null
?
null
:
urlEncode
(
path
)));
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"commits"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Commit
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Commit
>>()
{}));
}
}
...
@@ -144,7 +144,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -144,7 +144,7 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param ref the name of a repository branch or tag or if not given the default branch
* @param ref the name of a repository branch or tag or if not given the default branch
* @param since only commits after or on this date will be returned
* @param since only commits after or on this date will be returned
* @param until only commits before or on this date will be returned
* @param until only commits before or on this date will be returned
...
@@ -153,8 +153,8 @@ public class CommitsApi extends AbstractApi {
...
@@ -153,8 +153,8 @@ public class CommitsApi extends AbstractApi {
* @return a list containing the commits for the specified project ID
* @return a list containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Commit
>
getCommits
(
in
t
projectId
,
String
ref
,
Date
since
,
Date
until
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
String
ref
,
Date
since
,
Date
until
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
return
getCommits
(
projectId
,
ref
,
since
,
until
,
null
,
page
,
perPage
);
return
getCommits
(
projectId
OrPath
,
ref
,
since
,
until
,
null
,
page
,
perPage
);
}
}
/**
/**
...
@@ -162,7 +162,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -162,7 +162,7 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param ref the name of a repository branch or tag or if not given the default branch
* @param ref the name of a repository branch or tag or if not given the default branch
* @param since only commits after or on this date will be returned
* @param since only commits after or on this date will be returned
* @param until only commits before or on this date will be returned
* @param until only commits before or on this date will be returned
...
@@ -172,7 +172,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -172,7 +172,7 @@ public class CommitsApi extends AbstractApi {
* @return a list containing the commits for the specified project ID
* @return a list containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Commit
>
getCommits
(
in
t
projectId
,
String
ref
,
Date
since
,
Date
until
,
String
path
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
public
List
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
String
ref
,
Date
since
,
Date
until
,
String
path
,
int
page
,
int
perPage
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"since"
,
ISO8601
.
toString
(
since
,
false
))
.
withParam
(
"since"
,
ISO8601
.
toString
(
since
,
false
))
...
@@ -180,7 +180,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -180,7 +180,7 @@ public class CommitsApi extends AbstractApi {
.
withParam
(
"path"
,
(
path
==
null
?
null
:
urlEncode
(
path
)))
.
withParam
(
"path"
,
(
path
==
null
?
null
:
urlEncode
(
path
)))
.
withParam
(
PAGE_PARAM
,
page
)
.
withParam
(
PAGE_PARAM
,
page
)
.
withParam
(
PER_PAGE_PARAM
,
perPage
);
.
withParam
(
PER_PAGE_PARAM
,
perPage
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"commits"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Commit
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Commit
>>()
{}));
}
}
...
@@ -189,7 +189,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -189,7 +189,7 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param ref the name of a repository branch or tag or if not given the default branch
* @param ref the name of a repository branch or tag or if not given the default branch
* @param since only commits after or on this date will be returned
* @param since only commits after or on this date will be returned
* @param until only commits before or on this date will be returned
* @param until only commits before or on this date will be returned
...
@@ -197,8 +197,8 @@ public class CommitsApi extends AbstractApi {
...
@@ -197,8 +197,8 @@ public class CommitsApi extends AbstractApi {
* @return a Pager containing the commits for the specified project ID
* @return a Pager containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Commit
>
getCommits
(
in
t
projectId
,
String
ref
,
Date
since
,
Date
until
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
String
ref
,
Date
since
,
Date
until
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
getCommits
(
projectId
,
ref
,
since
,
until
,
null
,
itemsPerPage
);
return
getCommits
(
projectId
OrPath
,
ref
,
since
,
until
,
null
,
itemsPerPage
);
}
}
/**
/**
...
@@ -206,7 +206,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -206,7 +206,7 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits
* GET /projects/:id/repository/commits
*
*
* @param projectId the project
ID to get the list of commits for
* @param projectId
OrPath
the project
in the form of an Integer(ID), String(path), or Project instance
* @param ref the name of a repository branch or tag or if not given the default branch
* @param ref the name of a repository branch or tag or if not given the default branch
* @param since only commits after or on this date will be returned
* @param since only commits after or on this date will be returned
* @param until only commits before or on this date will be returned
* @param until only commits before or on this date will be returned
...
@@ -215,13 +215,13 @@ public class CommitsApi extends AbstractApi {
...
@@ -215,13 +215,13 @@ public class CommitsApi extends AbstractApi {
* @return a Pager containing the commits for the specified project ID
* @return a Pager containing the commits for the specified project ID
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Commit
>
getCommits
(
in
t
projectId
,
String
ref
,
Date
since
,
Date
until
,
String
path
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Commit
>
getCommits
(
Objec
t
projectId
OrPath
,
String
ref
,
Date
since
,
Date
until
,
String
path
,
int
itemsPerPage
)
throws
GitLabApiException
{
Form
formData
=
new
GitLabApiForm
()
Form
formData
=
new
GitLabApiForm
()
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"ref_name"
,
ref
)
.
withParam
(
"since"
,
ISO8601
.
toString
(
since
,
false
))
.
withParam
(
"since"
,
ISO8601
.
toString
(
since
,
false
))
.
withParam
(
"until"
,
ISO8601
.
toString
(
until
,
false
))
.
withParam
(
"until"
,
ISO8601
.
toString
(
until
,
false
))
.
withParam
(
"path"
,
(
path
==
null
?
null
:
urlEncode
(
path
)));
.
withParam
(
"path"
,
(
path
==
null
?
null
:
urlEncode
(
path
)));
return
(
new
Pager
<
Commit
>(
this
,
Commit
.
class
,
itemsPerPage
,
formData
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"commits"
));
return
(
new
Pager
<
Commit
>(
this
,
Commit
.
class
,
itemsPerPage
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
));
}
}
/**
/**
...
@@ -229,13 +229,13 @@ public class CommitsApi extends AbstractApi {
...
@@ -229,13 +229,13 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits/:sha
* GET /projects/:id/repository/commits/:sha
*
*
* @param projectId the project
ID
th
at the commit belongs to
* @param projectId
OrPath
the project
in
th
e form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param sha a commit hash or name of a branch or tag
* @return the Commit instance for the specified project ID/sha pair
* @return the Commit instance for the specified project ID/sha pair
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
Commit
getCommit
(
in
t
projectId
,
String
sha
)
throws
GitLabApiException
{
public
Commit
getCommit
(
Objec
t
projectId
OrPath
,
String
sha
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
projectId
,
"repository"
,
"commits"
,
sha
);
Response
response
=
get
(
Response
.
Status
.
OK
,
getDefaultPerPageParam
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
,
sha
);
return
(
response
.
readEntity
(
Commit
.
class
));
return
(
response
.
readEntity
(
Commit
.
class
));
}
}
...
@@ -244,13 +244,13 @@ public class CommitsApi extends AbstractApi {
...
@@ -244,13 +244,13 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits/:sha
* GET /projects/:id/repository/commits/:sha
*
*
* @param projectId the project
ID
th
at the commit belongs to
* @param projectId
OrPath
the project
in
th
e form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param sha a commit hash or name of a branch or tag
* @return the Commit for the specified project ID/sha pair as an Optional instance
* @return the Commit for the specified project ID/sha pair as an Optional instance
*/
*/
public
Optional
<
Commit
>
getOptionalCommit
(
in
t
projectId
,
String
sha
)
{
public
Optional
<
Commit
>
getOptionalCommit
(
Objec
t
projectId
OrPath
,
String
sha
)
{
try
{
try
{
return
(
Optional
.
ofNullable
(
getCommit
(
projectId
,
sha
)));
return
(
Optional
.
ofNullable
(
getCommit
(
projectId
OrPath
,
sha
)));
}
catch
(
GitLabApiException
glae
)
{
}
catch
(
GitLabApiException
glae
)
{
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
return
(
GitLabApi
.
createOptionalFromException
(
glae
));
}
}
...
@@ -261,14 +261,14 @@ public class CommitsApi extends AbstractApi {
...
@@ -261,14 +261,14 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits/:sha/refs
* GET /projects/:id/repository/commits/:sha/refs
*
*
* @param projectId the project
ID
th
at the commit belongs to
* @param projectId
OrPath
the project
in
th
e form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param sha a commit hash or name of a branch or tag
* @return Get all references (from branches or tags) a commit is pushed to
* @return Get all references (from branches or tags) a commit is pushed to
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @since Gitlab 10.6
* @since Gitlab 10.6
*/
*/
public
List
<
CommitRef
>
getCommitRefs
(
in
t
projectId
,
String
sha
)
throws
GitLabApiException
{
public
List
<
CommitRef
>
getCommitRefs
(
Objec
t
projectId
OrPath
,
String
sha
)
throws
GitLabApiException
{
return
getCommitRefs
(
projectId
,
sha
,
RefType
.
ALL
);
return
getCommitRefs
(
projectId
OrPath
,
sha
,
RefType
.
ALL
);
}
}
/**
/**
...
@@ -276,18 +276,18 @@ public class CommitsApi extends AbstractApi {
...
@@ -276,18 +276,18 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits/:sha/refs?type=:refType
* GET /projects/:id/repository/commits/:sha/refs?type=:refType
*
*
* @param projectId the project
ID
th
at the commit belongs to
* @param projectId
OrPath
the project
in
th
e form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @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 refType the scope of commits. Possible values branch, tag, all. Default is all.
* @return Get all references (from branches or tags) a commit is pushed to
* @return Get all references (from branches or tags) a commit is pushed to
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @since Gitlab 10.6
* @since Gitlab 10.6
*/
*/
public
List
<
CommitRef
>
getCommitRefs
(
in
t
projectId
,
String
sha
,
CommitRef
.
RefType
refType
)
throws
GitLabApiException
{
public
List
<
CommitRef
>
getCommitRefs
(
Objec
t
projectId
OrPath
,
String
sha
,
CommitRef
.
RefType
refType
)
throws
GitLabApiException
{
Form
form
=
new
GitLabApiForm
()
Form
form
=
new
GitLabApiForm
()
.
withParam
(
"type"
,
refType
)
.
withParam
(
"type"
,
refType
)
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
.
withParam
(
PER_PAGE_PARAM
,
getDefaultPerPage
());
Response
response
=
get
(
Response
.
Status
.
OK
,
form
.
asMap
(),
"projects"
,
projectId
,
"repository"
,
"commits"
,
sha
,
"refs"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
form
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
,
sha
,
"refs"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
CommitRef
>>(){}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
CommitRef
>>(){}));
}
}
...
@@ -370,35 +370,13 @@ public class CommitsApi extends AbstractApi {
...
@@ -370,35 +370,13 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits/:sha/diff
* GET /projects/:id/repository/commits/:sha/diff
*
*
* @param projectId the project ID that the commit belongs to
* @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
* @return a List of Diff instances for the specified project ID/sha pair
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
public
List
<
Diff
>
getDiff
(
int
projectId
,
String
sha
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"repository"
,
"commits"
,
sha
,
"diff"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Diff
>>()
{}));
}
/**
* Get the list of diffs of a commit in a project.
*
* GET /projects/:id/repository/commits/:sha/diff
*
* @param projectPath the project path that the commit belongs to
* @param sha a commit hash or name of a branch or tag
* @param sha a commit hash or name of a branch or tag
* @return a List of Diff instances for the specified project ID/sha pair
* @return a List of Diff instances for the specified project ID/sha pair
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Diff
>
getDiff
(
String
projectPath
,
String
sha
)
throws
GitLabApiException
{
public
List
<
Diff
>
getDiff
(
Object
projectIdOrPath
,
String
sha
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"commits"
,
sha
,
"diff"
);
try
{
projectPath
=
URLEncoder
.
encode
(
projectPath
,
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
uee
)
{
throw
(
new
GitLabApiException
(
uee
));
}
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectPath
,
"repository"
,
"commits"
,
sha
,
"diff"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Diff
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Diff
>>()
{}));
}
}
...
@@ -407,13 +385,13 @@ public class CommitsApi extends AbstractApi {
...
@@ -407,13 +385,13 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits/:sha/comments
* GET /projects/:id/repository/commits/:sha/comments
*
*
* @param projectId the project
ID
th
at the commit belongs to
* @param projectId
OrPath
the project
in
th
e form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param sha a commit hash or name of a branch or tag
* @return a List of Comment instances for the specified project ID/sha pair
* @return a List of Comment instances for the specified project ID/sha pair
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Comment
>
getComments
(
in
t
projectId
,
String
sha
)
throws
GitLabApiException
{
public
List
<
Comment
>
getComments
(
Objec
t
projectId
OrPath
,
String
sha
)
throws
GitLabApiException
{
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
projectId
,
"repository"
,
"commits"
,
sha
,
"comments"
);
Response
response
=
get
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
,
sha
,
"comments"
);
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Comment
>>()
{}));
return
(
response
.
readEntity
(
new
GenericType
<
List
<
Comment
>>()
{}));
}
}
...
@@ -422,14 +400,14 @@ public class CommitsApi extends AbstractApi {
...
@@ -422,14 +400,14 @@ public class CommitsApi extends AbstractApi {
*
*
* GET /projects/:id/repository/commits/:sha/comments
* GET /projects/:id/repository/commits/:sha/comments
*
*
* @param projectId the project
ID
th
at the commit belongs to
* @param projectId
OrPath
the project
in
th
e form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param sha a commit hash or name of a branch or tag
* @param itemsPerPage the number of Comment instances that will be fetched per page
* @param itemsPerPage the number of Comment instances that will be fetched per page
* @return a List of Comment instances for the specified project ID/sha pair
* @return a List of Comment instances for the specified project ID/sha pair
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Comment
>
getComments
(
in
t
projectId
,
String
sha
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Comment
>
getComments
(
Objec
t
projectId
OrPath
,
String
sha
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
new
Pager
<
Comment
>(
this
,
Comment
.
class
,
itemsPerPage
,
null
,
"projects"
,
projectId
,
"repository"
,
"commits"
,
sha
,
"comments"
);
return
new
Pager
<
Comment
>(
this
,
Comment
.
class
,
itemsPerPage
,
null
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
,
sha
,
"comments"
);
}
}
/**
/**
...
@@ -438,7 +416,7 @@ public class CommitsApi extends AbstractApi {
...
@@ -438,7 +416,7 @@ public class CommitsApi extends AbstractApi {
*
*
* POST /projects/:id/repository/commits/:sha/comments
* POST /projects/:id/repository/commits/:sha/comments
*
*
* @param projectId the project
ID
th
at the commit belongs to
* @param projectId
OrPath
the project
in
th
e form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param sha a commit hash or name of a branch or tag
* @param note the text of the comment, required
* @param note the text of the comment, required
* @param path the file path relative to the repository, optional
* @param path the file path relative to the repository, optional
...
@@ -447,13 +425,13 @@ public class CommitsApi extends AbstractApi {
...
@@ -447,13 +425,13 @@ public class CommitsApi extends AbstractApi {
* @return a Comment instance for the posted comment
* @return a Comment instance for the posted comment
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
Comment
addComment
(
in
t
projectId
,
String
sha
,
String
note
,
String
path
,
Integer
line
,
LineType
lineType
)
throws
GitLabApiException
{
public
Comment
addComment
(
Objec
t
projectId
OrPath
,
String
sha
,
String
note
,
String
path
,
Integer
line
,
LineType
lineType
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
()
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"note"
,
note
,
true
)
.
withParam
(
"note"
,
note
,
true
)
.
withParam
(
"path"
,
path
)
.
withParam
(
"path"
,
path
)
.
withParam
(
"line"
,
line
)
.
withParam
(
"line"
,
line
)
.
withParam
(
"line_type"
,
lineType
);
.
withParam
(
"line_type"
,
lineType
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"repository"
,
"commits"
,
sha
,
"comments"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectId
OrPath
)
,
"repository"
,
"commits"
,
sha
,
"comments"
);
return
(
response
.
readEntity
(
Comment
.
class
));
return
(
response
.
readEntity
(
Comment
.
class
));
}
}
...
@@ -462,14 +440,14 @@ public class CommitsApi extends AbstractApi {
...
@@ -462,14 +440,14 @@ public class CommitsApi extends AbstractApi {
*
*
* POST /projects/:id/repository/commits/:sha/comments
* POST /projects/:id/repository/commits/:sha/comments
*
*
* @param projectId the project
ID
th
at the commit belongs to
* @param projectId
OrPath
the project
in
th
e form of an Integer(ID), String(path), or Project instance
* @param sha a commit hash or name of a branch or tag
* @param sha a commit hash or name of a branch or tag
* @param note the text of the comment, required
* @param note the text of the comment, required
* @return a Comment instance for the posted comment
* @return a Comment instance for the posted comment
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
*/
public
Comment
addComment
(
in
t
projectId
,
String
sha
,
String
note
)
throws
GitLabApiException
{
public
Comment
addComment
(
Objec
t
projectId
OrPath
,
String
sha
,
String
note
)
throws
GitLabApiException
{
return
(
addComment
(
projectId
,
sha
,
note
,
null
,
null
,
null
));
return
(
addComment
(
projectId
OrPath
,
sha
,
note
,
null
,
null
,
null
));
}
}
/**
/**
...
...
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