Skip to content

Commit

Permalink
feat: award emojis on merge requests
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Cerdic committed Feb 19, 2024
1 parent 93f0181 commit 2c714c9
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion src/Api/MergeRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -576,4 +612,4 @@ public function deleteLevelRule($project_id, int $mr_iid, int $approval_rule_id)
{
return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/approval_rules/'.self::encodePath($approval_rule_id)));
}
}
}

0 comments on commit 2c714c9

Please sign in to comment.