Skip to content

Commit 90ad758

Browse files
committed
Updated Javadoc to make it clear that the internal ID is used for merge requests (#121).
1 parent 3509018 commit 90ad758

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/main/java/org/gitlab4j/api/MergeRequestApi.java

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ public Pager<MergeRequest> getMergeRequests(Integer projectId, MergeRequestState
117117
/**
118118
* Get information about a single merge request.
119119
*
120+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
121+
*
120122
* GET /projects/:id/merge_requests/:merge_request_id
121123
*
122124
* @param projectId the project ID of the merge request
@@ -132,6 +134,8 @@ public MergeRequest getMergeRequest(Integer projectId, Integer mergeRequestIid)
132134
/**
133135
* Get a list of merge request commits.
134136
*
137+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
138+
*
135139
* GET /projects/:id/merge_requests/:merge_request_iid/commits
136140
*
137141
* @param projectId the project ID for the merge request
@@ -146,6 +150,8 @@ public List<Commit> getCommits(int projectId, int mergeRequestIid) throws GitLab
146150
/**
147151
* Get a list of merge request commits.
148152
*
153+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
154+
*
149155
* GET /projects/:id/merge_requests/:merge_request_iid/commits
150156
*
151157
* @param projectId the project ID for the merge request
@@ -164,6 +170,8 @@ public List<Commit> getCommits(int projectId, int mergeRequestIid, int page, int
164170
/**
165171
* Get a Pager of merge request commits.
166172
*
173+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
174+
*
167175
* GET /projects/:id/merge_requests/:merge_request_iid/commits
168176
*
169177
* @param projectId the project ID for the merge request
@@ -212,6 +220,8 @@ public MergeRequest createMergeRequest(Integer projectId, String sourceBranch, S
212220
/**
213221
* Updates an existing merge request. You can change branches, title, or even close the MR.
214222
*
223+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
224+
*
215225
* PUT /projects/:id/merge_requests/:merge_request_iid
216226
*
217227
* @param projectId the ID of a project
@@ -254,6 +264,8 @@ public MergeRequest updateMergeRequest(Integer projectId, Integer mergeRequestIi
254264
/**
255265
* Updates an existing merge request. You can change branches, title, or even close the MR.
256266
*
267+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
268+
*
257269
* PUT /projects/:id/merge_requests/:merge_request_iid
258270
*
259271
* @param projectId the ID of a project
@@ -293,6 +305,8 @@ public MergeRequest updateMergeRequest(Integer projectId, Integer mergeRequestIi
293305
/**
294306
* Only for admins and project owners. Soft deletes the specified merge.
295307
*
308+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
309+
*
296310
* DELETE /projects/:id/merge_requests/:merge_request_iid
297311
*
298312
* @param projectId the ID of a project
@@ -321,6 +335,8 @@ public void deleteMergeRequest(Integer projectId, Integer mergeRequestIid) throw
321335
* a 409 and the error message 'SHA does not match HEAD of source branch'. If you don't
322336
* have permissions to accept this merge request, you'll get a 401.
323337
*
338+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
339+
*
324340
* PUT /projects/:id/merge_requests/:merge_request_iid/merge
325341
*
326342
* @param projectId the ID of a project
@@ -340,6 +356,9 @@ public MergeRequest acceptMergeRequest(Integer projectId, Integer mergeRequestIi
340356
* a 409 and the error message 'SHA does not match HEAD of source branch'. If you don't
341357
* have permissions to accept this merge request, you'll get a 401.
342358
*
359+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request. Additionally,
360+
* mergeWhenPipelineSucceeds sets the merge_when_build_succeeds flag for GitLab API V3.</p>
361+
*
343362
* PUT /projects/:id/merge_requests/:merge_request_iid/merge
344363
*
345364
* @param projectId the ID of a project
@@ -365,6 +384,9 @@ public MergeRequest acceptMergeRequest(Integer projectId, Integer mergeRequestIi
365384
* a 409 and the error message 'SHA does not match HEAD of source branch'. If you don't
366385
* have permissions to accept this merge request, you'll get a 401.
367386
*
387+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request. Additionally,
388+
* mergeWhenPipelineSucceeds sets the merge_when_build_succeeds flag for GitLab API V3.</p>
389+
*
368390
* PUT /projects/:id/merge_requests/:merge_request_iid/merge
369391
*
370392
* @param projectId the ID of a project
@@ -391,7 +413,9 @@ public MergeRequest acceptMergeRequest(Integer projectId, Integer mergeRequestIi
391413
Form formData = new GitLabApiForm()
392414
.withParam("merge_commit_message", mergeCommitMessage)
393415
.withParam("should_remove_source_branch", shouldRemoveSourceBranch)
394-
.withParam("merge_when_pipeline_succeeds", mergeWhenPipelineSucceeds)
416+
.withParam((isApiVersion(ApiVersion.V3) ?
417+
"merge_when_build_succeeds" : "merge_when_pipeline_succeeds"),
418+
mergeWhenPipelineSucceeds)
395419
.withParam("sha", sha);
396420

397421
Response response = put(Response.Status.OK, formData.asMap(), "projects", projectId, "merge_requests", mergeRequestIid, "merge");
@@ -404,6 +428,8 @@ public MergeRequest acceptMergeRequest(Integer projectId, Integer mergeRequestIi
404428
* error message 'Method Not Allowed'. In case the merge request is not set to be merged when the
405429
* pipeline succeeds, you'll also get a 406 error.
406430
*
431+
* <p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
432+
*
407433
* PUT /projects/:id/merge_requests/:merge_request_iid/cancel_merge_when_pipeline_succeeds
408434
*
409435
* @param projectId the ID of a project

0 commit comments

Comments
 (0)