|
16 | 16 | import org.gitlab4j.api.models.IssueLink;
|
17 | 17 | import org.gitlab4j.api.models.IssuesStatistics;
|
18 | 18 | import org.gitlab4j.api.models.IssuesStatisticsFilter;
|
| 19 | +import org.gitlab4j.api.models.LinkType; |
19 | 20 | import org.gitlab4j.api.models.MergeRequest;
|
20 | 21 | import org.gitlab4j.api.models.Participant;
|
21 | 22 | import org.gitlab4j.api.models.TimeStats;
|
@@ -889,10 +890,31 @@ public Stream<Issue> getIssueLinksStream(Object projectIdOrPath, Long issueIid)
|
889 | 890 | */
|
890 | 891 | public IssueLink createIssueLink(Object projectIdOrPath, Long issueIid,
|
891 | 892 | Object targetProjectIdOrPath, Long targetIssueIid) throws GitLabApiException {
|
| 893 | + return createIssueLink(projectIdOrPath, issueIid, targetProjectIdOrPath, targetIssueIid, null); |
| 894 | + } |
| 895 | + |
| 896 | + /** |
| 897 | + * Creates a two-way relation between two issues. User must be allowed to update both issues in order to succeed. |
| 898 | + * |
| 899 | + * <p>NOTE: Only available in GitLab Starter, GitLab Bronze, and higher tiers.</p> |
| 900 | + * |
| 901 | + * <pre><code>GitLab Endpoint: POST /projects/:id/issues/:issue_iid/links</code></pre> |
| 902 | + * |
| 903 | + * @param projectIdOrPath the project in the form of an Long(ID), String(path), or Project instance |
| 904 | + * @param issueIid the internal ID of a project's issue |
| 905 | + * @param targetProjectIdOrPath the project in the form of an Long(ID), String(path), or Project instance of the target project |
| 906 | + * @param targetIssueIid the internal ID of a target project’s issue |
| 907 | + * @param linkType the type of the relation (optional), defaults to {@link LinkType#RELATES_TO}. |
| 908 | + * @return an instance of IssueLink holding the link relationship |
| 909 | + * @throws GitLabApiException if any exception occurs |
| 910 | + */ |
| 911 | + public IssueLink createIssueLink(Object projectIdOrPath, Long issueIid, |
| 912 | + Object targetProjectIdOrPath, Long targetIssueIid, LinkType linkType) throws GitLabApiException { |
892 | 913 |
|
893 | 914 | GitLabApiForm formData = new GitLabApiForm()
|
894 | 915 | .withParam("target_project_id", getProjectIdOrPath(targetProjectIdOrPath), true)
|
895 |
| - .withParam("target_issue_iid", targetIssueIid, true); |
| 916 | + .withParam("target_issue_iid", targetIssueIid, true) |
| 917 | + .withParam("link_type", linkType, false); |
896 | 918 |
|
897 | 919 | Response response = post(Response.Status.OK, formData.asMap(),
|
898 | 920 | "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "links");
|
|
0 commit comments