NARKOZ / gitlab

Ruby wrapper and CLI for the GitLab REST API
https://narkoz.github.io/gitlab
BSD 2-Clause "Simplified" License
1.06k stars 394 forks source link

Implementation of merge_request_approvals method #696

Closed fgbreel closed 1 month ago

fgbreel commented 1 month ago

Hi there,

first of all thank you for providing us with a great Gitlab API client for ruby! ❤️

I'm currently using the gitlab gem at version 5.0.0 and trying to get the approved_by field via the API for a merge request (regardless of the existence of rules or not) and I noticed that the method for approvals is currently not implemented.

This is a request similar to https://github.com/NARKOZ/gitlab/issues/564, but for approvals instead of approval_state endpoint.

https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals

GET /projects/:id/merge_requests/:merge_request_iid/approvals
{
  "id": 5,
  "iid": 5,
  "project_id": 1,
  "title": "Approvals API",
  "description": "Test",
  "state": "opened",
  "created_at": "2016-06-08T00:19:52.638Z",
  "updated_at": "2016-06-08T21:20:42.470Z",
  "merge_status": "cannot_be_merged",
  "approvals_required": 2,
  "approvals_left": 1,
  "approved_by": [
    {
      "user": {
        "name": "Administrator",
        "username": "root",
        "id": 1,
        "state": "active",
        "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon",
        "web_url": "http://localhost:3000/root"
      }
    }
  ]
}

Greetings,

Gabriel Francisco

fgbreel commented 1 month ago

My bad, it's indeed already implemented

Thank you again and forgive me for the spam :)