Skip to content

Commit 2c714c9

Browse files
committed
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
1 parent 93f0181 commit 2c714c9

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/Api/MergeRequests.php

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,18 @@ public function awardEmoji($project_id, int $mr_iid)
470470
return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji'));
471471
}
472472

473+
/**
474+
* @param int|string $project_id
475+
* @param int $mr_iid
476+
* @param string $name
477+
*
478+
* @return mixed
479+
*/
480+
public function addAwardEmoji($project_id, int $mr_iid, string $name)
481+
{
482+
return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji'), ['name' => $name]);
483+
}
484+
473485
/**
474486
* @param int|string $project_id
475487
* @param int $mr_iid
@@ -482,6 +494,30 @@ public function removeAwardEmoji($project_id, int $mr_iid, int $award_id)
482494
return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/award_emoji/'.self::encodePath($award_id)));
483495
}
484496

497+
/**
498+
* @param int|string $project_id
499+
* @param int $mr_iid
500+
* @param int $note_id
501+
*
502+
* @return mixed
503+
*/
504+
public function showNoteAwardEmoji($project_id, int $mr_iid, int $note_id)
505+
{
506+
return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id).'/award_emoji'));
507+
}
508+
509+
/**
510+
* @param int|string $project_id
511+
* @param int $mr_iid
512+
* @param string $name
513+
*
514+
* @return mixed
515+
*/
516+
public function addNoteAwardEmoji($project_id, int $mr_iid, int $note_id, string $name)
517+
{
518+
return $this->post($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/notes/'.self::encodePath($note_id).'/award_emoji'), ['name' => $name]);
519+
}
520+
485521
/**
486522
* @param int|string $project_id
487523
* @param int $mr_iid
@@ -576,4 +612,4 @@ public function deleteLevelRule($project_id, int $mr_iid, int $approval_rule_id)
576612
{
577613
return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_rules/'.self::encodePath($approval_rule_id)));
578614
}
579-
}
615+
}

0 commit comments

Comments
 (0)