stable

Clone or download

Read-only

REST routes to add/remove labels

This is part of story #10498: Add labels on pull requests ..IMPORTANT: https://gerrit.tuleap.net/9364 is needed for this. PATCH /pull_requests/:id/labels { "add": [ { "id": 1 }, { "id": 2 } ] } Will add label #1 and #2 to the PR :id. --- PATCH /pull_requests/:id/labels { "add": [ { "id": 1 }, { "label": "Emergency Fix" } ] } Will create project label "Emergency Fix" (id #3) and add labels #1 and #3 to the PR :id --- PATCH /pull_requests/:id/labels { "add": [ { "label": "Emergency Fix" } ] } PATCH /pull_requests/:id/labels { "add": [ { "label": "Emergency Fix" } ] } Calling twice the same route will not create two labels. --- PATCH /pull_requests/:id/labels { "remove": [ { "id": 1 }, { "id": 2 } ] } Will remove label #1 and #2 from the PR :id but does not remove it from project. --- PATCH /pull_requests/:id/labels { "add": [ { "id": 1 }, { "label": "Emergency Fix" } ], "remove": [ { "id": 2 } ] } Will create "Emergency Fix" in project, add it with #1 to the pull request and will remove the label #2. --- PATCH /pull_requests/:id/labels { "add": [ { "id": 1 }, ], "remove": [ { "id": 1 } ] } Will fail since we cannot add and remove a label at the same time. Change-Id: I1b6a14faa0048987435fedcae4d22b3cb10b5b3e

Modified Files

Name
D include/PullRequest/Label/LabelDao.php +0 −44 Go to diff View file
M include/PullRequest/Label/LabelsCurlyCoatedRetriever.php +2 −2 Go to diff View file
A include/PullRequest/Label/PullRequestLabelDao.php +104 −0 Go to diff View file
M include/PullRequest/PullRequest.php +4 −2 Go to diff View file
D include/PullRequest/REST/v1/LabelRepresentation.php +0 −42 Go to diff View file
M include/PullRequest/REST/v1/PullRequestsResource.php +89 −5 Go to diff View file
M include/autoload.php +3 −4 Go to diff View file
M tests/rest/PullRequest/PullRequestsLabelsTest.php +84 −1 Go to diff View file