001/*
002 * SonarQube
003 * Copyright (C) 2009-2016 SonarSource SA
004 * mailto:contact AT sonarsource DOT com
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020package org.sonarqube.ws.client.qualitygate;
021
022import org.sonarqube.ws.WsQualityGates.ProjectStatusWsResponse;
023import org.sonarqube.ws.client.BaseService;
024import org.sonarqube.ws.client.GetRequest;
025import org.sonarqube.ws.client.WsConnector;
026
027import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_ANALYSIS_ID;
028import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_ID;
029import static org.sonarqube.ws.client.qualitygate.QualityGatesWsParameters.PARAM_PROJECT_KEY;
030
031public class QualityGatesService extends BaseService {
032
033  public QualityGatesService(WsConnector wsConnector) {
034    super(wsConnector, "api/qualitygates");
035  }
036
037  public ProjectStatusWsResponse projectStatus(ProjectStatusWsRequest request) {
038    return call(new GetRequest(path("project_status"))
039      .setParam(PARAM_ANALYSIS_ID, request.getAnalysisId())
040      .setParam(PARAM_PROJECT_ID, request.getProjectId())
041      .setParam(PARAM_PROJECT_KEY, request.getProjectKey()),
042      ProjectStatusWsResponse.parser());
043  }
044}