From c119a4f907c5c4f5149d96dbd3b051f564af5f06 Mon Sep 17 00:00:00 2001 From: dpi Date: Sat, 20 Jan 2024 00:35:17 +0800 Subject: [PATCH 1/3] groups has this `last_activity_after` param despite it not documented, perhaps it inherits from projects? --- src/Api/Groups.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 5a97e0cf..3ae44825 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -320,6 +320,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') @@ -367,6 +370,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)); } From f5306e92c6dbd6b17edb1b2866046926e9344439 Mon Sep 17 00:00:00 2001 From: dpi Date: Sat, 20 Jan 2024 22:32:57 +0800 Subject: [PATCH 2/3] more issues. --- src/Api/Groups.php | 1 + src/Api/Projects.php | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 3ae44825..8d0c567f 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -310,6 +310,7 @@ public function removeMember($group_id, int $user_id) * @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 \DateTimeInterface $last_activity_after Limit by projects with last_activity after specified time * } * * @return mixed diff --git a/src/Api/Projects.php b/src/Api/Projects.php index d0c66833..c6c31afd 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -348,11 +348,12 @@ 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 = []) { @@ -361,7 +362,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') From 704f0eda1ff0afa337aab760bef4c5c9bdb1fe84 Mon Sep 17 00:00:00 2001 From: dpi Date: Thu, 25 Apr 2024 18:11:14 +0800 Subject: [PATCH 3/3] linting --- src/Api/Groups.php | 2 +- src/Api/Projects.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 8d0c567f..89fbdd20 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -309,7 +309,7 @@ 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 * } * diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 95f39709..53751275 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -350,10 +350,9 @@ public function enableRunner(int $project_id, int $runner_id) * @var string $order_by order pipelines by id, status, ref, updated_at, or user_id (default: id) * @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_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. * } - * */ public function pipelines($project_id, array $parameters = []) {