Add REST endpoint to get a label definition of a project

Bug: Issue 11522
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I41e5c015d6067653c5794595df5ba7b97ca679a3
This commit is contained in:
Edwin Kempin
2019-10-25 08:40:24 +02:00
parent b527526e2a
commit aa56f445d3
16 changed files with 510 additions and 67 deletions

View File

@@ -3093,6 +3093,52 @@ Labels that belong to the same project are sorted by label name.
]
----
[[get-label]]
=== Get Label
--
'GET /projects/link:#project-name[\{project-name\}]/labels/link:#label-name[\{label-name\}]'
--
Retrieves the definition of a label that is defined in this project.
The calling user must have read access to the `refs/meta/config` branch of the
project.
.Request
----
GET /projects/All-Projects/labels/Code-Review HTTP/1.0
----
As response a link:#label-definition-info[LabelDefinitionInfo] entity is
returned that describes the label.
.Response
----
HTTP/1.1 200 OK
Content-Disposition: attachment
Content-Type: application/json; charset=UTF-8
)]}'
{
"name": "Code-Review",
"project": "All-Projects",
"function": "MaxWithBlock",
"values": {
" 0": "No score",
"-1": "I would prefer this is not merged as is",
"-2": "This shall not be merged",
"+1": "Looks good to me, but someone else must approve",
"+2": "Looks good to me, approved"
},
"default_value": 0,
"can_override": true,
"copy_min_score": true,
"copy_all_scores_if_no_change": true,
"copy_all_scores_on_trivial_rebase": true,
"allow_post_submit": true
}
----
[[ids]]
== IDs
@@ -3117,6 +3163,10 @@ The ID of a dashboard in the format '<ref>:<path>'.
A special dashboard ID is `default` which represents the default
dashboard of a project.
[[label-name]]
=== \{label-name\}
The name of a review label.
[[project-name]]
=== \{project-name\}
The name of the project.