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.

SourcesService.java 4.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2021 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.sources;
  21. import javax.annotation.Generated;
  22. import org.sonarqube.ws.MediaTypes;
  23. import org.sonarqube.ws.client.BaseService;
  24. import org.sonarqube.ws.client.GetRequest;
  25. import org.sonarqube.ws.client.WsConnector;
  26. /**
  27. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources">Further information about this web service online</a>
  28. */
  29. @Generated("sonar-ws-generator")
  30. public class SourcesService extends BaseService {
  31. public SourcesService(WsConnector wsConnector) {
  32. super(wsConnector, "api/sources");
  33. }
  34. /**
  35. *
  36. * This is part of the internal API.
  37. * This is a GET request.
  38. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/index">Further information about this action online (including a response example)</a>
  39. * @since 5.0
  40. */
  41. public String index(IndexRequest request) {
  42. return call(
  43. new GetRequest(path("index"))
  44. .setParam("from", request.getFrom())
  45. .setParam("resource", request.getResource())
  46. .setParam("to", request.getTo())
  47. .setMediaType(MediaTypes.JSON)
  48. ).content();
  49. }
  50. /**
  51. *
  52. * This is part of the internal API.
  53. * This is a GET request.
  54. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/issue_snippets">Further information about this action online (including a response example)</a>
  55. * @since 5.0
  56. */
  57. public String issueSnippets(IssueSnippetsRequest request) {
  58. return call(
  59. new GetRequest(path("issue_snippets"))
  60. .setParam("issueKey", request.getIssueKey())
  61. .setMediaType(MediaTypes.JSON)
  62. ).content();
  63. }
  64. /**
  65. *
  66. * This is part of the internal API.
  67. * This is a GET request.
  68. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/lines">Further information about this action online (including a response example)</a>
  69. * @since 5.0
  70. */
  71. public String lines(LinesRequest request) {
  72. return call(
  73. new GetRequest(path("lines"))
  74. .setParam("branch", request.getBranch())
  75. .setParam("from", request.getFrom())
  76. .setParam("key", request.getKey())
  77. .setParam("pullRequest", request.getPullRequest())
  78. .setParam("to", request.getTo())
  79. .setParam("uuid", request.getUuid())
  80. .setMediaType(MediaTypes.JSON)
  81. ).content();
  82. }
  83. /**
  84. *
  85. * This is part of the internal API.
  86. * This is a GET request.
  87. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/raw">Further information about this action online (including a response example)</a>
  88. * @since 5.0
  89. */
  90. public String raw(RawRequest request) {
  91. return call(
  92. new GetRequest(path("raw"))
  93. .setParam("branch", request.getBranch())
  94. .setParam("key", request.getKey())
  95. .setParam("pullRequest", request.getPullRequest())
  96. .setMediaType(MediaTypes.JSON)
  97. ).content();
  98. }
  99. /**
  100. *
  101. * This is part of the internal API.
  102. * This is a GET request.
  103. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/scm">Further information about this action online (including a response example)</a>
  104. * @since 4.4
  105. */
  106. public String scm(ScmRequest request) {
  107. return call(
  108. new GetRequest(path("scm"))
  109. .setParam("commits_by_line", request.getCommitsByLine())
  110. .setParam("from", request.getFrom())
  111. .setParam("key", request.getKey())
  112. .setParam("to", request.getTo())
  113. .setMediaType(MediaTypes.JSON)
  114. ).content();
  115. }
  116. /**
  117. *
  118. * This is part of the internal API.
  119. * This is a GET request.
  120. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/sources/show">Further information about this action online (including a response example)</a>
  121. * @since 4.4
  122. */
  123. public String show(ShowRequest request) {
  124. return call(
  125. new GetRequest(path("show"))
  126. .setParam("from", request.getFrom())
  127. .setParam("key", request.getKey())
  128. .setParam("to", request.getTo())
  129. .setMediaType(MediaTypes.JSON)
  130. ).content();
  131. }
  132. }