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.

ProjectBadgesService.java 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.projectbadges;
  21. import javax.annotation.Generated;
  22. import org.sonarqube.ws.MediaTypes;
  23. import org.sonarqube.ws.ProjectBadgeToken.TokenWsResponse;
  24. import org.sonarqube.ws.client.BaseService;
  25. import org.sonarqube.ws.client.GetRequest;
  26. import org.sonarqube.ws.client.PostRequest;
  27. import org.sonarqube.ws.client.WsConnector;
  28. import org.sonarqube.ws.client.WsResponse;
  29. /**
  30. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_badges">Further information about this web service online</a>
  31. */
  32. @Generated("sonar-ws-generator")
  33. public class ProjectBadgesService extends BaseService {
  34. public ProjectBadgesService(WsConnector wsConnector) {
  35. super(wsConnector, "api/project_badges");
  36. }
  37. /**
  38. *
  39. * This is part of the internal API.
  40. * This is a GET request.
  41. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_badges/measure">Further information about this action online (including a response example)</a>
  42. * @since 7.1
  43. */
  44. public String measure(MeasureRequest request) {
  45. return call(
  46. new GetRequest(path("measure"))
  47. .setParam("branch", request.getBranch())
  48. .setParam("metric", request.getMetric())
  49. .setParam("project", request.getProject())
  50. .setParam("token", request.getToken())
  51. .setMediaType(MediaTypes.JSON)
  52. ).content();
  53. }
  54. /**
  55. *
  56. * This is part of the internal API.
  57. * This is a GET request.
  58. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_badges/quality_gate">Further information about this action online (including a response example)</a>
  59. * @since 7.1
  60. */
  61. public String qualityGate(QualityGateRequest request) {
  62. return call(
  63. new GetRequest(path("quality_gate"))
  64. .setParam("branch", request.getBranch())
  65. .setParam("project", request.getProject())
  66. .setParam("token", request.getToken())
  67. .setMediaType(MediaTypes.JSON)
  68. ).content();
  69. }
  70. /**
  71. *
  72. * This is part of the internal API.
  73. * This is a GET request.
  74. * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_badges/token">Further information about this action online (including a response example)</a>
  75. * @since 9.2
  76. * @return
  77. */
  78. public TokenWsResponse token(TokenRequest request) {
  79. return call(
  80. new GetRequest(path("token"))
  81. .setParam("project", request.getProject())
  82. .setMediaType(MediaTypes.JSON),
  83. TokenWsResponse.parser()
  84. );
  85. }
  86. public WsResponse renewToken(RenewTokenRequest request) {
  87. return call(
  88. new PostRequest(path("renew_token"))
  89. .setParam("project", request.getProject())
  90. .setMediaType(MediaTypes.JSON)
  91. );
  92. }
  93. }