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
d0a7d1b5
Commit
d0a7d1b5
authored
Feb 07, 2019
by
Greg Messner
Browse files
Added support for creating and resolving merge request discussions (#291).
parent
0e8f58f2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/DiscussionsApi.java
View file @
d0a7d1b5
package
org.gitlab4j.api
;
package
org.gitlab4j.api
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Stream
;
import
java.util.stream.Stream
;
...
@@ -7,6 +8,7 @@ import javax.ws.rs.core.GenericType;
...
@@ -7,6 +8,7 @@ import javax.ws.rs.core.GenericType;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
org.gitlab4j.api.models.Discussion
;
import
org.gitlab4j.api.models.Discussion
;
import
org.gitlab4j.api.models.Position
;
/**
/**
* This class implements the client side API for the GitLab Discussions API.
* This class implements the client side API for the GitLab Discussions API.
...
@@ -22,12 +24,12 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -22,12 +24,12 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of all discussions for the specified issue.
* Get a list of all discussions for the specified issue.
*
*
* GET /projects/:id/issues/:issue_iid/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/issues/:issue_iid/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param issueIid the internal ID of the issue
* @param issueIid the internal ID of the issue
* @return a list containing all the discussions for the specified issue
* @return a list containing all the discussions for the specified issue
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getIssueDiscussions
(
Object
projectIdOrPath
,
Integer
issueIid
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getIssueDiscussions
(
Object
projectIdOrPath
,
Integer
issueIid
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getIssueDiscussionsPager
(
projectIdOrPath
,
issueIid
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getIssueDiscussionsPager
(
projectIdOrPath
,
issueIid
,
getDefaultPerPage
());
...
@@ -37,13 +39,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -37,13 +39,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of discussions for the specified issue.
* Get a list of discussions for the specified issue.
*
*
* GET /projects/:id/issues/:issue_iid/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/issues/:issue_iid/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param issueIid the internal ID of the issue
* @param issueIid the internal ID of the issue
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the issue
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the issue
* @return a list containing the discussions for the specified issue
* @return a list containing the discussions for the specified issue
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getIssueDiscussions
(
Object
projectIdOrPath
,
Integer
issueIid
,
int
maxItems
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getIssueDiscussions
(
Object
projectIdOrPath
,
Integer
issueIid
,
int
maxItems
)
throws
GitLabApiException
{
if
(
maxItems
<
1
)
{
if
(
maxItems
<
1
)
{
...
@@ -58,13 +60,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -58,13 +60,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Pager of Discussion instances for the specified issue.
* Get a Pager of Discussion instances for the specified issue.
*
*
* GET /projects/:id/issues/:issue_iid/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/issues/:issue_iid/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param issueIid the internal ID of the issue
* @param issueIid the internal ID of the issue
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @return a Pager containing the Discussion instances for the specified issue
* @return a Pager containing the Discussion instances for the specified issue
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Discussion
>
getIssueDiscussionsPager
(
Object
projectIdOrPath
,
Integer
issueIid
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Discussion
>
getIssueDiscussionsPager
(
Object
projectIdOrPath
,
Integer
issueIid
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
...
@@ -74,12 +76,12 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -74,12 +76,12 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Stream of Discussion instances for the specified issue.
* Get a Stream of Discussion instances for the specified issue.
*
*
* GET /projects/:id/issues/:issue_iid/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/issues/:issue_iid/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param issueIid the internal ID of the issue
* @param issueIid the internal ID of the issue
* @return a Stream instance containing the Discussion instances for the specified issue
* @return a Stream instance containing the Discussion instances for the specified issue
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Stream
<
Discussion
>
getIssueDiscussionsStream
(
Object
projectIdOrPath
,
Integer
issueIid
)
throws
GitLabApiException
{
public
Stream
<
Discussion
>
getIssueDiscussionsStream
(
Object
projectIdOrPath
,
Integer
issueIid
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getIssueDiscussionsPager
(
projectIdOrPath
,
issueIid
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getIssueDiscussionsPager
(
projectIdOrPath
,
issueIid
,
getDefaultPerPage
());
...
@@ -89,12 +91,12 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -89,12 +91,12 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of all discussions for the specified snippet.
* Get a list of all discussions for the specified snippet.
*
*
* GET /projects/:id/snippets/:snippet_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/snippets/:snippet_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param snippetId the ID of the snippet
* @param snippetId the ID of the snippet
* @return a list containing all the discussions for the specified snippet
* @return a list containing all the discussions for the specified snippet
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getSnippetDiscussions
(
Object
projectIdOrPath
,
Integer
snippetId
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getSnippetDiscussions
(
Object
projectIdOrPath
,
Integer
snippetId
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getSnippetDiscussionsPager
(
projectIdOrPath
,
snippetId
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getSnippetDiscussionsPager
(
projectIdOrPath
,
snippetId
,
getDefaultPerPage
());
...
@@ -104,13 +106,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -104,13 +106,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of discussions for the specified snippet.
* Get a list of discussions for the specified snippet.
*
*
* GET /projects/:id/snippets/:snippet_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/snippets/:snippet_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param snippetId the ID of the snippet
* @param snippetId the ID of the snippet
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the snippet
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the snippet
* @return a list containing the discussions for the specified snippet
* @return a list containing the discussions for the specified snippet
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getSnippetDiscussions
(
Object
projectIdOrPath
,
Integer
snippetId
,
int
maxItems
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getSnippetDiscussions
(
Object
projectIdOrPath
,
Integer
snippetId
,
int
maxItems
)
throws
GitLabApiException
{
if
(
maxItems
<
1
)
{
if
(
maxItems
<
1
)
{
...
@@ -125,13 +127,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -125,13 +127,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Pager of Discussion instances for the specified snippet.
* Get a Pager of Discussion instances for the specified snippet.
*
*
* GET /projects/:id/snippets/:snippet_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/snippets/:snippet_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param snippetId the ID of the snippet
* @param snippetId the ID of the snippet
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @return a Pager containing the Discussion instances for the specified snippet
* @return a Pager containing the Discussion instances for the specified snippet
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Discussion
>
getSnippetDiscussionsPager
(
Object
projectIdOrPath
,
Integer
snippetId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Discussion
>
getSnippetDiscussionsPager
(
Object
projectIdOrPath
,
Integer
snippetId
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
...
@@ -141,12 +143,12 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -141,12 +143,12 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Stream of Discussion instances for the specified snippet.
* Get a Stream of Discussion instances for the specified snippet.
*
*
* GET /projects/:id/snippets/:snippet_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/snippets/:snippet_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param snippetId the ID of the snippet
* @param snippetId the ID of the snippet
* @return a Stream instance containing the Discussion instances for the specified snippet
* @return a Stream instance containing the Discussion instances for the specified snippet
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Stream
<
Discussion
>
getSnippetDiscussionsStream
(
Object
projectIdOrPath
,
Integer
snippetId
)
throws
GitLabApiException
{
public
Stream
<
Discussion
>
getSnippetDiscussionsStream
(
Object
projectIdOrPath
,
Integer
snippetId
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getSnippetDiscussionsPager
(
projectIdOrPath
,
snippetId
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getSnippetDiscussionsPager
(
projectIdOrPath
,
snippetId
,
getDefaultPerPage
());
...
@@ -157,12 +159,12 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -157,12 +159,12 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of all discussions for the specified epic.
* Get a list of all discussions for the specified epic.
*
*
* GET /projects/:id/epics/:epic_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/epics/:epic_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param epicId the internal ID of the epic
* @param epicId the internal ID of the epic
* @return a list containing all the discussions for the specified epic
* @return a list containing all the discussions for the specified epic
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getEpicDiscussions
(
Object
projectIdOrPath
,
Integer
epicId
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getEpicDiscussions
(
Object
projectIdOrPath
,
Integer
epicId
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getEpicDiscussionsPager
(
projectIdOrPath
,
epicId
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getEpicDiscussionsPager
(
projectIdOrPath
,
epicId
,
getDefaultPerPage
());
...
@@ -172,13 +174,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -172,13 +174,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of discussions for the specified epic.
* Get a list of discussions for the specified epic.
*
*
* GET /projects/:id/epics/:epic_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/epics/:epic_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param epicId the internal ID of the epic
* @param epicId the internal ID of the epic
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the epic
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the epic
* @return a list containing the discussions for the specified epic
* @return a list containing the discussions for the specified epic
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getEpicDiscussions
(
Object
projectIdOrPath
,
Integer
epicId
,
int
maxItems
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getEpicDiscussions
(
Object
projectIdOrPath
,
Integer
epicId
,
int
maxItems
)
throws
GitLabApiException
{
if
(
maxItems
<
1
)
{
if
(
maxItems
<
1
)
{
...
@@ -193,13 +195,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -193,13 +195,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Pager of Discussion instances for the specified epic.
* Get a Pager of Discussion instances for the specified epic.
*
*
* GET /projects/:id/epics/:epic_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/epics/:epic_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param epicId the internal ID of the epic
* @param epicId the internal ID of the epic
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @return a Pager containing the Discussion instances for the specified epic
* @return a Pager containing the Discussion instances for the specified epic
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Discussion
>
getEpicDiscussionsPager
(
Object
projectIdOrPath
,
Integer
epicId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Discussion
>
getEpicDiscussionsPager
(
Object
projectIdOrPath
,
Integer
epicId
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
...
@@ -209,12 +211,12 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -209,12 +211,12 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Stream of Discussion instances for the specified epic.
* Get a Stream of Discussion instances for the specified epic.
*
*
* GET /projects/:id/epics/:epic_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/epics/:epic_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param epicId the internal ID of the epic
* @param epicId the internal ID of the epic
* @return a Stream instance containing the Discussion instances for the specified epic
* @return a Stream instance containing the Discussion instances for the specified epic
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Stream
<
Discussion
>
getEpicDiscussionsStream
(
Object
projectIdOrPath
,
Integer
epicId
)
throws
GitLabApiException
{
public
Stream
<
Discussion
>
getEpicDiscussionsStream
(
Object
projectIdOrPath
,
Integer
epicId
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getEpicDiscussionsPager
(
projectIdOrPath
,
epicId
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getEpicDiscussionsPager
(
projectIdOrPath
,
epicId
,
getDefaultPerPage
());
...
@@ -224,12 +226,12 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -224,12 +226,12 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of all discussions for the specified merge request.
* Get a list of all discussions for the specified merge request.
*
*
* GET /projects/:id/merge_requests/:merge_request_iid/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/merge_requests/:merge_request_iid/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param mergeRequestIid the internal ID of the merge request
* @param mergeRequestIid the internal ID of the merge request
* @return a list containing all the discussions for the specified merge request
* @return a list containing all the discussions for the specified merge request
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getMergeRequestDiscussions
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getMergeRequestDiscussions
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getMergeRequestDiscussionsPager
(
projectIdOrPath
,
mergeRequestIid
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getMergeRequestDiscussionsPager
(
projectIdOrPath
,
mergeRequestIid
,
getDefaultPerPage
());
...
@@ -239,13 +241,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -239,13 +241,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of discussions for the specified merge request.
* Get a list of discussions for the specified merge request.
*
*
* GET /projects/:id/merge_requests/:merge_request_iid/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/merge_requests/:merge_request_iid/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param mergeRequestIid the internal ID of the merge request
* @param mergeRequestIid the internal ID of the merge request
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the merge request
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the merge request
* @return a list containing the discussions for the specified merge request
* @return a list containing the discussions for the specified merge request
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getMergeRequestDiscussions
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
,
int
maxItems
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getMergeRequestDiscussions
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
,
int
maxItems
)
throws
GitLabApiException
{
if
(
maxItems
<
1
)
{
if
(
maxItems
<
1
)
{
...
@@ -260,13 +262,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -260,13 +262,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Pager of Discussion instances for the specified merge request.
* Get a Pager of Discussion instances for the specified merge request.
*
*
* GET /projects/:id/merge_requests/:merge_request_iid/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/merge_requests/:merge_request_iid/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param mergeRequestIid the internal ID of the merge request
* @param mergeRequestIid the internal ID of the merge request
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @return a Pager containing the Discussion instances for the specified merge request
* @return a Pager containing the Discussion instances for the specified merge request
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Discussion
>
getMergeRequestDiscussionsPager
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Discussion
>
getMergeRequestDiscussionsPager
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
...
@@ -276,27 +278,108 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -276,27 +278,108 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Stream of Discussion instances for the specified merge request.
* Get a Stream of Discussion instances for the specified merge request.
*
*
* GET /projects/:id/issues/:issue_iid/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/issues/:issue_iid/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param mergeRequestIid the internal ID of the merge request
* @param mergeRequestIid the internal ID of the merge request
* @return a Stream instance containing the Discussion instances for the specified issue
* @return a Stream instance containing the Discussion instances for the specified issue
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Stream
<
Discussion
>
getMergeRequestDiscussionsStream
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
)
throws
GitLabApiException
{
public
Stream
<
Discussion
>
getMergeRequestDiscussionsStream
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getMergeRequestDiscussionsPager
(
projectIdOrPath
,
mergeRequestIid
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getMergeRequestDiscussionsPager
(
projectIdOrPath
,
mergeRequestIid
,
getDefaultPerPage
());
return
(
pager
.
stream
());
return
(
pager
.
stream
());
}
}
/**
* Creates a new discussion to a single project merge request. This is similar to creating
* a note but other comments (replies) can be added to it later.
*
* <pre><code>GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/discussions</code></pre>
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param mergeRequestIid mergeRequestIid the internal ID of the merge request
* @param body the content of a discussion
* @param createdAt date the discussion was created (requires admin or project/group owner rights)
* @param positionHash position when creating a diff note
* @param position a Position instance holding the position attributes
* @return a Discussion instance containing the newly created discussion
* @throws GitLabApiException if any exception occurs during execution
*/
public
Discussion
createMergeRequestDiscussion
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
,
String
body
,
Date
createdAt
,
String
positionHash
,
Position
position
)
throws
GitLabApiException
{
if
(
position
==
null
)
{
throw
new
GitLabApiException
(
"position instance can not be null"
);
}
GitLabApiForm
formData
=
new
GitLabApiForm
()
.
withParam
(
"body"
,
body
,
true
)
.
withParam
(
"created_at"
,
createdAt
)
.
withParam
(
"position"
,
positionHash
)
.
withParam
(
"position[base_sha]"
,
position
.
getBaseSha
(),
true
)
.
withParam
(
"position[start_sha]"
,
position
.
getStartSha
(),
true
)
.
withParam
(
"position[head_sha]"
,
position
.
getHeadSha
(),
true
)
.
withParam
(
"position[position_type]"
,
position
.
getPositionType
(),
true
)
.
withParam
(
"position[new_path]"
,
position
.
getNewPath
())
.
withParam
(
"position[new_line]"
,
position
.
getNewLine
())
.
withParam
(
"position[old_path]"
,
position
.
getOldPath
())
.
withParam
(
"position[old_line]"
,
position
.
getOldLine
())
.
withParam
(
"position[width]"
,
position
.
getWidth
())
.
withParam
(
"position[height]"
,
position
.
getHeight
())
.
withParam
(
"position[x]"
,
position
.
getX
())
.
withParam
(
"position[y]"
,
position
.
getY
());
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"merge_requests"
,
mergeRequestIid
,
"discussions"
);
return
(
response
.
readEntity
(
Discussion
.
class
));
}
/**
* Resolve or unresolve whole discussion of a merge request.
*
* <pre><code>GitLab Endpoint: POST /projects/:id/merge_requests/:merge_request_iid/discussions</code></pre>
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param mergeRequestIid mergeRequestIid the internal ID of the merge request
* @param discussionId the ID of a discussion
* @param resolved resolve/unresolve the discussion
* @return the updated DIscussion instance
* @throws GitLabApiException if any exception occurs during execution
*/
public
Discussion
resolveMergeRequestDiscussion
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
,
Integer
discussionId
,
Boolean
resolved
)
throws
GitLabApiException
{
GitLabApiForm
formData
=
new
GitLabApiForm
().
withParam
(
"resolved"
,
resolved
,
true
);
Response
response
=
put
(
Response
.
Status
.
OK
,
formData
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"merge_requests"
,
mergeRequestIid
,
"discussions"
);
return
(
response
.
readEntity
(
Discussion
.
class
));
}
/**
* Deletes an existing discussion note of a merge request.
*
* <pre><code>GitLab Endpoint: DELETE /projects/:id/merge_requests/:merge_request_iid/discussions/:discussion_id/notes/:note_id</code></pre>
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param mergeRequestIid mergeRequestIid the internal ID of the merge request
* @param discussionId the ID of a discussion
* @param noteId the note ID to delete
* @throws GitLabApiException if any exception occurs during execution
*/
public
void
deleteMergeRequestDiscussionNote
(
Object
projectIdOrPath
,
Integer
mergeRequestIid
,
Integer
discussionId
,
Integer
noteId
)
throws
GitLabApiException
{
delete
(
Response
.
Status
.
OK
,
null
,
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"merge_requests"
,
mergeRequestIid
,
"discussions"
,
noteId
);
}
/**
/**
* Get a list of all discussions for the specified commit.
* Get a list of all discussions for the specified commit.
*
*
* GET /projects/:id/commits/:commit_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/commits/:commit_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param commitId the internal ID of the commit
* @param commitId the internal ID of the commit
* @return a list containing all the discussions for the specified commit
* @return a list containing all the discussions for the specified commit
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getCommitDiscussions
(
Object
projectIdOrPath
,
Integer
commitId
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getCommitDiscussions
(
Object
projectIdOrPath
,
Integer
commitId
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getCommitDiscussionsPager
(
projectIdOrPath
,
commitId
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getCommitDiscussionsPager
(
projectIdOrPath
,
commitId
,
getDefaultPerPage
());
...
@@ -306,13 +389,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -306,13 +389,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a list of discussions for the specified commit.
* Get a list of discussions for the specified commit.
*
*
* GET /projects/:id/commits/:commit_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/commits/:commit_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param commitId the internal ID of the commit
* @param commitId the internal ID of the commit
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the commit
* @param maxItems the maximum number of Discussion instances to get, if < 1 will fetch all Discussion instances for the commit
* @return a list containing the discussions for the specified commit
* @return a list containing the discussions for the specified commit
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
List
<
Discussion
>
getCommitDiscussions
(
Object
projectIdOrPath
,
Integer
commitId
,
int
maxItems
)
throws
GitLabApiException
{
public
List
<
Discussion
>
getCommitDiscussions
(
Object
projectIdOrPath
,
Integer
commitId
,
int
maxItems
)
throws
GitLabApiException
{
if
(
maxItems
<
1
)
{
if
(
maxItems
<
1
)
{
...
@@ -327,13 +410,13 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -327,13 +410,13 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Pager of Discussion instances for the specified commit.
* Get a Pager of Discussion instances for the specified commit.
*
*
* GET /projects/:id/commits/:commit_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/commits/:commit_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param commitId the internal ID of the commit
* @param commitId the internal ID of the commit
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @param itemsPerPage the number of Discussion instances that will be fetched per page
* @return a Pager containing the Discussion instances for the specified commit
* @return a Pager containing the Discussion instances for the specified commit
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Pager
<
Discussion
>
getCommitDiscussionsPager
(
Object
projectIdOrPath
,
Integer
commitId
,
int
itemsPerPage
)
throws
GitLabApiException
{
public
Pager
<
Discussion
>
getCommitDiscussionsPager
(
Object
projectIdOrPath
,
Integer
commitId
,
int
itemsPerPage
)
throws
GitLabApiException
{
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
return
(
new
Pager
<
Discussion
>(
this
,
Discussion
.
class
,
itemsPerPage
,
null
,
...
@@ -343,12 +426,12 @@ public class DiscussionsApi extends AbstractApi {
...
@@ -343,12 +426,12 @@ public class DiscussionsApi extends AbstractApi {
/**
/**
* Get a Stream of Discussion instances for the specified commit.
* Get a Stream of Discussion instances for the specified commit.
*
*
* GET /projects/:id/commits/:commit_id/discussions
*
<pre><code>GitLab Endpoint:
GET /projects/:id/commits/:commit_id/discussions
</code></pre>
*
*
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param commitId the internal ID of the commit
* @param commitId the internal ID of the commit
* @return a Stream instance containing the Discussion instances for the specified commit
* @return a Stream instance containing the Discussion instances for the specified commit
* @throws GitLabApiException
GitLabApiException
if any exception occurs during execution
* @throws GitLabApiException if any exception occurs during execution
*/
*/
public
Stream
<
Discussion
>
getCommitDiscussionsStream
(
Object
projectIdOrPath
,
Integer
commitId
)
throws
GitLabApiException
{
public
Stream
<
Discussion
>
getCommitDiscussionsStream
(
Object
projectIdOrPath
,
Integer
commitId
)
throws
GitLabApiException
{
Pager
<
Discussion
>
pager
=
getCommitDiscussionsPager
(
projectIdOrPath
,
commitId
,
getDefaultPerPage
());
Pager
<
Discussion
>
pager
=
getCommitDiscussionsPager
(
projectIdOrPath
,
commitId
,
getDefaultPerPage
());
...
...
src/main/java/org/gitlab4j/api/models/Note.java
View file @
d0a7d1b5
...
@@ -105,6 +105,8 @@ public class Note {
...
@@ -105,6 +105,8 @@ public class Note {
private
Participant
resolvedBy
;
private
Participant
resolvedBy
;
private
Type
type
;
private
Type
type
;
private
Position
position
;
public
String
getAttachment
()
{
public
String
getAttachment
()
{
return
attachment
;
return
attachment
;
}
}
...
@@ -257,6 +259,14 @@ public class Note {
...
@@ -257,6 +259,14 @@ public class Note {
this
.
type
=
type
;
this
.
type
=
type
;
}
}
public
Position
getPosition
()
{
return
position
;
}
public
void
setPosition
(
Position
position
)
{
this
.
position
=
position
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
return
(
JacksonJson
.
toJsonString
(
this
));
...
...
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