From 22caa2c743b03d684147841afe106cadc9c4a29a Mon Sep 17 00:00:00 2001 From: Cerdic Date: Mon, 19 Feb 2024 16:22:02 +0100 Subject: [PATCH] feat: award emojis on merge requests methods addAwardEmoji() to append an emoji on a merge request, and showNoteAwardEmoji() and addNoteAwardEmoji() to see and append emoji on comments on a merge request --- src/Api/MergeRequests.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/Api/MergeRequests.php b/src/Api/MergeRequests.php index ed3779f6..33259932 100644 --- a/src/Api/MergeRequests.php +++ b/src/Api/MergeRequests.php @@ -470,6 +470,18 @@ public function awardEmoji($project_id, int $mr_iid) return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji')); } + /** + * @param int|string $project_id + * @param int $mr_iid + * @param string $name + * + * @return mixed + */ + public function addAwardEmoji($project_id, int $mr_iid, string $name) + { + return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji'), ['name' => $name]); + } + /** * @param int|string $project_id * @param int $mr_iid @@ -482,6 +494,30 @@ public function removeAwardEmoji($project_id, int $mr_iid, int $award_id) return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji/'.self::encodePath($award_id))); } + /** + * @param int|string $project_id + * @param int $mr_iid + * @param int $note_id + * + * @return mixed + */ + public function showNoteAwardEmoji($project_id, int $mr_iid, int $note_id) + { + return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id).'/award_emoji')); + } + + /** + * @param int|string $project_id + * @param int $mr_iid + * @param string $name + * + * @return mixed + */ + public function addNoteAwardEmoji($project_id, int $mr_iid, int $note_id, string $name) + { + return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id).'/award_emoji'), ['name' => $name]); + } + /** * @param int|string $project_id * @param int $mr_iid