3 * Copyright (C) 2009-2017 SonarSource SA
4 * mailto:info AT sonarsource DOT com
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.
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.
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.
20 package org.sonarqube.ws.client.projectanalyses;
22 import javax.annotation.Generated;
23 import org.sonarqube.ws.MediaTypes;
24 import org.sonarqube.ws.ProjectAnalyses.CreateEventResponse;
25 import org.sonarqube.ws.ProjectAnalyses.SearchResponse;
26 import org.sonarqube.ws.ProjectAnalyses.UpdateEventResponse;
27 import org.sonarqube.ws.client.BaseService;
28 import org.sonarqube.ws.client.GetRequest;
29 import org.sonarqube.ws.client.PostRequest;
30 import org.sonarqube.ws.client.WsConnector;
33 * Manage project analyses.
34 * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses">Further information about this web service online</a>
36 @Generated("https://github.com/SonarSource/sonar-ws-generator")
37 public class ProjectAnalysesService extends BaseService {
39 public ProjectAnalysesService(WsConnector wsConnector) {
40 super(wsConnector, "api/project_analyses");
44 * Create a project analysis event.<br>Only event of category 'VERSION' and 'OTHER' can be created.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul>
46 * This is part of the internal API.
47 * This is a POST request.
48 * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/create_event">Further information about this action online (including a response example)</a>
51 public CreateEventResponse createEvent(CreateEventRequest request) {
53 new PostRequest(path("create_event"))
54 .setParam("analysis", request.getAnalysis())
55 .setParam("category", request.getCategory())
56 .setParam("name", request.getName()),
57 CreateEventResponse.parser());
61 * Delete a project analysis.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the project of the specified analysis</li></ul>
63 * This is part of the internal API.
64 * This is a POST request.
65 * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/delete">Further information about this action online (including a response example)</a>
68 public void delete(DeleteRequest request) {
70 new PostRequest(path("delete"))
71 .setParam("analysis", request.getAnalysis())
72 .setMediaType(MediaTypes.JSON)
77 * Delete a project analysis event.<br>Only event of category 'VERSION' and 'OTHER' can be deleted.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul>
79 * This is part of the internal API.
80 * This is a POST request.
81 * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/delete_event">Further information about this action online (including a response example)</a>
84 public void deleteEvent(DeleteEventRequest request) {
86 new PostRequest(path("delete_event"))
87 .setParam("event", request.getEvent())
88 .setMediaType(MediaTypes.JSON)
93 * Search a project analyses and attached events.<br>Requires the following permission: 'Browse' on the specified project
95 * This is part of the internal API.
96 * This is a GET request.
97 * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/search">Further information about this action online (including a response example)</a>
100 public SearchResponse search(SearchRequest request) {
102 new GetRequest(path("search"))
103 .setParam("branch", request.getBranch())
104 .setParam("category", request.getCategory())
105 .setParam("from", request.getFrom())
106 .setParam("p", request.getP())
107 .setParam("project", request.getProject())
108 .setParam("ps", request.getPs())
109 .setParam("to", request.getTo()),
110 SearchResponse.parser());
114 * Update a project analysis event.<br>Only events of category 'VERSION' and 'OTHER' can be updated.<br>Requires one of the following permissions:<ul> <li>'Administer System'</li> <li>'Administer' rights on the specified project</li></ul>
116 * This is part of the internal API.
117 * This is a POST request.
118 * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/project_analyses/update_event">Further information about this action online (including a response example)</a>
121 public UpdateEventResponse updateEvent(UpdateEventRequest request) {
123 new PostRequest(path("update_event"))
124 .setParam("event", request.getEvent())
125 .setParam("name", request.getName()),
126 UpdateEventResponse.parser());