Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.12] Add support for additional parameters in Projects::labels and Groups::labels #765

Merged
merged 1 commit into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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