@Override public void define(WebService.NewController controller) { NewAction action = controller .createAction("tags") .setDescription("List rule tags") .setSince("4.4") .setHandler(this) .setResponseExample(Resources.getResource(getClass(), "tags-example.json")); action.createSearchQuery("misra", "tags"); action.createPageSize(10, 100); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setRequired(false) .setInternal(true) .setExampleValue("my-org") .setSince("6.4"); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("groups") .setSince("5.2") .setInternal(true) .setDescription("Lists the groups with their permissions.<br>" + "This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br> " + "This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>" + "Requires one of the following permissions:" + "<ul>" + "<li>'Administer System'</li>" + "<li>'Administer' rights on the specified project</li>" + "</ul>") .addPagingParams(DEFAULT_PAGE_SIZE, RESULTS_MAX_SIZE) .setChangelog( new Change("7.4", "The response list is returning all groups even those without permissions, the groups with permission are at the top of the list.")) .setResponseExample(Resources.getResource(getClass(), "groups-example.json")) .setHandler(this); action.createSearchQuery("sonar", "names") .setDescription("Limit search to group names that contain the supplied string.") .setMinimumLength(SEARCH_QUERY_MIN_LENGTH); createOrganizationParameter(action).setSince("6.2"); wsParameters.createPermissionParameter(action).setRequired(false); createProjectParameters(action); }
@Override public void define(WebService.NewController controller) { NewAction action = controller.createAction("tags") .setHandler(this) .setSince("5.1") .setDescription("List tags matching a given query") .setResponseExample(Resources.getResource(getClass(), "tags-example.json")) .setChangelog(new Change("7.4", "Result doesn't include rules tags anymore")); action.createSearchQuery("misra", "tags"); action.createPageSize(10, 100); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setRequired(false) .setInternal(true) .setExampleValue("my-org") .setSince("6.4"); action.createParam(PARAM_PROJECT) .setDescription("Project key") .setRequired(false) .setExampleValue(KEY_PROJECT_EXAMPLE_001) .setSince("7.4"); }
@Override public void define(NewController controller) { NewAction action = controller.createAction("projects") .setSince("5.2") .setHandler(this) .setDescription("List projects with their association status regarding a quality profile") .setResponseExample(getClass().getResource("projects-example.json")); action.setChangelog( new Change("7.2", "'more' response field is deprecated"), new Change("6.5", "'id' response field is deprecated"), new Change("6.0", "'uuid' response field is deprecated and replaced by 'id'"), new Change("6.0", "'key' response field has been added to return the project key")); action.createParam(PARAM_KEY) .setDescription("Quality profile key") .setRequired(true) .setExampleValue(UUID_EXAMPLE_01); action.addSelectionModeParam(); action.createSearchQuery("sonar", "projects") .setDeprecatedKey("query", "6.5"); action.createPageParam() .setDeprecatedKey("page", "6.5"); action.createPageSize(100, MAX_PAGE_SIZE); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("groups") .setSince("5.2") .setInternal(true) .setDescription("Lists the groups with their permissions.<br>" + "This service defaults to global permissions, but can be limited to project permissions by providing project id or project key.<br> " + "This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission.<br>" + "Requires one of the following permissions:" + "<ul>" + "<li>'Administer System'</li>" + "<li>'Administer' rights on the specified project</li>" + "</ul>") .addPagingParams(DEFAULT_PAGE_SIZE, RESULTS_MAX_SIZE) .setResponseExample(Resources.getResource(getClass(), "groups-example.json")) .setHandler(this); action.createSearchQuery("sonar", "names") .setDescription("Limit search to group names that contain the supplied string. When this parameter is not set, only groups having at least one permission are returned.") .setMinimumLength(SEARCH_QUERY_MIN_LENGTH); createOrganizationParameter(action).setSince("6.2"); createPermissionParameter(action).setRequired(false); createProjectParameters(action); }
@Override public void define(WebService.NewController controller) { NewAction action = controller .createAction("tags") .setDescription("List rule tags") .setSince("4.4") .setHandler(this) .setResponseExample(Resources.getResource(getClass(), "example-tags.json")); action.createSearchQuery("misra", "tags"); action.createPageSize(10, 100); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setRequired(false) .setInternal(true) .setExampleValue("my-org") .setSince("6.4"); }
@Override public void define(WebService.NewController controller) { NewAction action = controller.createAction("tags") .setHandler(this) .setSince("5.1") .setDescription("List tags matching a given query") .setResponseExample(Resources.getResource(getClass(), "tags-example.json")); action.createSearchQuery("misra", "tags"); action.createPageSize(10, 100); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setRequired(false) .setInternal(true) .setExampleValue("my-org") .setSince("6.4"); }
/** * Creates the parameter {@link org.sonar.api.server.ws.WebService.Param#TEXT_QUERY}, which is * used to search for a subset of fields containing the supplied string. * <p> * The fields must be in the <strong>plural</strong> form (ex: "names", "keys"). * </p> */ public NewAction addSearchQuery(String exampleValue, String... pluralFields) { createSearchQuery(exampleValue, pluralFields); return this; }
@Override public void define(WebService.NewController controller) { NewAction action = controller.createAction("authors") .setSince("5.1") .setDescription("Search SCM accounts which match a given query.<br/>" + "Requires authentication.") .setResponseExample(Resources.getResource(this.getClass(), "authors-example.json")) .setChangelog(new Change("7.4", "The maximum size of 'ps' is set to 100")) .setHandler(this); action.createSearchQuery("luke", "authors"); action.createPageSize(10, 100); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setRequired(false) .setInternal(true) .setExampleValue("my-org") .setSince("7.4"); action.createParam(PARAM_PROJECT) .setDescription("Project key") .setRequired(false) .setExampleValue(KEY_PROJECT_EXAMPLE_001) .setSince("7.4"); }
@Override public void define(NewController controller) { NewAction action = controller.createAction("projects") .setSince("5.2") .setHandler(this) .setDescription("List projects with their association status regarding a quality profile") .setResponseExample(getClass().getResource("projects-example.json")); action.setChangelog( new Change("7.2", "'more' response field is deprecated"), new Change("6.5", "'id' response field is deprecated"), new Change("6.0", "'uuid' response field is deprecated and replaced by 'id'"), new Change("6.0", "'key' response field has been added to return the project key")); action.createParam(PARAM_KEY) .setDescription("Quality profile key") .setRequired(true) .setExampleValue(UUID_EXAMPLE_01); action.addSelectionModeParam(); action.createSearchQuery("sonar", "projects") .setDeprecatedKey("query", "6.5"); action.createPageParam() .setDeprecatedKey("page", "6.5"); action.createPageSize(100, MAX_PAGE_SIZE); }
@Override public void define(WebService.NewController context) { WebService.NewAction action = context.createAction("search_members") .setDescription("Search members of an organization.<br/>" + "Require organization membership.") .setResponseExample(getClass().getResource("search_members-example.json")) .setSince("6.4") .setInternal(true) .setChangelog(new Change("7.3", "This action now requires organization membership")) .setHandler(this); action.createSearchQuery("orwe", "names", "logins") .setMinimumLength(2); action.addPagingParams(50, MAX_LIMIT); action.createParam(Param.SELECTED) .setDescription("Depending on the value, show only selected items (selected=selected) or deselected items (selected=deselected).") .setInternal(true) .setDefaultValue(SELECTED.value()) .setPossibleValues(SELECTED.value(), SelectionMode.DESELECTED.value()); action.createParam(PARAM_ORGANIZATION) .setDescription("Organization key") .setInternal(true) .setRequired(false); }
/** * Creates the parameter {@link org.sonar.api.server.ws.WebService.Param#TEXT_QUERY}, which is * used to search for a subset of fields containing the supplied string. * <p> * The fields must be in the <strong>plural</strong> form (ex: "names", "keys"). * </p> */ public NewAction addSearchQuery(String exampleValue, String... pluralFields) { createSearchQuery(exampleValue, pluralFields); return this; }