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
d492daec
Commit
d492daec
authored
Mar 03, 2018
by
Michal Augustýn
Committed by
Greg Messner
Mar 03, 2018
Browse files
Support additional parameters in createMergeRequest method (#148)
parent
aecffa42
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/MergeRequestApi.java
View file @
d492daec
...
@@ -216,12 +216,16 @@ public class MergeRequestApi extends AbstractApi {
...
@@ -216,12 +216,16 @@ public class MergeRequestApi extends AbstractApi {
* @param title the title for the merge request, required
* @param title the title for the merge request, required
* @param description the description of the merge request
* @param description the description of the merge request
* @param assigneeId the Assignee user ID, optional
* @param assigneeId the Assignee user ID, optional
* @param targetProjectId the ID of a target project, optional
* @param labels labels for MR, optional
* @param milestoneId the ID of a milestone, optional
* @param removeSourceBranch Flag indicating if a merge request should remove the source branch when merging, optional
* @return the created MergeRequest instance
* @return the created MergeRequest instance
* @throws GitLabApiException if any exception occurs
* @throws GitLabApiException if any exception occurs
*/
*/
public
MergeRequest
createMergeRequest
(
Integer
projectId
,
String
sourceBranch
,
String
targetBranch
,
String
title
,
String
description
,
Integer
assigneeId
)
public
MergeRequest
createMergeRequest
(
Integer
projectId
,
String
sourceBranch
,
String
targetBranch
,
String
title
,
String
description
,
Integer
assigneeId
,
Integer
targetProjectId
,
String
[]
labels
,
Integer
milestoneId
,
Boolean
removeSourceBranch
)
throws
GitLabApiException
{
throws
GitLabApiException
{
if
(
projectId
==
null
)
{
if
(
projectId
==
null
)
{
throw
new
RuntimeException
(
"projectId cannot be null"
);
throw
new
RuntimeException
(
"projectId cannot be null"
);
}
}
...
@@ -232,11 +236,34 @@ public class MergeRequestApi extends AbstractApi {
...
@@ -232,11 +236,34 @@ public class MergeRequestApi extends AbstractApi {
addFormParam
(
formData
,
"title"
,
title
,
true
);
addFormParam
(
formData
,
"title"
,
title
,
true
);
addFormParam
(
formData
,
"description"
,
description
,
false
);
addFormParam
(
formData
,
"description"
,
description
,
false
);
addFormParam
(
formData
,
"assignee_id"
,
assigneeId
,
false
);
addFormParam
(
formData
,
"assignee_id"
,
assigneeId
,
false
);
addFormParam
(
formData
,
"target_project_id"
,
targetProjectId
,
false
);
addFormParam
(
formData
,
"labels"
,
labels
==
null
?
null
:
String
.
join
(
","
,
labels
),
false
);
addFormParam
(
formData
,
"milestone_id"
,
milestoneId
,
false
);
addFormParam
(
formData
,
"remove_source_branch"
,
removeSourceBranch
,
false
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"merge_requests"
);
Response
response
=
post
(
Response
.
Status
.
CREATED
,
formData
,
"projects"
,
projectId
,
"merge_requests"
);
return
(
response
.
readEntity
(
MergeRequest
.
class
));
return
(
response
.
readEntity
(
MergeRequest
.
class
));
}
}
/**
* Creates a merge request and optionally assigns a reviewer to it.
*
* POST /projects/:id/merge_requests
*
* @param projectId the ID of a project, required
* @param sourceBranch the source branch, required
* @param targetBranch the target branch, required
* @param title the title for the merge request, required
* @param description the description of the merge request
* @param assigneeId the Assignee user ID, optional
* @return the created MergeRequest instance
* @throws GitLabApiException if any exception occurs
*/
public
MergeRequest
createMergeRequest
(
Integer
projectId
,
String
sourceBranch
,
String
targetBranch
,
String
title
,
String
description
,
Integer
assigneeId
)
throws
GitLabApiException
{
return
createMergeRequest
(
projectId
,
sourceBranch
,
targetBranch
,
title
,
description
,
assigneeId
,
null
,
null
,
null
,
null
);
}
/**
/**
* Updates an existing merge request. You can change branches, title, or even close the MR.
* Updates an existing merge request. You can change branches, title, or even close the MR.
*
*
...
...
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