|
10 | 10 |
|
11 | 11 | import org.gitlab4j.api.GitLabApi.ApiVersion; |
12 | 12 | import org.gitlab4j.api.models.Commit; |
| 13 | +import org.gitlab4j.api.models.Discussion; |
13 | 14 | import org.gitlab4j.api.models.Issue; |
14 | 15 | import org.gitlab4j.api.models.MergeRequest; |
15 | 16 | import org.gitlab4j.api.models.MergeRequestFilter; |
@@ -279,6 +280,44 @@ public Pager<Commit> getCommits(int projectId, int mergeRequestIid, int itemsPer |
279 | 280 | "projects", projectId, "merge_requests", mergeRequestIid, "commits")); |
280 | 281 | } |
281 | 282 |
|
| 283 | + /** |
| 284 | + * Get a list of merge request discussions. |
| 285 | + * |
| 286 | + * <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p> |
| 287 | + * |
| 288 | + * GET /projects/:id/merge_requests/:merge_request_iid/discussions |
| 289 | + * |
| 290 | + * @param projectId the project ID for the merge request |
| 291 | + * @param mergeRequestIid the internal ID of the merge request |
| 292 | + * @param page the page to get |
| 293 | + * @param perPage the number of commits per page |
| 294 | + * @return a list containing the discussions for the specified merge request |
| 295 | + * @throws GitLabApiException GitLabApiException if any exception occurs during execution |
| 296 | + */ |
| 297 | + public List<Discussion> getDiscussions(int projectId, int mergeRequestIid, int page, int perPage) throws GitLabApiException { |
| 298 | + Form formData = new GitLabApiForm().withParam("owned", false).withParam(PAGE_PARAM, page).withParam(PER_PAGE_PARAM, perPage); |
| 299 | + Response response = get(Response.Status.OK, formData.asMap(), "projects", projectId, "merge_requests", mergeRequestIid, "discussions"); |
| 300 | + return (response.readEntity(new GenericType<List<Discussion>>() {})); |
| 301 | + } |
| 302 | + |
| 303 | + /** |
| 304 | + * Get a Pager of merge request discussions. |
| 305 | + * |
| 306 | + * <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p> |
| 307 | + * |
| 308 | + * GET /projects/:id/merge_requests/:merge_request_iid/discussions |
| 309 | + * |
| 310 | + * @param projectId the project ID for the merge request |
| 311 | + * @param mergeRequestIid the internal ID of the merge request |
| 312 | + * @param itemsPerPage the number of Commit instances that will be fetched per page |
| 313 | + * @return a Pager containing the discussions for the specified merge request |
| 314 | + * @throws GitLabApiException GitLabApiException if any exception occurs during execution |
| 315 | + */ |
| 316 | + public Pager<Discussion> getDiscussions(int projectId, int mergeRequestIid, int itemsPerPage) throws GitLabApiException { |
| 317 | + return (new Pager<Discussion>(this, Discussion.class, itemsPerPage, null, |
| 318 | + "projects", projectId, "merge_requests", mergeRequestIid, "discussions")); |
| 319 | + } |
| 320 | + |
282 | 321 | /** |
283 | 322 | * Creates a merge request and optionally assigns a reviewer to it. |
284 | 323 | * |
|
0 commit comments