}
public QualitygatesService service() {
- return session.wsClient().qualityGates();
+ return session.wsClient().qualitygates();
}
void deleteAll() {
public Qualitygates.CreateResponse generate() {
int id = ID_GENERATOR.getAndIncrement();
- return session.wsClient().qualityGates().create(new CreateRequest().setName("QualityGate" + id));
+ return session.wsClient().qualitygates().create(new CreateRequest().setName("QualityGate" + id));
}
public void associateProject(Qualitygates.CreateResponse qualityGate, Project project){
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.io.Writer;
-import java.util.HashSet;
import java.util.Properties;
-import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import static java.nio.charset.StandardCharsets.UTF_8;
-import static java.util.Arrays.asList;
+import static org.sonarqube.wsgenerator.Helper.PATH_EXCLUSIONS;
public class CodeFormatter {
- private static final Set<String> PATH_EXCLUSIONS = new HashSet<>(asList("api/orchestrator"));
-
public static void format(String json) {
JsonObject jsonElement = new Gson().fromJson(json, JsonObject.class);
JsonArray webServices = (JsonArray) jsonElement.get("webServices");
Helper helper = new Helper();
+ VelocityContext globalContext = new VelocityContext();
+ globalContext.put("webServices", webServices);
+ globalContext.put("helper", helper);
+ String defaultWsClientCode = applyTemplate("defaultWsClient.vm", globalContext);
+ writeSourceFile(helper.defaultWsClientFile(), defaultWsClientCode);
+ String wsClientCode = applyTemplate("wsClient.vm", globalContext);
+ writeSourceFile(helper.wsClientFile(), wsClientCode);
+ writeSourceFile(helper.packageInfoFile(), applyTemplate("package-info.vm", globalContext));
+
for (JsonElement webServiceElement : webServices) {
JsonObject webService = (JsonObject) webServiceElement;
String webServicePath = webService.get("path").getAsString();
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static java.util.Arrays.asList;
+
public class Helper {
+ static final Set<String> PATH_EXCLUSIONS = new HashSet<>(asList("api/orchestrator"));
private static final String OUTPUT_DIR = "target/generated-sources/results";
private final Map<String, List<String[]>> responseTypes;
.collect(Collectors.groupingBy(arr -> arr[0]));
}
+ public boolean isIncluded(String path) {
+ return !PATH_EXCLUSIONS.contains(path);
+ }
+
+ public String packageName() {
+ return "org.sonarqube.ws.client";
+ }
+
public String packageName(String path) {
- return "org.sonarqube.ws.client." + rawName(path).toLowerCase();
+ return packageName() + "." + rawName(path).toLowerCase();
}
private String rawName(String path) {
String name = rawName(path);
return capitalizeFirstLetter(name) + "Service";
}
+ public String defaultWsClientFieldName(String path) {
+ String name = rawName(path);
+ return lowercaseFirstLetter(name) + "Service";
+ }
+
+ public String defaultWsClientMethodName(String path) {
+ String name = rawName(path);
+ return lowercaseFirstLetter(name);
+ }
+
+ public String webserviceTypeImport(String path) {
+ return "import " + packageName(path) + "." + className(path) + ";";
+ }
private String capitalizeFirstLetter(String name) {
return name.substring(0, 1).toUpperCase() + name.substring(1);
return OUTPUT_DIR + "/org/sonarqube/ws/client/" + rawName(path).toLowerCase() + "/" + className(path) + ".java";
}
+ public String defaultWsClientFile() {
+ return OUTPUT_DIR + "/org/sonarqube/ws/client/DefaultWsClient.java";
+ }
+
+ public String wsClientFile() {
+ return OUTPUT_DIR + "/org/sonarqube/ws/client/WsClient.java";
+ }
+
+ public String packageInfoFile() {
+ return OUTPUT_DIR + "/org/sonarqube/ws/client/package-info.java";
+ }
+
public String packageInfoFile(String path) {
return OUTPUT_DIR + "/org/sonarqube/ws/client/" + rawName(path).toLowerCase() + "/package-info.java";
}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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;
+
+import javax.annotation.Generated;
+import org.sonarqube.ws.client.ce.CeService;
+import org.sonarqube.ws.client.organization.OrganizationService;
+import org.sonarqube.ws.client.projectanalysis.ProjectAnalysisService;
+import org.sonarqube.ws.client.projectbranches.ProjectBranchesServiceOld;
+import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
+import org.sonarqube.ws.client.qualitygates.QualitygatesService;
+import org.sonarqube.ws.client.qualityprofile.QualityProfilesService;
+import org.sonarqube.ws.client.system.SystemServiceOld;
+
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+$helper.webserviceTypeImport($webService.path.asString)
+#end
+#end
+
+/**
+ * This class is not public anymore since version 5.5. It is
+ * created by {@link WsClientFactory}
+ *
+ * @since 5.3
+ */
+@Generated("sonar-ws-generator")
+class DefaultWsClient implements WsClient {
+
+ private final WsConnector wsConnector;
+
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+ private final $helper.className($webService.path.asString) $helper.defaultWsClientFieldName($webService.path.asString);
+#end
+#end
+
+ DefaultWsClient(WsConnector wsConnector) {
+ this.wsConnector = wsConnector;
+
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+ this.$helper.defaultWsClientFieldName($webService.path.asString) = new $helper.className($webService.path.asString)(wsConnector);
+#end
+#end
+ }
+
+ @Override
+ @Deprecated
+ public WsConnector wsConnector() {
+ return wsConnector;
+ }
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+
+ @Override
+ public $helper.className($webService.path.asString) $helper.defaultWsClientMethodName($webService.path.asString)() {
+ return $helper.defaultWsClientFieldName($webService.path.asString);
+ }
+#end
+#end
+}
*/
@ParametersAreNonnullByDefault
@Generated("sonar-ws-generator")
+#if ($webService.path.asString)
package $helper.packageName($webService.path.asString);
+#else
+package $helper.packageName();
+#end
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.Generated;
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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;
+
+import javax.annotation.Generated;
+
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+$helper.webserviceTypeImport($webService.path.asString)
+#end
+#end
+
+/**
+ * Allows to request the web services of SonarQube server. Instance is provided by
+ * {@link WsClientFactory}.
+ *
+ * <p>
+ * Usage:
+ * <pre>
+ * HttpConnector httpConnector = HttpConnector.newBuilder()
+ * .url("http://localhost:9000")
+ * .credentials("admin", "admin")
+ * .build();
+ * WsClient wsClient = WsClientFactories.getDefault().newClient(httpConnector);
+ * wsClient.issues().search(issueRequest);
+ * </pre>
+ * </p>
+ *
+ * @since 5.3
+ */
+@Generated("https://github.com/SonarSource/sonar-ws-generator")
+public interface WsClient {
+
+ WsConnector wsConnector();
+#foreach($webService in $webServices)
+#if ($helper.isIncluded($webService.path.asString))
+
+ $helper.className($webService.path.asString) $helper.defaultWsClientMethodName($webService.path.asString)();
+#end
+#end
+}
*/
package org.sonarqube.ws.client;
+import javax.annotation.Generated;
+import org.sonarqube.ws.client.analysisreports.AnalysisReportsService;
+import org.sonarqube.ws.client.authentication.AuthenticationService;
+import org.sonarqube.ws.client.batch.BatchService;
import org.sonarqube.ws.client.ce.CeService;
import org.sonarqube.ws.client.components.ComponentsService;
+import org.sonarqube.ws.client.custommeasures.CustomMeasuresService;
+import org.sonarqube.ws.client.duplications.DuplicationsService;
+import org.sonarqube.ws.client.editions.EditionsService;
+import org.sonarqube.ws.client.emails.EmailsService;
import org.sonarqube.ws.client.favorites.FavoritesService;
+import org.sonarqube.ws.client.favourites.FavouritesService;
import org.sonarqube.ws.client.issues.IssuesService;
+import org.sonarqube.ws.client.l10n.L10nService;
+import org.sonarqube.ws.client.languages.LanguagesService;
import org.sonarqube.ws.client.measures.MeasuresService;
+import org.sonarqube.ws.client.metrics.MetricsService;
+import org.sonarqube.ws.client.navigation.NavigationService;
import org.sonarqube.ws.client.notifications.NotificationsService;
import org.sonarqube.ws.client.organizations.OrganizationsService;
import org.sonarqube.ws.client.permissions.PermissionsService;
-import org.sonarqube.ws.client.project.ProjectsService;
+import org.sonarqube.ws.client.plugins.PluginsService;
+import org.sonarqube.ws.client.profiles.ProfilesService;
import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
+import org.sonarqube.ws.client.projects.ProjectsService;
+import org.sonarqube.ws.client.projecttags.ProjectTagsService;
+import org.sonarqube.ws.client.properties.PropertiesService;
import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
+import org.sonarqube.ws.client.resources.ResourcesService;
import org.sonarqube.ws.client.roots.RootsService;
import org.sonarqube.ws.client.rules.RulesService;
+import org.sonarqube.ws.client.server.ServerService;
import org.sonarqube.ws.client.settings.SettingsService;
+import org.sonarqube.ws.client.sources.SourcesService;
import org.sonarqube.ws.client.system.SystemService;
-import org.sonarqube.ws.client.user.UsersService;
+import org.sonarqube.ws.client.tests.TestsService;
+import org.sonarqube.ws.client.timemachine.TimemachineService;
+import org.sonarqube.ws.client.updatecenter.UpdatecenterService;
import org.sonarqube.ws.client.usergroups.UserGroupsService;
+import org.sonarqube.ws.client.userproperties.UserPropertiesService;
+import org.sonarqube.ws.client.users.UsersService;
import org.sonarqube.ws.client.usertokens.UserTokensService;
import org.sonarqube.ws.client.webhooks.WebhooksService;
+import org.sonarqube.ws.client.webservices.WebservicesService;
/**
* This class is not public anymore since version 5.5. It is
*
* @since 5.3
*/
+@Generated("sonar-ws-generator")
class DefaultWsClient implements WsClient {
private final WsConnector wsConnector;
- private final OrganizationsService organizations;
- private final PermissionsService permissions;
- private final ComponentsService components;
- private final FavoritesService favoritesService;
- private final QualityprofilesService qualityprofiles;
- private final IssuesService issues;
- private final UsersService usersService;
- private final UserGroupsService userGroupsService;
- private final UserTokensService userTokensService;
- private final QualitygatesService qualityGatesService;
- private final MeasuresService measures;
- private final SystemService systemService;
+
+ private final AnalysisReportsService analysisReportsService;
+ private final AuthenticationService authenticationService;
private final CeService ceService;
- private final RulesService rulesService;
- private final ProjectsService projectsService;
+ private final ComponentsService componentsService;
+ private final CustomMeasuresService customMeasuresService;
+ private final DuplicationsService duplicationsService;
+ private final EditionsService editionsService;
+ private final EmailsService emailsService;
+ private final FavoritesService favoritesService;
+ private final FavouritesService favouritesService;
+ private final IssuesService issuesService;
+ private final L10nService l10nService;
+ private final LanguagesService languagesService;
+ private final MeasuresService measuresService;
+ private final MetricsService metricsService;
+ private final NavigationService navigationService;
+ private final NotificationsService notificationsService;
+ private final OrganizationsService organizationsService;
+ private final PermissionsService permissionsService;
+ private final PluginsService pluginsService;
+ private final ProfilesService profilesService;
+ private final ProjectAnalysesService projectAnalysesService;
+ private final ProjectBranchesService projectBranchesService;
private final ProjectLinksService projectLinksService;
- private final SettingsService settingsService;
+ private final ProjectTagsService projectTagsService;
+ private final ProjectsService projectsService;
+ private final PropertiesService propertiesService;
+ private final QualitygatesService qualitygatesService;
+ private final QualityprofilesService qualityprofilesService;
+ private final ResourcesService resourcesService;
private final RootsService rootsService;
+ private final RulesService rulesService;
+ private final ServerService serverService;
+ private final SettingsService settingsService;
+ private final SourcesService sourcesService;
+ private final SystemService systemService;
+ private final TestsService testsService;
+ private final TimemachineService timemachineService;
+ private final UpdatecenterService updatecenterService;
+ private final UserGroupsService userGroupsService;
+ private final UserPropertiesService userPropertiesService;
+ private final UserTokensService userTokensService;
+ private final UsersService usersService;
private final WebhooksService webhooksService;
- private final ProjectAnalysesService projectAnalyses;
- private final NotificationsService notificationsService;
- private final ProjectBranchesService projectBranchesService;
+ private final WebservicesService webservicesService;
+ private final BatchService batchService;
DefaultWsClient(WsConnector wsConnector) {
this.wsConnector = wsConnector;
- this.organizations = new OrganizationsService(wsConnector);
- this.permissions = new PermissionsService(wsConnector);
- this.components = new ComponentsService(wsConnector);
- this.favoritesService = new FavoritesService(wsConnector);
- this.qualityprofiles = new QualityprofilesService(wsConnector);
- this.issues = new IssuesService(wsConnector);
- this.usersService = new UsersService(wsConnector);
- this.userGroupsService = new UserGroupsService(wsConnector);
- this.userTokensService = new UserTokensService(wsConnector);
- this.qualityGatesService = new QualitygatesService(wsConnector);
- this.measures = new MeasuresService(wsConnector);
- this.systemService = new SystemService(wsConnector);
+
+ this.analysisReportsService = new AnalysisReportsService(wsConnector);
+ this.authenticationService = new AuthenticationService(wsConnector);
this.ceService = new CeService(wsConnector);
- this.rulesService = new RulesService(wsConnector);
- this.projectsService = new ProjectsService(wsConnector);
+ this.componentsService = new ComponentsService(wsConnector);
+ this.customMeasuresService = new CustomMeasuresService(wsConnector);
+ this.duplicationsService = new DuplicationsService(wsConnector);
+ this.editionsService = new EditionsService(wsConnector);
+ this.emailsService = new EmailsService(wsConnector);
+ this.favoritesService = new FavoritesService(wsConnector);
+ this.favouritesService = new FavouritesService(wsConnector);
+ this.issuesService = new IssuesService(wsConnector);
+ this.l10nService = new L10nService(wsConnector);
+ this.languagesService = new LanguagesService(wsConnector);
+ this.measuresService = new MeasuresService(wsConnector);
+ this.metricsService = new MetricsService(wsConnector);
+ this.navigationService = new NavigationService(wsConnector);
+ this.notificationsService = new NotificationsService(wsConnector);
+ this.organizationsService = new OrganizationsService(wsConnector);
+ this.permissionsService = new PermissionsService(wsConnector);
+ this.pluginsService = new PluginsService(wsConnector);
+ this.profilesService = new ProfilesService(wsConnector);
+ this.projectAnalysesService = new ProjectAnalysesService(wsConnector);
+ this.projectBranchesService = new ProjectBranchesService(wsConnector);
this.projectLinksService = new ProjectLinksService(wsConnector);
- this.settingsService = new SettingsService(wsConnector);
+ this.projectTagsService = new ProjectTagsService(wsConnector);
+ this.projectsService = new ProjectsService(wsConnector);
+ this.propertiesService = new PropertiesService(wsConnector);
+ this.qualitygatesService = new QualitygatesService(wsConnector);
+ this.qualityprofilesService = new QualityprofilesService(wsConnector);
+ this.resourcesService = new ResourcesService(wsConnector);
this.rootsService = new RootsService(wsConnector);
+ this.rulesService = new RulesService(wsConnector);
+ this.serverService = new ServerService(wsConnector);
+ this.settingsService = new SettingsService(wsConnector);
+ this.sourcesService = new SourcesService(wsConnector);
+ this.systemService = new SystemService(wsConnector);
+ this.testsService = new TestsService(wsConnector);
+ this.timemachineService = new TimemachineService(wsConnector);
+ this.updatecenterService = new UpdatecenterService(wsConnector);
+ this.userGroupsService = new UserGroupsService(wsConnector);
+ this.userPropertiesService = new UserPropertiesService(wsConnector);
+ this.userTokensService = new UserTokensService(wsConnector);
+ this.usersService = new UsersService(wsConnector);
this.webhooksService = new WebhooksService(wsConnector);
- this.projectAnalyses = new ProjectAnalysesService(wsConnector);
- this.projectBranchesService = new ProjectBranchesService(wsConnector);
- this.notificationsService = new NotificationsService(wsConnector);
+ this.webservicesService = new WebservicesService(wsConnector);
+ this.batchService = new BatchService(wsConnector);
}
@Override
+ @Deprecated
public WsConnector wsConnector() {
return wsConnector;
}
@Override
- public OrganizationsService organizations() {
- return organizations;
+ public AnalysisReportsService analysisReports() {
+ return analysisReportsService;
}
@Override
- public PermissionsService permissions() {
- return permissions;
+ public AuthenticationService authentication() {
+ return authenticationService;
+ }
+
+ @Override
+ public CeService ce() {
+ return ceService;
}
@Override
public ComponentsService components() {
- return components;
+ return componentsService;
+ }
+
+ @Override
+ public CustomMeasuresService customMeasures() {
+ return customMeasuresService;
+ }
+
+ @Override
+ public DuplicationsService duplications() {
+ return duplicationsService;
+ }
+
+ @Override
+ public EditionsService editions() {
+ return editionsService;
+ }
+
+ @Override
+ public EmailsService emails() {
+ return emailsService;
}
@Override
}
@Override
- public QualityprofilesService qualityProfiles() {
- return qualityprofiles;
+ public FavouritesService favourites() {
+ return favouritesService;
}
@Override
public IssuesService issues() {
- return issues;
+ return issuesService;
}
@Override
- public UsersService users() {
- return usersService;
+ public L10nService l10n() {
+ return l10nService;
}
@Override
- public UserGroupsService userGroups() {
- return userGroupsService;
+ public LanguagesService languages() {
+ return languagesService;
}
@Override
- public UserTokensService userTokens() {
- return userTokensService;
+ public MeasuresService measures() {
+ return measuresService;
}
@Override
- public QualitygatesService qualityGates() {
- return qualityGatesService;
+ public MetricsService metrics() {
+ return metricsService;
}
@Override
- public MeasuresService measures() {
- return measures;
+ public NavigationService navigation() {
+ return navigationService;
}
@Override
- public SystemService system() {
- return systemService;
+ public NotificationsService notifications() {
+ return notificationsService;
}
@Override
- public CeService ce() {
- return ceService;
+ public OrganizationsService organizations() {
+ return organizationsService;
}
@Override
- public RulesService rules() {
- return rulesService;
+ public PermissionsService permissions() {
+ return permissionsService;
}
@Override
- public ProjectsService projects() {
- return projectsService;
+ public PluginsService plugins() {
+ return pluginsService;
+ }
+
+ @Override
+ public ProfilesService profiles() {
+ return profilesService;
+ }
+
+ @Override
+ public ProjectAnalysesService projectAnalyses() {
+ return projectAnalysesService;
+ }
+
+ @Override
+ public ProjectBranchesService projectBranches() {
+ return projectBranchesService;
}
@Override
}
@Override
- public SettingsService settings() {
- return settingsService;
+ public ProjectTagsService projectTags() {
+ return projectTagsService;
+ }
+
+ @Override
+ public ProjectsService projects() {
+ return projectsService;
+ }
+
+ @Override
+ public PropertiesService properties() {
+ return propertiesService;
+ }
+
+ @Override
+ public QualitygatesService qualitygates() {
+ return qualitygatesService;
+ }
+
+ @Override
+ public QualityprofilesService qualityprofiles() {
+ return qualityprofilesService;
+ }
+
+ @Override
+ public ResourcesService resources() {
+ return resourcesService;
}
@Override
}
@Override
- public WebhooksService webhooks() {
- return webhooksService;
+ public RulesService rules() {
+ return rulesService;
}
@Override
- public ProjectAnalysesService projectAnalyses() {
- return projectAnalyses;
+ public ServerService server() {
+ return serverService;
}
@Override
- public ProjectBranchesService projectBranches() {
- return projectBranchesService;
+ public SettingsService settings() {
+ return settingsService;
}
@Override
- public NotificationsService notifications() {
- return notificationsService;
+ public SourcesService sources() {
+ return sourcesService;
+ }
+
+ @Override
+ public SystemService system() {
+ return systemService;
+ }
+
+ @Override
+ public TestsService tests() {
+ return testsService;
+ }
+
+ @Override
+ public TimemachineService timemachine() {
+ return timemachineService;
+ }
+
+ @Override
+ public UpdatecenterService updatecenter() {
+ return updatecenterService;
+ }
+
+ @Override
+ public UserGroupsService userGroups() {
+ return userGroupsService;
+ }
+
+ @Override
+ public UserPropertiesService userProperties() {
+ return userPropertiesService;
+ }
+
+ @Override
+ public UserTokensService userTokens() {
+ return userTokensService;
+ }
+
+ @Override
+ public UsersService users() {
+ return usersService;
+ }
+
+ @Override
+ public WebhooksService webhooks() {
+ return webhooksService;
+ }
+
+ @Override
+ public WebservicesService webservices() {
+ return webservicesService;
+ }
+
+ @Override
+ public BatchService batch() {
+ return batchService;
}
}
*/
package org.sonarqube.ws.client;
+import javax.annotation.Generated;
+
+import org.sonarqube.ws.client.analysisreports.AnalysisReportsService;
+import org.sonarqube.ws.client.authentication.AuthenticationService;
import org.sonarqube.ws.client.ce.CeService;
import org.sonarqube.ws.client.components.ComponentsService;
+import org.sonarqube.ws.client.custommeasures.CustomMeasuresService;
+import org.sonarqube.ws.client.duplications.DuplicationsService;
+import org.sonarqube.ws.client.editions.EditionsService;
+import org.sonarqube.ws.client.emails.EmailsService;
import org.sonarqube.ws.client.favorites.FavoritesService;
+import org.sonarqube.ws.client.favourites.FavouritesService;
import org.sonarqube.ws.client.issues.IssuesService;
+import org.sonarqube.ws.client.l10n.L10nService;
+import org.sonarqube.ws.client.languages.LanguagesService;
import org.sonarqube.ws.client.measures.MeasuresService;
+import org.sonarqube.ws.client.metrics.MetricsService;
+import org.sonarqube.ws.client.navigation.NavigationService;
import org.sonarqube.ws.client.notifications.NotificationsService;
import org.sonarqube.ws.client.organizations.OrganizationsService;
import org.sonarqube.ws.client.permissions.PermissionsService;
-import org.sonarqube.ws.client.project.ProjectsService;
+import org.sonarqube.ws.client.plugins.PluginsService;
+import org.sonarqube.ws.client.profiles.ProfilesService;
import org.sonarqube.ws.client.projectanalyses.ProjectAnalysesService;
import org.sonarqube.ws.client.projectbranches.ProjectBranchesService;
import org.sonarqube.ws.client.projectlinks.ProjectLinksService;
+import org.sonarqube.ws.client.projecttags.ProjectTagsService;
+import org.sonarqube.ws.client.projects.ProjectsService;
+import org.sonarqube.ws.client.properties.PropertiesService;
import org.sonarqube.ws.client.qualitygates.QualitygatesService;
import org.sonarqube.ws.client.qualityprofiles.QualityprofilesService;
+import org.sonarqube.ws.client.resources.ResourcesService;
import org.sonarqube.ws.client.roots.RootsService;
import org.sonarqube.ws.client.rules.RulesService;
+import org.sonarqube.ws.client.server.ServerService;
import org.sonarqube.ws.client.settings.SettingsService;
+import org.sonarqube.ws.client.sources.SourcesService;
import org.sonarqube.ws.client.system.SystemService;
-import org.sonarqube.ws.client.user.UsersService;
+import org.sonarqube.ws.client.tests.TestsService;
+import org.sonarqube.ws.client.timemachine.TimemachineService;
+import org.sonarqube.ws.client.updatecenter.UpdatecenterService;
import org.sonarqube.ws.client.usergroups.UserGroupsService;
+import org.sonarqube.ws.client.userproperties.UserPropertiesService;
import org.sonarqube.ws.client.usertokens.UserTokensService;
+import org.sonarqube.ws.client.users.UsersService;
import org.sonarqube.ws.client.webhooks.WebhooksService;
+import org.sonarqube.ws.client.webservices.WebservicesService;
+import org.sonarqube.ws.client.batch.BatchService;
/**
* Allows to request the web services of SonarQube server. Instance is provided by
*
* @since 5.3
*/
+@Generated("https://github.com/SonarSource/sonar-ws-generator")
public interface WsClient {
- OrganizationsService organizations();
+ WsConnector wsConnector();
+
+ AnalysisReportsService analysisReports();
+
+ AuthenticationService authentication();
+
+ CeService ce();
ComponentsService components();
+ CustomMeasuresService customMeasures();
+
+ DuplicationsService duplications();
+
+ EditionsService editions();
+
+ EmailsService emails();
+
FavoritesService favorites();
+ FavouritesService favourites();
+
IssuesService issues();
+ L10nService l10n();
+
+ LanguagesService languages();
+
+ MeasuresService measures();
+
+ MetricsService metrics();
+
+ NavigationService navigation();
+
NotificationsService notifications();
+ OrganizationsService organizations();
+
PermissionsService permissions();
- QualityprofilesService qualityProfiles();
+ PluginsService plugins();
- UsersService users();
+ ProfilesService profiles();
- UserGroupsService userGroups();
+ ProjectAnalysesService projectAnalyses();
- UserTokensService userTokens();
+ ProjectBranchesService projectBranches();
- QualitygatesService qualityGates();
+ ProjectLinksService projectLinks();
- MeasuresService measures();
+ ProjectTagsService projectTags();
- SystemService system();
+ ProjectsService projects();
- CeService ce();
+ PropertiesService properties();
- RulesService rules();
+ QualitygatesService qualitygates();
- WsConnector wsConnector();
+ QualityprofilesService qualityprofiles();
- /**
- * @since 5.5
- */
- ProjectsService projects();
+ ResourcesService resources();
- /**
- * @since 6.1
- */
- ProjectLinksService projectLinks();
+ RootsService roots();
+
+ RulesService rules();
+
+ ServerService server();
- /**
- * @since 6.1
- */
SettingsService settings();
- /**
- * @since 6.2
- */
- RootsService roots();
+ SourcesService sources();
+
+ SystemService system();
+
+ TestsService tests();
+
+ TimemachineService timemachine();
+
+ UpdatecenterService updatecenter();
+
+ UserGroupsService userGroups();
+
+ UserPropertiesService userProperties();
+
+ UserTokensService userTokens();
+
+ UsersService users();
- /**
- * @since 6.2
- */
WebhooksService webhooks();
- ProjectAnalysesService projectAnalyses();
+ WebservicesService webservices();
- /**
- * @since 6.6>
- */
- ProjectBranchesService projectBranches();
+ BatchService batch();
}
import java.util.stream.Collectors;
import javax.annotation.Generated;
+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;
import org.sonarqube.ws.Issues.AddCommentResponse;
import org.sonarqube.ws.Issues.AssignResponse;
import org.sonarqube.ws.Issues.AuthorsResponse;
import org.sonarqube.ws.Issues.SetTagsResponse;
import org.sonarqube.ws.Issues.SetTypeResponse;
import org.sonarqube.ws.Issues.TagsResponse;
-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/issues">Further information about this web service online</a>
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
@ParametersAreNonnullByDefault
+@Generated("sonar-ws-generator")
package org.sonarqube.ws.client;
import javax.annotation.ParametersAreNonnullByDefault;
+import javax.annotation.Generated;
import org.sonarqube.ws.client.GetRequest;
import org.sonarqube.ws.client.PostRequest;
import org.sonarqube.ws.client.WsConnector;
-import org.sonarqube.ws.Qualitygates.AppResponse;
import org.sonarqube.ws.Qualitygates.CreateResponse;
import org.sonarqube.ws.Qualitygates.CreateConditionResponse;
import org.sonarqube.ws.Qualitygates.GetByProjectResponse;
+import org.sonarqube.ws.Qualitygates.ListWsResponse;
import org.sonarqube.ws.Qualitygates.ProjectStatusResponse;
+import org.sonarqube.ws.Qualitygates.ShowWsResponse;
import org.sonarqube.ws.Qualitygates.UpdateConditionResponse;
/**
super(wsConnector, "api/qualitygates");
}
- /**
- *
- * This is part of the internal API.
- * This is a GET request.
- * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/app">Further information about this action online (including a response example)</a>
- * @since 4.3
- */
- public AppResponse app() {
- return call(
- new GetRequest(path("app")),
- AppResponse.parser());
- }
-
/**
*
* This is part of the internal API.
* @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/list">Further information about this action online (including a response example)</a>
* @since 4.3
*/
- public String list() {
+ public ListWsResponse list() {
return call(
- new GetRequest(path("list"))
- .setMediaType(MediaTypes.JSON)
- ).content();
+ new GetRequest(path("list")),
+ ListWsResponse.parser());
}
/**
* @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/show">Further information about this action online (including a response example)</a>
* @since 4.3
*/
- public String show(ShowRequest request) {
+ public ShowWsResponse show(ShowRequest request) {
return call(
new GetRequest(path("show"))
.setParam("id", request.getId())
- .setParam("name", request.getName())
- .setMediaType(MediaTypes.JSON)
- ).content();
+ .setParam("name", request.getName()),
+ ShowWsResponse.parser());
}
/**
* This is a POST request.
* @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/qualitygates/unset_default">Further information about this action online (including a response example)</a>
* @since 4.3
+ * @deprecated since 7.0
*/
- public void unsetDefault(UnsetDefaultRequest request) {
- call(
+ @Deprecated
+ public String unsetDefault() {
+ return call(
new PostRequest(path("unset_default"))
- .setParam("id", request.getId())
.setMediaType(MediaTypes.JSON)
).content();
}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/change_password">Further information about this action online (including a response example)</a>
+ * @since 5.2
+ */
+@Generated("sonar-ws-generator")
+public class ChangePasswordRequest {
+
+ private String login;
+ private String password;
+ private String previousPassword;
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "myuser"
+ */
+ public ChangePasswordRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "mypassword"
+ */
+ public ChangePasswordRequest setPassword(String password) {
+ this.password = password;
+ return this;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Example value: "oldpassword"
+ */
+ public ChangePasswordRequest setPreviousPassword(String previousPassword) {
+ this.previousPassword = previousPassword;
+ return this;
+ }
+
+ public String getPreviousPassword() {
+ return previousPassword;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/create">Further information about this action online (including a response example)</a>
+ * @since 3.7
+ */
+@Generated("sonar-ws-generator")
+public class CreateRequest {
+
+ private String email;
+ private String local;
+ private String login;
+ private String name;
+ private String password;
+ private String scmAccount;
+ private String scmAccounts;
+
+ /**
+ * Example value: "myname@email.com"
+ */
+ public CreateRequest setEmail(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ * Possible values:
+ * <ul>
+ * <li>"true"</li>
+ * <li>"false"</li>
+ * <li>"yes"</li>
+ * <li>"no"</li>
+ * </ul>
+ */
+ public CreateRequest setLocal(String local) {
+ this.local = local;
+ return this;
+ }
+
+ public String getLocal() {
+ return local;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "myuser"
+ */
+ public CreateRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "My Name"
+ */
+ public CreateRequest setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Example value: "mypassword"
+ */
+ public CreateRequest setPassword(String password) {
+ this.password = password;
+ return this;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ /**
+ * Example value: "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue"
+ */
+ public CreateRequest setScmAccount(String scmAccount) {
+ this.scmAccount = scmAccount;
+ return this;
+ }
+
+ public String getScmAccount() {
+ return scmAccount;
+ }
+
+ /**
+ * Example value: "myscmaccount1,myscmaccount2"
+ * @deprecated since 6.1
+ */
+ @Deprecated
+ public CreateRequest setScmAccounts(String scmAccounts) {
+ this.scmAccounts = scmAccounts;
+ return this;
+ }
+
+ public String getScmAccounts() {
+ return scmAccounts;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/deactivate">Further information about this action online (including a response example)</a>
+ * @since 3.7
+ */
+@Generated("sonar-ws-generator")
+public class DeactivateRequest {
+
+ private String login;
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "myuser"
+ */
+ public DeactivateRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/groups">Further information about this action online (including a response example)</a>
+ * @since 5.2
+ */
+@Generated("sonar-ws-generator")
+public class GroupsRequest {
+
+ private String login;
+ private String organization;
+ private String p;
+ private String ps;
+ private String q;
+ private String selected;
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "admin"
+ */
+ public GroupsRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * This is part of the internal API.
+ * Example value: "my-org"
+ */
+ public GroupsRequest setOrganization(String organization) {
+ this.organization = organization;
+ return this;
+ }
+
+ public String getOrganization() {
+ return organization;
+ }
+
+ /**
+ * Example value: "42"
+ */
+ public GroupsRequest setP(String p) {
+ this.p = p;
+ return this;
+ }
+
+ public String getP() {
+ return p;
+ }
+
+ /**
+ * Example value: "20"
+ */
+ public GroupsRequest setPs(String ps) {
+ this.ps = ps;
+ return this;
+ }
+
+ public String getPs() {
+ return ps;
+ }
+
+ /**
+ * Example value: "users"
+ */
+ public GroupsRequest setQ(String q) {
+ this.q = q;
+ return this;
+ }
+
+ public String getQ() {
+ return q;
+ }
+
+ /**
+ * Possible values:
+ * <ul>
+ * <li>"all"</li>
+ * <li>"deselected"</li>
+ * <li>"selected"</li>
+ * </ul>
+ */
+ public GroupsRequest setSelected(String selected) {
+ this.selected = selected;
+ return this;
+ }
+
+ public String getSelected() {
+ return selected;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/search">Further information about this action online (including a response example)</a>
+ * @since 3.6
+ */
+@Generated("sonar-ws-generator")
+public class SearchRequest {
+
+ private List<String> f;
+ private String p;
+ private String ps;
+ private String q;
+
+ /**
+ * Possible values:
+ * <ul>
+ * <li>"name"</li>
+ * <li>"email"</li>
+ * <li>"avatart"</li>
+ * <li>"scmAccounts"</li>
+ * <li>"groups"</li>
+ * <li>"active"</li>
+ * <li>"local"</li>
+ * <li>"externalIdentity"</li>
+ * <li>"externalProvider"</li>
+ * </ul>
+ * @deprecated since 5.4
+ */
+ @Deprecated
+ public SearchRequest setF(List<String> f) {
+ this.f = f;
+ return this;
+ }
+
+ public List<String> getF() {
+ return f;
+ }
+
+ /**
+ * Example value: "42"
+ */
+ public SearchRequest setP(String p) {
+ this.p = p;
+ return this;
+ }
+
+ public String getP() {
+ return p;
+ }
+
+ /**
+ * Example value: "20"
+ */
+ public SearchRequest setPs(String ps) {
+ this.ps = ps;
+ return this;
+ }
+
+ public String getPs() {
+ return ps;
+ }
+
+ /**
+ */
+ public SearchRequest setQ(String q) {
+ this.q = q;
+ return this;
+ }
+
+ public String getQ() {
+ return q;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.users;
+
+import java.util.List;
+import javax.annotation.Generated;
+
+/**
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/update">Further information about this action online (including a response example)</a>
+ * @since 3.7
+ */
+@Generated("sonar-ws-generator")
+public class UpdateRequest {
+
+ private String email;
+ private String login;
+ private String name;
+ private String scmAccount;
+ private String scmAccounts;
+
+ /**
+ * Example value: "myname@email.com"
+ */
+ public UpdateRequest setEmail(String email) {
+ this.email = email;
+ return this;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ /**
+ * This is a mandatory parameter.
+ * Example value: "myuser"
+ */
+ public UpdateRequest setLogin(String login) {
+ this.login = login;
+ return this;
+ }
+
+ public String getLogin() {
+ return login;
+ }
+
+ /**
+ * Example value: "My Name"
+ */
+ public UpdateRequest setName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Example value: "scmAccount=firstValue&scmAccount=secondValue&scmAccount=thirdValue"
+ */
+ public UpdateRequest setScmAccount(String scmAccount) {
+ this.scmAccount = scmAccount;
+ return this;
+ }
+
+ public String getScmAccount() {
+ return scmAccount;
+ }
+
+ /**
+ * Example value: "myscmaccount1,myscmaccount2"
+ * @deprecated since 6.1
+ */
+ @Deprecated
+ public UpdateRequest setScmAccounts(String scmAccounts) {
+ this.scmAccounts = scmAccounts;
+ return this;
+ }
+
+ public String getScmAccounts() {
+ return scmAccounts;
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.users;
+
+import java.util.stream.Collectors;
+import javax.annotation.Generated;
+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;
+import org.sonarqube.ws.Users.CreateWsResponse;
+import org.sonarqube.ws.Users.CurrentWsResponse;
+import org.sonarqube.ws.Users.GroupsWsResponse;
+import org.sonarqube.ws.Users.IdentityProvidersWsResponse;
+import org.sonarqube.ws.Users.SearchWsResponse;
+
+/**
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users">Further information about this web service online</a>
+ */
+@Generated("sonar-ws-generator")
+public class UsersService extends BaseService {
+
+ public UsersService(WsConnector wsConnector) {
+ super(wsConnector, "api/users");
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/change_password">Further information about this action online (including a response example)</a>
+ * @since 5.2
+ */
+ public void changePassword(ChangePasswordRequest request) {
+ call(
+ new PostRequest(path("change_password"))
+ .setParam("login", request.getLogin())
+ .setParam("password", request.getPassword())
+ .setParam("previousPassword", request.getPreviousPassword())
+ .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/users/create">Further information about this action online (including a response example)</a>
+ * @since 3.7
+ */
+ public void create(CreateRequest request) {
+ call(
+ new PostRequest(path("create"))
+ .setParam("email", request.getEmail())
+ .setParam("local", request.getLocal())
+ .setParam("login", request.getLogin())
+ .setParam("name", request.getName())
+ .setParam("password", request.getPassword())
+ .setParam("scmAccount", request.getScmAccount())
+ .setParam("scmAccounts", request.getScmAccounts()),
+ CreateWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a GET request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/current">Further information about this action online (including a response example)</a>
+ * @since 5.2
+ */
+ public CurrentWsResponse current() {
+ return call(
+ new GetRequest(path("current")),
+ CurrentWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/deactivate">Further information about this action online (including a response example)</a>
+ * @since 3.7
+ */
+ public String deactivate(DeactivateRequest request) {
+ return call(
+ new PostRequest(path("deactivate"))
+ .setParam("login", request.getLogin())
+ .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/users/groups">Further information about this action online (including a response example)</a>
+ * @since 5.2
+ */
+ public GroupsWsResponse groups(GroupsRequest request) {
+ return call(
+ new GetRequest(path("groups"))
+ .setParam("login", request.getLogin())
+ .setParam("organization", request.getOrganization())
+ .setParam("p", request.getP())
+ .setParam("ps", request.getPs())
+ .setParam("q", request.getQ())
+ .setParam("selected", request.getSelected()),
+ GroupsWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a GET request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/identity_providers">Further information about this action online (including a response example)</a>
+ * @since 5.5
+ */
+ public IdentityProvidersWsResponse identityProviders() {
+ return call(
+ new GetRequest(path("identity_providers")),
+ IdentityProvidersWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a GET request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/search">Further information about this action online (including a response example)</a>
+ * @since 3.6
+ */
+ public SearchWsResponse search(SearchRequest request) {
+ return call(
+ new GetRequest(path("search"))
+ .setParam("f", request.getF() == null ? null : request.getF().stream().collect(Collectors.joining(",")))
+ .setParam("p", request.getP())
+ .setParam("ps", request.getPs())
+ .setParam("q", request.getQ()),
+ SearchWsResponse.parser());
+ }
+
+ /**
+ *
+ * This is part of the internal API.
+ * This is a POST request.
+ * @see <a href="https://next.sonarqube.com/sonarqube/web_api/api/users/skip_onboarding_tutorial">Further information about this action online (including a response example)</a>
+ * @since 6.5
+ */
+ public void skipOnboardingTutorial() {
+ call(
+ new PostRequest(path("skip_onboarding_tutorial"))
+ .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/users/update">Further information about this action online (including a response example)</a>
+ * @since 3.7
+ */
+ public String update(UpdateRequest request) {
+ return call(
+ new PostRequest(path("update"))
+ .setParam("email", request.getEmail())
+ .setParam("login", request.getLogin())
+ .setParam("name", request.getName())
+ .setParam("scmAccount", request.getScmAccount())
+ .setParam("scmAccounts", request.getScmAccounts())
+ .setMediaType(MediaTypes.JSON)
+ ).content();
+ }
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2017 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.
+ */
+@ParametersAreNonnullByDefault
+@Generated("sonar-ws-generator")
+package org.sonarqube.ws.client.users;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+import javax.annotation.Generated;
+
Project project = tester.projects().provision(organization);
Qualitygates.CreateResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
- Qualitygates.CreateConditionResponse condition = tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ Qualitygates.CreateConditionResponse condition = tester.wsClient().qualitygates().createCondition(new CreateConditionRequest()
.setGateId(String.valueOf(qualityGate.getId()))
.setMetric("new_coverage")
.setOp("LT")
assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", true);
// small leak => if coverage is OK anyways, we do not have to ignore anything
- tester.wsClient().qualityGates().updateCondition(new UpdateConditionRequest()
+ tester.wsClient().qualitygates().updateCondition(new UpdateConditionRequest()
.setId(String.valueOf(condition.getId()))
.setMetric("new_coverage")
.setOp("LT")
assertIgnoredConditions("qualitygate/small-changesets/v2-1019-lines", false);
// big leak => use usual behaviour
- tester.wsClient().qualityGates().updateCondition(new UpdateConditionRequest()
+ tester.wsClient().qualitygates().updateCondition(new UpdateConditionRequest()
.setId(String.valueOf(condition.getId()))
.setMetric("new_coverage")
.setOp("LT")
private void assertIgnoredConditions(String projectDir, boolean expected) throws IOException {
String analysisId = getAnalysisId(getTaskIdInLocalReport(projectDir(projectDir)));
- boolean ignoredConditions = tester.wsClient().qualityGates()
+ boolean ignoredConditions = tester.wsClient().qualitygates()
.projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId))
.getProjectStatus()
.getIgnoredConditions();
Project project = tester.projects().provision(organization);
Qualitygates.CreateResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
- tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ tester.wsClient().qualitygates().createCondition(new CreateConditionRequest()
.setGateId(String.valueOf(qualityGate.getId()))
.setMetric("new_coverage")
.setOp("LT")
Qualitygates.CreateResponse qualityGate2 = tester.qGates().generate();
tester.qGates().associateProject(qualityGate2, project);
- tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ tester.wsClient().qualitygates().createCondition(new CreateConditionRequest()
.setGateId(String.valueOf(qualityGate2.getId()))
.setMetric("new_coverage")
.setOp("LT")
}
private void associateWithQualityGate(QualityGate qualityGate) {
- tester.wsClient().qualityGates().select(new SelectRequest().setProjectKey("sample").setGateId(String.valueOf(qualityGate.id())));
+ tester.wsClient().qualitygates().select(new SelectRequest().setProjectKey("sample").setGateId(String.valueOf(qualityGate.id())));
}
private QualityGateClient qualityGateClient() {
Qualitygates.CreateResponse qualityGate = tester.qGates().generate();
tester.qGates().associateProject(qualityGate, project);
tester.settings().setGlobalSetting("sonar.leak.period", "previous_version");
- tester.wsClient().qualityGates().createCondition(new CreateConditionRequest()
+ tester.wsClient().qualitygates().createCondition(new CreateConditionRequest()
.setGateId(String.valueOf(qualityGate.getId()))
.setMetric("new_security_rating")
.setOp("GT")
String taskId = getTaskIdInLocalReport(projectDir("qualitygate/xoo-sample"));
String analysisId = getAnalysisId(taskId);
- ProjectStatusResponse projectStatusWsResponse = tester.wsClient().qualityGates().projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId));
+ ProjectStatusResponse projectStatusWsResponse = tester.wsClient().qualitygates().projectStatus(new ProjectStatusRequest().setAnalysisId(analysisId));
ProjectStatusResponse.ProjectStatus projectStatus = projectStatusWsResponse.getProjectStatus();
assertThat(projectStatus.getStatus()).isEqualTo(ERROR);
assertThat(projectStatus.getConditionsCount()).isEqualTo(1);
createCustomIntMetric(customMetricKey);
try {
// create quality gate
- Qualitygates.CreateResponse simple = tester.wsClient().qualityGates().create(new CreateRequest().setName("OnCustomMetric"));
+ Qualitygates.CreateResponse simple = tester.wsClient().qualitygates().create(new CreateRequest().setName("OnCustomMetric"));
Long qualityGateId = simple.getId();
qgClient().createCondition(NewCondition.create(qualityGateId).metricKey(customMetricKey).operator("GT").warningThreshold("40"));
deleteCustomMetric(customMetricKey);
// run analysis
- tester.wsClient().qualityGates().select(new SelectRequest().setProjectKey(projectKey).setGateId(String.valueOf(qualityGateId)));
+ tester.wsClient().qualitygates().select(new SelectRequest().setProjectKey(projectKey).setGateId(String.valueOf(qualityGateId)));
BuildResult buildResult = executeAnalysis(projectKey);
// verify quality gate