Skip to content

Commit 3b35c14

Browse files
Add method to access repository/commits/.../discussions (#501)
Co-authored-by: Graham Campbell <[email protected]>
1 parent d556a61 commit 3b35c14

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/Gitlab/Api/Projects.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,25 @@ public function boards($project_id)
521521
return $this->get($this->getProjectPath($project_id, 'boards'));
522522
}
523523

524+
/**
525+
* Gets a list of all discussion items for a single commit.
526+
*
527+
* Example:
528+
* - https://gitlab.com/gitlab-org/gitlab/-/commit/695c29abcf7dc2eabde8d59869abcea0923ce8fa#note_334686748
529+
* - https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab/repository/commits/695c29abcf7dc2eabde8d59869abcea0923ce8fa/discussions
530+
*
531+
* @see https://docs.gitlab.com/ee/api/discussions.html#list-project-commit-discussion-items
532+
*
533+
* @param int|string $project_id
534+
* @param string $commit_id
535+
*
536+
* @return mixed
537+
*/
538+
public function getRepositoryCommitDiscussions($project_id, $commit_id)
539+
{
540+
return $this->get($this->getProjectPath($project_id, 'repository/commits/' . $this->encodePath($commit_id)) . '/discussions');
541+
}
542+
524543
/**
525544
* @param int|string $project_id
526545
* @param string $url

0 commit comments

Comments
 (0)