]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16370 Added integration test for new endpoint api/issues/pull
authorLukasz Jarocki <lukasz.jarocki@sonarsource.com>
Wed, 1 Jun 2022 11:48:49 +0000 (13:48 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 1 Jun 2022 20:03:02 +0000 (20:03 +0000)
sonar-ws/src/main/java/org/sonarqube/ws/client/issues/IssuesService.java
sonar-ws/src/main/java/org/sonarqube/ws/client/issues/PullRequest.java [new file with mode: 0644]

index 9978397decf3882fed754619ab7a2d5a38e6d5ee..e61c8dce878ba08cc880e48347d79c208b5a9ff4 100644 (file)
  */
 package org.sonarqube.ws.client.issues;
 
+import java.io.InputStream;
 import java.util.stream.Collectors;
 import javax.annotation.Generated;
+import org.sonarqube.ws.Issues;
 import org.sonarqube.ws.Issues.AddCommentResponse;
 import org.sonarqube.ws.Issues.AssignResponse;
 import org.sonarqube.ws.Issues.AuthorsResponse;
@@ -38,6 +40,7 @@ import org.sonarqube.ws.client.BaseService;
 import org.sonarqube.ws.client.GetRequest;
 import org.sonarqube.ws.client.PostRequest;
 import org.sonarqube.ws.client.WsConnector;
+import org.sonarqube.ws.client.batch.IssuesRequest;
 
 /**
  * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/issues">Further information about this web service online</a>
@@ -299,4 +302,23 @@ public class IssuesService extends BaseService {
         .setParam("q", request.getQ()),
       TagsResponse.parser());
   }
+
+  /**
+   *
+   * This is part of the internal API.
+   * This is a GET request.
+   * @see <a href="https://next.sonarqube.com/sonarqube/api/issues/pull">Further information about this action online (including a response example)</a>
+   * @since 9.5
+   */
+  public InputStream pull(PullRequest request) {
+    return call(
+      new GetRequest(path("pull"))
+        .setParam("projectKey", request.getProjectKey())
+        .setParam("branchName", request.getBranchName())
+        .setParam("languages", request.getLanguages())
+        .setParam("ruleRepositories", request.getRuleRepositories())
+        .setParam("resolvedOnly", request.getResolvedOnly())
+        .setParam("changedSince", request.getChangedSince())
+    ).contentStream();
+  }
 }
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/PullRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/issues/PullRequest.java
new file mode 100644 (file)
index 0000000..176eb0d
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2022 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonarqube.ws.client.issues;
+
+public class PullRequest {
+
+  private String projectKey;
+  private String branchName;
+  private String languages;
+  private String ruleRepositories;
+  private String resolvedOnly;
+  private String changedSince;
+
+  public String getProjectKey() {
+    return projectKey;
+  }
+
+  public PullRequest setProjectKey(String projectKey) {
+    this.projectKey = projectKey;
+    return this;
+  }
+
+  public String getBranchName() {
+    return branchName;
+  }
+
+  public PullRequest setBranchName(String branchName) {
+    this.branchName = branchName;
+    return this;
+  }
+
+  public String getLanguages() {
+    return languages;
+  }
+
+  public PullRequest setLanguages(String languages) {
+    this.languages = languages;
+    return this;
+  }
+
+  public String getRuleRepositories() {
+    return ruleRepositories;
+  }
+
+  public PullRequest setRuleRepositories(String ruleRepositories) {
+    this.ruleRepositories = ruleRepositories;
+    return this;
+  }
+
+  public String getResolvedOnly() {
+    return resolvedOnly;
+  }
+
+  public PullRequest setResolvedOnly(String resolvedOnly) {
+    this.resolvedOnly = resolvedOnly;
+    return this;
+  }
+
+  public String getChangedSince() {
+    return changedSince;
+  }
+
+  public PullRequest setChangedSince(String changedSince) {
+    this.changedSince = changedSince;
+    return this;
+  }
+}