All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonarqube.ws.client.ce.CeService Maven / Gradle / Ivy

There is a newer version: 10.7.0.96327
Show newest version
/*
 * SonarQube
 * Copyright (C) 2009-2023 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 javax.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 Further information about this web service online
 */
@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 Further information about this action online (including a response example)
   * @since 5.2
   */
  public ActivityResponse activity(ActivityRequest request) {
    return call(
      new GetRequest(path("activity"))
        .setParam("componentId", request.getComponentId())
        .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 Further information about this action online (including a response example)
   * @since 5.5
   */
  public ActivityStatusWsResponse activityStatus(ActivityStatusRequest request) {
    return call(
      new GetRequest(path("activity_status"))
        .setParam("componentId", request.getComponentId())
        .setParam("componentKey", request.getComponentKey()),
      ActivityStatusWsResponse.parser());
  }

  /**
   *
   * This is part of the internal API.
   * This is a GET request.
   * @see Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @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 Further information about this action online (including a response example)
   * @since 6.5
   */
  public WorkerCountResponse workerCount() {
    return call(
      new GetRequest(path("worker_count")),
      WorkerCountResponse.parser());
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy