aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src/main/java/org/sonarqube/ws/client/ce/CeService.java
blob: 5e4c0aa3a26c1119cc81024405e6280e301f27d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
/*
 * SonarQube
 * Copyright (C) 2009-2025 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.ce;

import java.util.stream.Collectors;
import jakarta.annotation.Generated;
import org.sonarqube.ws.Ce.ActivityResponse;
import org.sonarqube.ws.Ce.ActivityStatusWsResponse;
import org.sonarqube.ws.Ce.AnalysisStatusWsResponse;
import org.sonarqube.ws.Ce.ComponentResponse;
import org.sonarqube.ws.Ce.InfoWsResponse;
import org.sonarqube.ws.Ce.SubmitResponse;
import org.sonarqube.ws.Ce.TaskResponse;
import org.sonarqube.ws.Ce.TaskTypesWsResponse;
import org.sonarqube.ws.Ce.WorkerCountResponse;
import org.sonarqube.ws.MediaTypes;
import org.sonarqube.ws.client.BaseService;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;

/**
 * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce">Further information about this web service online</a>
 */
@Generated("sonar-ws-generator")
public class CeService extends BaseService {

  public CeService(WsConnector wsConnector) {
    super(wsConnector, "api/ce");
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/activity">Further information about this action online (including a response example)</a>
   * @since 5.2
   */
  public ActivityResponse activity(ActivityRequest request) {
    return call(
      new GetRequest(path("activity"))
        .setParam("component", request.getComponent())
        .setParam("maxExecutedAt", request.getMaxExecutedAt())
        .setParam("minSubmittedAt", request.getMinSubmittedAt())
        .setParam("onlyCurrents", request.getOnlyCurrents())
        .setParam("p", request.getP())
        .setParam("ps", request.getPs())
        .setParam("q", request.getQ())
        .setParam("status", request.getStatus() == null ? null : request.getStatus().stream().collect(Collectors.joining(",")))
        .setParam("type", request.getType()),
      ActivityResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/activity_status">Further information about this action online (including a response example)</a>
   * @since 5.5
   */
  public ActivityStatusWsResponse activityStatus(ActivityStatusRequest request) {
    return call(
      new GetRequest(path("activity_status"))
        .setParam("component", request.getComponent()),
      ActivityStatusWsResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/analysis_status">Further information about this action online (including a response example)</a>
   * @since 7.4
   */
  public AnalysisStatusWsResponse analysisStatus(AnalysisStatusRequest request) {
    return call(
      new GetRequest(path("analysis_status"))
        .setParam("branch", request.getBranch())
        .setParam("component", request.getComponent())
        .setParam("pullRequest", request.getPullRequest()),
      AnalysisStatusWsResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a POST request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/cancel">Further information about this action online (including a response example)</a>
   * @since 5.2
   */
  public void cancel(CancelRequest request) {
    call(
      new PostRequest(path("cancel"))
        .setParam("id", request.getId())
        .setMediaType(MediaTypes.JSON)).content();
  }

  /**
   *
   * This is part of the internal API.
   * This is a POST request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/cancel_all">Further information about this action online (including a response example)</a>
   * @since 5.2
   */
  public void cancelAll() {
    call(
      new PostRequest(path("cancel_all"))
        .setMediaType(MediaTypes.JSON)).content();
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/component">Further information about this action online (including a response example)</a>
   * @since 5.2
   */
  public ComponentResponse component(ComponentRequest request) {
    return call(
      new GetRequest(path("component"))
        .setParam("component", request.getComponent())
        .setParam("componentId", request.getComponentId()),
      ComponentResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a POST request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/dismiss_analysis_warning">Further information about this action online (including a response example)</a>
   * @since 8.5
   */
  public void dismissAnalysisWarning(DismissAnalysisWarningRequest request) {
    call(
      new PostRequest(path("dismiss_analysis_warning"))
        .setParam("component", request.getComponent())
        .setParam("warning", request.getWarning())
        .setMediaType(MediaTypes.JSON)
    ).content();
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/info">Further information about this action online (including a response example)</a>
   * @since 7.2
   */
  public InfoWsResponse info() {
    return call(
      new GetRequest(path("info")),
      InfoWsResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a POST request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/pause">Further information about this action online (including a response example)</a>
   * @since 7.2
   */
  public void pause() {
    call(
      new PostRequest(path("pause"))
        .setMediaType(MediaTypes.JSON)).content();
  }

  /**
   *
   * This is part of the internal API.
   * This is a POST request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/resume">Further information about this action online (including a response example)</a>
   * @since 7.2
   */
  public void resume() {
    call(
      new PostRequest(path("resume"))
        .setMediaType(MediaTypes.JSON)).content();
  }

  /**
   *
   * This is part of the internal API.
   * This is a POST request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/submit">Further information about this action online (including a response example)</a>
   * @since 5.2
   */
  public SubmitResponse submit(SubmitRequest request) {
    return call(
      new PostRequest(path("submit"))
        .setParam("characteristic", request.getCharacteristic())
        .setParam("projectBranch", request.getProjectBranch())
        .setParam("projectKey", request.getProjectKey())
        .setParam("projectName", request.getProjectName())
        .setParam("report", request.getReport()),
      SubmitResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/task">Further information about this action online (including a response example)</a>
   * @since 5.2
   */
  public TaskResponse task(TaskRequest request) {
    return call(
      new GetRequest(path("task"))
        .setParam("additionalFields", request.getAdditionalFields() == null ? null : request.getAdditionalFields().stream().collect(Collectors.joining(",")))
        .setParam("id", request.getId()),
      TaskResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/task_types">Further information about this action online (including a response example)</a>
   * @since 5.5
   */
  public TaskTypesWsResponse taskTypes() {
    return call(
      new GetRequest(path("task_types")),
      TaskTypesWsResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/ce/worker_count">Further information about this action online (including a response example)</a>
   * @since 6.5
   */
  public WorkerCountResponse workerCount() {
    return call(
      new GetRequest(path("worker_count")),
      WorkerCountResponse.parser());
  }
}