Skip to content

Commit

Permalink
Add support for additional parameters in Projects::labels and `Grou…
Browse files Browse the repository at this point in the history
…ps::labels` (#765)

Co-authored-by: Remi FUSSIEN <[email protected]>
  • Loading branch information
rfussien and Remi FUSSIEN authored Oct 8, 2023
1 parent d4b9a8f commit b682054
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
24 changes: 23 additions & 1 deletion src/Api/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,36 @@ public function issues($group_id, array $parameters = [])

/**
* @param int|string $group_id
* @param array $parameters
* @param array $parameters {
*
* @var bool $with_counts Whether or not to include issue and merge request counts. Defaults to false.
* @var bool $include_ancestor_groups Include ancestor groups. Defaults to true.
* @var bool $include_descendant_groups Include descendant groups. Defaults to false.
* @var bool $only_group_labels Toggle to include only group labels or also project labels. Defaults to true.
* @var string $search Keyword to filter labels by.
* }
*
* @return mixed
*/
public function labels($group_id, array $parameters = [])
{
$resolver = $this->createOptionsResolver();

$resolver->setDefined('with_counts')
->setAllowedTypes('with_counts', 'bool');

$resolver->setDefined('include_ancestor_groups')
->setAllowedTypes('include_ancestor_groups', 'bool');

$resolver->setDefined('include_descendant_groups')
->setAllowedTypes('include_descendant_groups', 'bool');

$resolver->setDefined('only_group_labels')
->setAllowedTypes('only_group_labels', 'bool');

$resolver->setDefined('search')
->setAllowedTypes('search', 'string');

return $this->get('groups/'.self::encodePath($group_id).'/labels', $resolver->resolve($parameters));
}

Expand Down
16 changes: 15 additions & 1 deletion src/Api/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -976,14 +976,28 @@ public function events($project_id, array $parameters = [])

/**
* @param int|string $project_id
* @param array $parameters
* @param array $parameters {
*
* @var bool $with_counts Whether or not to include issue and merge request counts. Defaults to false.
* @var bool $include_ancestor_groups Include ancestor groups. Defaults to true.
* @var string $search Keyword to filter labels by.
* }
*
* @return mixed
*/
public function labels($project_id, array $parameters = [])
{
$resolver = $this->createOptionsResolver();

$resolver->setDefined('with_counts')
->setAllowedTypes('with_counts', 'bool');

$resolver->setDefined('include_ancestor_groups')
->setAllowedTypes('include_ancestor_groups', 'bool');

$resolver->setDefined('search')
->setAllowedTypes('search', 'string');

return $this->get($this->getProjectPath($project_id, 'labels'), $resolver->resolve($parameters));
}

Expand Down

0 comments on commit b682054

Please sign in to comment.