return this;
}
+ /**
+ * Internal actions are not displayed by default in the web api documentation. They are
+ * displayed only when the check-box "Show Internal API" is selected. By default
+ * an action is not internal.
+ */
public NewAction setInternal(boolean b) {
this.isInternal = b;
return this;
return post;
}
+ /**
+ * @see NewAction#setInternal(boolean)
+ */
public boolean isInternal() {
return isInternal;
}
private String exampleValue;
private String defaultValue;
private boolean required = false;
+ private boolean internal = false;
private Set<String> possibleValues = null;
private NewParam(String key) {
return this;
}
+ /**
+ * Internal parameters are not displayed by default in the web api documentation. They are
+ * displayed only when the check-box "Show Internal API" is selected. By default
+ * a parameter is not internal.
+ *
+ * @since 6.2
+ */
+ public NewParam setInternal(boolean b) {
+ this.internal = b;
+ return this;
+ }
+
/**
* @since 4.4
*/
private final String exampleValue;
private final String defaultValue;
private final boolean required;
+ private final boolean internal;
private final Set<String> possibleValues;
protected Param(Action action, NewParam newParam) {
this.exampleValue = newParam.exampleValue;
this.defaultValue = newParam.defaultValue;
this.required = newParam.required;
+ this.internal = newParam.internal;
this.possibleValues = newParam.possibleValues;
if (required && defaultValue != null) {
throw new IllegalArgumentException(format("Default value must not be set on parameter '%s?%s' as it's marked as required", action, key));
return required;
}
+ /**
+ * Is the parameter internal ?
+ *
+ * @since 6.2
+ * @see NewParam#setInternal(boolean)
+ */
+ public boolean isInternal() {
+ return internal;
+ }
+
/**
* @since 4.4
*/
.setDeprecatedSince("5.3")
.setDeprecatedKey("old-severity")
.setPossibleValues("INFO", "MAJOR", "BLOCKER");
+ newAction.createParam("internal")
+ .setInternal(true);
newAction.addPagingParams(20);
newAction.addFieldsParam(Arrays.asList("name", "severity"));
newAction.addSortParams(Arrays.asList("name", "updatedAt", "severity"), "updatedAt", false);
}.define(context);
WebService.Action action = context.controller("api/rule").action("create");
- assertThat(action.params()).hasSize(7);
+ assertThat(action.params()).hasSize(8);
WebService.Param keyParam = action.param("key");
assertThat(keyParam.key()).isEqualTo("key");
assertThat(keyParam.description()).isEqualTo("Key of the new rule");
+ assertThat(keyParam.isInternal()).isFalse();
assertThat(keyParam.toString()).isEqualTo("key");
WebService.Param severityParam = action.param("severity");
assertThat(severityParam.defaultValue()).isEqualTo("MAJOR");
assertThat(severityParam.possibleValues()).containsOnly("INFO", "MAJOR", "BLOCKER");
+ WebService.Param internalParam = action.param("internal");
+ assertThat(internalParam.isInternal()).isTrue();
+
// predefined fields
assertThat(action.param("p").defaultValue()).isEqualTo("1");
assertThat(action.param("p").description()).isNotEmpty();