You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MeasuresService.java 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2023 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonarqube.ws.client.measures;
  21. import java.util.stream.Collectors;
  22. import javax.annotation.Generated;
  23. import org.sonarqube.ws.client.BaseService;
  24. import org.sonarqube.ws.client.GetRequest;
  25. import org.sonarqube.ws.client.WsConnector;
  26. import org.sonarqube.ws.Measures.ComponentWsResponse;
  27. import org.sonarqube.ws.Measures.ComponentTreeWsResponse;
  28. import org.sonarqube.ws.Measures.SearchWsResponse;
  29. import org.sonarqube.ws.Measures.SearchHistoryResponse;
  30. /**
  31. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures">Further information about this web service online</a>
  32. */
  33. @Generated("sonar-ws-generator")
  34. public class MeasuresService extends BaseService {
  35. public MeasuresService(WsConnector wsConnector) {
  36. super(wsConnector, "api/measures");
  37. }
  38. /**
  39. *
  40. * This is part of the internal API.
  41. * This is a GET request.
  42. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/component">Further information about this action online (including a response example)</a>
  43. * @since 5.4
  44. */
  45. public ComponentWsResponse component(ComponentRequest request) {
  46. return call(
  47. new GetRequest(path("component"))
  48. .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(",")))
  49. .setParam("branch", request.getBranch())
  50. .setParam("component", request.getComponent())
  51. .setParam("metricKeys", request.getMetricKeys() == null ? null : request.getMetricKeys().stream().collect(Collectors.joining(",")))
  52. .setParam("pullRequest", request.getPullRequest()),
  53. ComponentWsResponse.parser());
  54. }
  55. /**
  56. *
  57. * This is part of the internal API.
  58. * This is a GET request.
  59. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/component_tree">Further information about this action online (including a response example)</a>
  60. * @since 5.4
  61. */
  62. public ComponentTreeWsResponse componentTree(ComponentTreeRequest request) {
  63. return call(
  64. new GetRequest(path("component_tree"))
  65. .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(",")))
  66. .setParam("asc", request.getAsc())
  67. .setParam("branch", request.getBranch())
  68. .setParam("component", request.getComponent())
  69. .setParam("metricKeys", request.getMetricKeys() == null ? null : request.getMetricKeys().stream().collect(Collectors.joining(",")))
  70. .setParam("metricPeriodSort", request.getMetricPeriodSort())
  71. .setParam("metricSort", request.getMetricSort())
  72. .setParam("metricSortFilter", request.getMetricSortFilter())
  73. .setParam("p", request.getP())
  74. .setParam("ps", request.getPs())
  75. .setParam("pullRequest", request.getPullRequest())
  76. .setParam("q", request.getQ())
  77. .setParam("qualifiers", request.getQualifiers() == null ? null : request.getQualifiers().stream().collect(Collectors.joining(",")))
  78. .setParam("s", request.getS() == null ? null : request.getS().stream().collect(Collectors.joining(",")))
  79. .setParam("strategy", request.getStrategy()),
  80. ComponentTreeWsResponse.parser());
  81. }
  82. /**
  83. *
  84. * This is part of the internal API.
  85. * This is a GET request.
  86. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/search">Further information about this action online (including a response example)</a>
  87. * @since 6.2
  88. */
  89. public SearchWsResponse search(SearchRequest request) {
  90. return call(
  91. new GetRequest(path("search"))
  92. .setParam("metricKeys", request.getMetricKeys() == null ? null : request.getMetricKeys().stream().collect(Collectors.joining(",")))
  93. .setParam("projectKeys", request.getProjectKeys() == null ? null : request.getProjectKeys().stream().collect(Collectors.joining(","))),
  94. SearchWsResponse.parser());
  95. }
  96. /**
  97. *
  98. * This is part of the internal API.
  99. * This is a GET request.
  100. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/measures/search_history">Further information about this action online (including a response example)</a>
  101. * @since 6.3
  102. */
  103. public SearchHistoryResponse searchHistory(SearchHistoryRequest request) {
  104. return call(
  105. new GetRequest(path("search_history"))
  106. .setParam("branch", request.getBranch())
  107. .setParam("component", request.getComponent())
  108. .setParam("from", request.getFrom())
  109. .setParam("metrics", request.getMetrics() == null ? null : request.getMetrics().stream().collect(Collectors.joining(",")))
  110. .setParam("p", request.getP())
  111. .setParam("ps", request.getPs())
  112. .setParam("pullRequest", request.getPullRequest())
  113. .setParam("to", request.getTo()),
  114. SearchHistoryResponse.parser());
  115. }
  116. }