Skip to content

Commit 8a1bdc5

Browse files
bonzanitimols
authored andcommitted
Send discussion attributes as query parameters. (timols#323)
Signed-off-by: Patrizio Bonzani <[email protected]>
1 parent b287bca commit 8a1bdc5

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/main/java/org/gitlab/api/GitlabAPI.java

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1763,23 +1763,23 @@ public GitlabDiscussion createTextDiscussion(GitlabMergeRequest mergeRequest,
17631763
String positionHeadSha, String positionNewPath, Integer positionNewLine,
17641764
String positionOldPath, Integer positionOldLine) throws IOException {
17651765
checkRequiredCreateDiscussionArguments(body, positionBaseSha, positionStartSha, positionHeadSha);
1766+
Query query = new Query()
1767+
.append("body", body)
1768+
.appendIf("position", position)
1769+
.append("position[base_sha]", positionBaseSha)
1770+
.append("position[start_sha]", positionStartSha)
1771+
.append("position[head_sha]", positionHeadSha)
1772+
.append("position[position_type]", "text")
1773+
.appendIf("position[new_path]", positionNewPath)
1774+
.appendIf("position[new_line]", positionNewLine)
1775+
.appendIf("position[old_path]", positionOldPath)
1776+
.appendIf("position[old_line]", positionOldLine);
17661777

17671778
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() +
17681779
GitlabMergeRequest.URL + "/" + mergeRequest.getIid() +
1769-
GitlabDiscussion.URL;
1780+
GitlabDiscussion.URL + query.toString();
17701781

1771-
return dispatch()
1772-
.with("body", body)
1773-
.with("position", position)
1774-
.with("position[base_sha]", positionBaseSha)
1775-
.with("position[start_sha]", positionStartSha)
1776-
.with("position[head_sha]", positionHeadSha)
1777-
.with("position[position_type]", "text")
1778-
.with("position[new_path]", positionNewPath)
1779-
.with("position[new_line]", positionNewLine)
1780-
.with("position[old_path]", positionOldPath)
1781-
.with("position[old_line]", positionOldLine)
1782-
.to(tailUrl, GitlabDiscussion.class);
1782+
return dispatch().to(tailUrl, GitlabDiscussion.class);
17831783
}
17841784

17851785
/**
@@ -1810,25 +1810,25 @@ public GitlabDiscussion createImageDiscussion(
18101810
Integer positionY
18111811
) throws IOException {
18121812
checkRequiredCreateDiscussionArguments(body, positionBaseSha, positionStartSha, positionHeadSha);
1813+
Query query = new Query()
1814+
.append("body", body)
1815+
.appendIf("position", position)
1816+
.append("position[base_sha]", positionBaseSha)
1817+
.append("position[start_sha]", positionStartSha)
1818+
.append("position[head_sha]", positionHeadSha)
1819+
.append("position[position_type]", "image")
1820+
.appendIf("position[new_path]", positionNewPath)
1821+
.appendIf("position[old_path]", positionOldPath)
1822+
.appendIf("position[width]", positionWidth)
1823+
.appendIf("position[height]", positionHeight)
1824+
.appendIf("position[x]", positionX)
1825+
.appendIf("position[y]", positionY);
18131826

18141827
String tailUrl = GitlabProject.URL + "/" + mergeRequest.getProjectId() +
18151828
GitlabMergeRequest.URL + "/" + mergeRequest.getIid() +
1816-
GitlabDiscussion.URL;
1829+
GitlabDiscussion.URL + query.toString();
18171830

1818-
return dispatch()
1819-
.with("body", body)
1820-
.with("position", position)
1821-
.with("position[base_sha]", positionBaseSha)
1822-
.with("position[start_sha]", positionStartSha)
1823-
.with("position[head_sha]", positionHeadSha)
1824-
.with("position[position_type]", "image")
1825-
.with("position[new_path]", positionNewPath)
1826-
.with("position[old_path]", positionOldPath)
1827-
.with("position[width]", positionWidth)
1828-
.with("position[height]", positionHeight)
1829-
.with("position[x]", positionX)
1830-
.with("position[y]", positionY)
1831-
.to(tailUrl, GitlabDiscussion.class);
1831+
return dispatch().to(tailUrl, GitlabDiscussion.class);
18321832
}
18331833

18341834
/**

0 commit comments

Comments
 (0)