Add further info of the commit's author to the Branches API response
(As per @DouweM's suggestion while answering a question/need re: https://gitlab.com/gitlab-org/gitlab-ce/issues/44833)
Currently the endpoint GET /projects/:id/repository/branches/:branch
(doc) is missing important and often used information about the author of the latest commit on that branch.
The avatar is going to be useful in several cases to present the author's information in a recognisable way. The additional info is to allow quickly
Missing info:
"gitlab_user_id": 12345,
"gitlab_username": "john_smith",
"avatar_url": "https://secure.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=46&d=identicon",
Of course gitlab_* are only for the case when the commit's author is a gitlab user.
The user ID might be useful to be able to get further details via GET /users/:id
https://docs.gitlab.com/ce/api/users.html#for-user
Currently
{
"name": "master",
"merged": false,
"protected": true,
"developers_can_push": false,
"developers_can_merge": false,
"commit": {
"author_email": "john@example.com",
"author_name": "John Smith",
"authored_date": "2012-06-27T05:51:39-07:00",
"committed_date": "2012-06-28T03:44:20-07:00",
"committer_email": "john@example.com",
"committer_name": "John Smith",
"id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c",
"short_id": "7b5c3cc",
"title": "add projects API",
"message": "add projects API",
"parent_ids": [
"4ad91d3c1144c406e50c7b33bae684bd6837faf8"
]
}
}
Proposal
{
"name": "master",
"merged": false,
"protected": true,
"developers_can_push": false,
"developers_can_merge": false,
"commit": {
"author_email": "john@example.com",
"author_name": "John Smith",
"gitlab_user_id": 12345,
"gitlab_username": "john_smith",
"avatar_url": "https://secure.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=46&d=identicon",
"authored_date": "2012-06-27T05:51:39-07:00",
"committed_date": "2012-06-28T03:44:20-07:00",
"committer_email": "john@example.com",
"committer_name": "John Smith",
"id": "7b5c3cc8be40ee161ae89a06bba6229da1032a0c",
"short_id": "7b5c3cc",
"title": "add projects API",
"message": "add projects API",
"parent_ids": [
"4ad91d3c1144c406e50c7b33bae684bd6837faf8"
]
}
}
Edited by André Luís