예제 #1
0
  @Override
  public void define(Context context) {
    NewController controller = context.createController("api/authentication");
    controller.setDescription("Handle authentication.");

    defineLoginAction(controller);
    defineValidateAction(controller);

    controller.done();
  }
예제 #2
0
 @Override
 public void define(Context context) {
   NewController controller = context.createController(API_ENDPOINT);
   controller.setDescription("Coding rule issues");
   controller.setSince("3.6");
   for (IssuesWsAction action : actions) {
     action.define(controller);
   }
   defineRailsActions(controller);
   controller.done();
 }
예제 #3
0
  @Override
  public void define(Context context) {
    NewController controller =
        context
            .createController("api/timemachine")
            .setDescription("Get a list of past measures")
            .setSince("2.10");

    defineSystemAction(controller);

    controller.done();
  }
예제 #4
0
 @Override
 public void define(Context context) {
   NewController controller =
       context
           .createController("api/sources")
           .setSince("4.2")
           .setDescription("Display sources information");
   for (SourcesWsAction action : actions) {
     action.define(controller);
   }
   controller.done();
 }
예제 #5
0
  @Override
  public void define(Context context) {
    NewController controller =
        context.createController(API_ENDPOINT).setDescription("Quality Profiles").setSince("4.4");

    ruleActivationActions.define(controller);
    bulkRuleActivationActions.define(controller);
    projectAssociationActions.define(controller);
    for (QProfileWsAction action : actions) {
      action.define(controller);
    }

    controller.done();
  }
예제 #6
0
  private void defineSystemAction(NewController controller) {
    NewAction action =
        controller
            .createAction("index")
            .setDescription("Get a list of past measures. Requires Browse permission on project")
            .setSince("2.10")
            .setHandler(RailsHandler.INSTANCE)
            .setResponseExample(
                Resources.getResource(this.getClass(), "timemachine-example-index.json"));

    action
        .createParam("resource")
        .setDescription("id or key of the resource (ie: component)")
        .setRequired(true)
        .setExampleValue(KEY_PROJECT_EXAMPLE_001);

    action
        .createParam("metrics")
        .setDescription(
            "Comma-separated list of <a href=\"http://redirect.sonarsource.com/doc/metric-definitions.html\">metric keys/ids</a>")
        .setRequired(true)
        .setExampleValue("coverage,violations");

    action
        .createParam("fromDateTime")
        .setDescription("ISO-8601 datetime (inclusive)")
        .setExampleValue("2010-12-25T23:59:59+0100");

    action
        .createParam("toDateTime")
        .setDescription("ISO-8601 datetime (inclusive)")
        .setExampleValue("2010-12-25T23:59:59+0100");

    action.createParam("format").setDescription("Response format").setPossibleValues("json", "csv");
  }
예제 #7
0
 private static void defineLoginAction(NewController controller) {
   NewAction action =
       controller
           .createAction("login")
           .setDescription("Authenticate a user.")
           .setSince("6.0")
           .setPost(true)
           .setHandler(ServletFilterHandler.INSTANCE);
   action.createParam("login").setDescription("Login of the user").setRequired(true);
   action.createParam("password").setDescription("Password of the user").setRequired(true);
 }
예제 #8
0
  private void defineValidateAction(NewController controller) {
    NewAction action =
        controller
            .createAction("validate")
            .setDescription("Check credentials.")
            .setSince("3.3")
            .setHandler(ServletFilterHandler.INSTANCE)
            .setResponseExample(Resources.getResource(this.getClass(), "example-validate.json"));

    RailsHandler.addFormatParam(action);
  }
