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

Collection of missing/incorrect parameters #806

Open
wants to merge 4 commits into
base: 11.14
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion src/Api/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ public function removeMember($group_id, int $user_id)
* @var bool $with_merge_requests_enabled Limit by projects with merge requests feature enabled (default is false)
* @var bool $with_shared Include projects shared to this group (default is true)
* @var bool $include_subgroups Include projects in subgroups of this group (default is false)
* @var bool $with_custom_attributes Include custom attributes in response (admins only).
* @var bool $with_custom_attributes Include custom attributes in response (admins only)
* @var \DateTimeInterface $last_activity_after Limit by projects with last_activity after specified time
* }
*
* @return mixed
Expand All @@ -320,6 +321,9 @@ public function projects($id, array $parameters = [])
$booleanNormalizer = function (Options $resolver, $value): string {
return $value ? 'true' : 'false';
};
$datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string {
return $value->format('c');
};

$resolver->setDefined('archived')
->setAllowedTypes('archived', 'bool')
Expand Down Expand Up @@ -367,6 +371,10 @@ public function projects($id, array $parameters = [])
->setAllowedTypes('with_custom_attributes', 'bool')
->setNormalizer('with_custom_attributes', $booleanNormalizer)
;
$resolver->setDefined('last_activity_after')
->setAllowedTypes('last_activity_after', \DateTimeInterface::class)
->setNormalizer('last_activity_after', $datetimeNormalizer)
;

return $this->get('groups/'.self::encodePath($id).'/projects', $resolver->resolve($parameters));
}
Expand Down
8 changes: 4 additions & 4 deletions src/Api/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ public function enableRunner(int $project_id, int $runner_id)
* @var string $name the name of the user who triggered pipelines
* @var string $username the username of the user who triggered pipelines
* @var string $order_by order pipelines by id, status, ref, updated_at, or user_id (default: id)
* @var string $order sort pipelines in asc or desc order (default: desc)
* @var string $sort sort pipelines in asc or desc order (default: desc)
* @var string $source the source of the pipeline
* @var \DateTimeInterface $updated_after Return pipelines updated on or after the given date and time
* @var \DateTimeInterface $updated_before Return pipelines updated on or before the given date and time.
* }
*
* @return mixed
*/
public function pipelines($project_id, array $parameters = [])
{
Expand All @@ -361,7 +361,7 @@ public function pipelines($project_id, array $parameters = [])
return $value ? 'true' : 'false';
};
$datetimeNormalizer = function (Options $resolver, \DateTimeInterface $value): string {
return $value->format('Y-m-d');
return $value->format('c');
};

$resolver->setDefined('scope')
Expand Down