예제 #9
0
  private static void defineBulkChangeAction(NewController controller) {
    WebService.NewAction action =
        controller
            .createAction(BULK_CHANGE_ACTION)
            .setDescription(
                "Bulk change on issues. Requires authentication and User role on project(s)")
            .setSince("3.7")
            .setHandler(RailsHandler.INSTANCE)
            .setPost(true);

    action
        .createParam("issues")
        .setDescription("Comma-separated list of issue keys")
        .setRequired(true)
        .setExampleValue(
            "01fc972e-2a3c-433e-bcae-0bd7f88f5123,01fc972e-2a3c-433e-bcae-0bd7f88f9999");
    action
        .createParam("actions")
        .setDescription(
            "Comma-separated list of actions to perform. Possible values: assign | set_severity | plan | do_transition")
        .setRequired(true)
        .setExampleValue("assign,plan");
    action
        .createParam("assign.assignee")
        .setDescription(
            "To assign the list of issues to a specific user (login), or un-assign all the issues")
        .setExampleValue("john.smith");
    action
        .createParam("set_severity.severity")
        .setDescription("To change the severity of the list of issues")
        .setExampleValue(Severity.BLOCKER)
        .setPossibleValues(Severity.ALL);
    action
        .createParam("plan.plan")
        .setDescription(
            "To plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan")
        .setExampleValue("3f19de90-1521-4482-a737-a311758ff513");
    action
        .createParam("do_transition.transition")
        .setDescription("Transition")
        .setExampleValue("reopen")
        .setPossibleValues(DefaultTransitions.ALL);
    action
        .createParam("comment")
        .setDescription("To add a comment to a list of issues")
        .setExampleValue("Here is my comment");
    action
        .createParam("sendNotifications")
        .setDescription("Available since version 4.0")
        .setDefaultValue("false")
        .setPossibleValues("true", "false");
    RailsHandler.addFormatParam(action);
  }
예제 #10
0
  private static void defineChangelogAction(NewController controller) {
    WebService.NewAction action =
        controller
            .createAction(CHANGELOG_ACTION)
            .setDescription("Display changelog of an issue")
            .setSince("4.1")
            .setHandler(RailsHandler.INSTANCE)
            .setResponseExample(Resources.getResource(IssuesWs.class, "example-changelog.json"));

    action
        .createParam("issue")
        .setDescription("Key of the issue")
        .setRequired(true)
        .setExampleValue("5bccd6e8-f525-43a2-8d76-fcb13dde79ef");
    RailsHandler.addFormatParam(action);
  }
예제 #11
0
  private static void defineTransitionsAction(NewController controller) {
    WebService.NewAction action =
        controller
            .createAction(TRANSITIONS_ACTION)
            .setDescription(
                "Get Possible Workflow Transitions for an Issue. Requires Browse permission on project")
            .setSince("3.6")
            .setHandler(RailsHandler.INSTANCE)
            .setResponseExample(Resources.getResource(IssuesWs.class, "example-transitions.json"));

    action
        .createParam("issue")
        .setDescription("Key of the issue")
        .setRequired(true)
        .setExampleValue("5bccd6e8-f525-43a2-8d76-fcb13dde79ef");
  }
예제 #12
0
  private static void defineDeleteCommentAction(NewController controller) {
    WebService.NewAction action =
        controller
            .createAction(DELETE_COMMENT_ACTION)
            .setDescription(
                "Delete a comment. Requires authentication and Browse permission on project")
            .setSince("3.6")
            .setHandler(RailsHandler.INSTANCE)
            .setPost(true);

    action
        .createParam("key")
        .setDescription("Key of the comment")
        .setRequired(true)
        .setExampleValue("392160d3-a4f2-4c52-a565-e4542cfa2096");
  }
예제 #13
0
  private static void defineEditCommentAction(NewController controller) {
    WebService.NewAction action =
        controller
            .createAction(EDIT_COMMENT_ACTION)
            .setDescription("Edit a comment. Requires authentication and User role on project")
            .setSince("3.6")
            .setHandler(RailsHandler.INSTANCE)
            .setPost(true);

    action
        .createParam("key")
        .setDescription("Key of the comment")
        .setRequired(true)
        .setExampleValue("392160d3-a4f2-4c52-a565-e4542cfa2096");
    action.createParam("text").setDescription("New comment").setExampleValue("blabla2...");
    RailsHandler.addFormatParam(action);
  }
예제 #14
0
  private static void defineAddCommentAction(NewController controller) {
    WebService.NewAction action =
        controller
            .createAction(ADD_COMMENT_ACTION)
            .setDescription(
                "Add a comment. Requires authentication and Browse permission on project")
            .setSince("3.6")
            .setHandler(RailsHandler.INSTANCE)
            .setPost(true);

    action
        .createParam("issue")
        .setDescription("Key of the issue")
        .setRequired(true)
        .setExampleValue("5bccd6e8-f525-43a2-8d76-fcb13dde79ef");
    action.createParam("text").setDescription("Comment").setExampleValue("blabla...");
    RailsHandler.addFormatParam(action);
  }