From a2b1d2d5d5e66b532c37fa2397512db80808ce92 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 25 Apr 2022 21:07:49 -0500 Subject: [PATCH 01/11] add groups iterations --- src/Api/Groups.php | 31 +++++++++++++++++++++++++++++++ tests/Api/GroupsTest.php | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 798871de..bc7ac625 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -618,6 +618,37 @@ public function mergeRequests($group_id, array $parameters = []) return $this->get('groups/'.self::encodePath($group_id).'/merge_requests', $resolver->resolve($parameters)); } + /** + * @param int|string $group_id + * @param array $parameters { + * + * @var string $state Return opened, upcoming, current (previously started), closed, or all iterations. + * Filtering by started state is deprecated starting with 14.1, please use current instead. + * @var string $search Return only iterations with a title matching the provided string. + * @var bool $include_ancestors Include iterations from parent group and its ancestors. Defaults to true. + * } + * + * @return mixed + */ + public function iterations($group_id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + + $resolver->setDefined('state') + ->setAllowedValues('state', ['opened', 'upcoming', 'current (previously started)', 'closed', 'all']) + ; + $resolver->setDefined('include_ancestors') + ->setAllowedTypes('include_ancestors', 'bool') + ->setNormalizer('include_ancestors', $booleanNormalizer) + ->setDefault('include_ancestors', true) + ; + + return $this->get('groups/'.self::encodePath($group_id).'/iterations', $resolver->resolve($parameters)); + } + /** * @param int|string $group_id * @param array $parameters { diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 59329d9d..fdb6b0fd 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -676,6 +676,38 @@ public function shouldGetAllGroupProjectsIncludingCustomAttributes(): void $this->assertEquals($expectedArray, $api->projects(1, ['with_custom_attributes' => true])); } + /** + * @test + */ + public function shouldGetIterations(): void + { + $expectedArray = [ + [ + "id" => 5, + "iid" => 2, + "sequence" => 1, + "group_id" => 123, + "title" => "2022: Sprint 1", + "description" => "", + "state" => 3, + "created_at" => "2021-09-29T21:24:43.913Z", + "updated_at" => "2022-03-29T19:09:08.368Z", + "start_date" => "2022-01-10", + "due_date" => "2022-01-23", + "web_url" => "https://example.com/groups/example/-/iterations/34", + ] + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/iterations') + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->iterations(1)); + } + /** * @test */ From 0f9f8b11d432e6bcb33c78b8c6ae8c99f6b307f0 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 25 Apr 2022 21:12:53 -0500 Subject: [PATCH 02/11] add project iterations --- src/Api/Projects.php | 31 +++++++++++++++++++++++++++++++ tests/Api/ProjectsTest.php | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/src/Api/Projects.php b/src/Api/Projects.php index ab2d4b77..de7ff66d 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -652,6 +652,37 @@ public function boards($project_id) return $this->get($this->getProjectPath($project_id, 'boards')); } + /** + * @param int|string $project_id + * @param array $parameters { + * + * @var string $state Return opened, upcoming, current (previously started), closed, or all iterations. + * Filtering by started state is deprecated starting with 14.1, please use current instead. + * @var string $search Return only iterations with a title matching the provided string. + * @var bool $include_ancestors Include iterations from parent group and its ancestors. Defaults to true. + * } + * + * @return mixed + */ + public function iterations($project_id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + + $resolver->setDefined('state') + ->setAllowedValues('state', ['opened', 'upcoming', 'current (previously started)', 'closed', 'all']) + ; + $resolver->setDefined('include_ancestors') + ->setAllowedTypes('include_ancestors', 'bool') + ->setNormalizer('include_ancestors', $booleanNormalizer) + ->setDefault('include_ancestors', true) + ; + + return $this->get('projects/'.self::encodePath($project_id).'/iterations', $resolver->resolve($parameters)); + } + /** * Gets a list of all discussion items for a single commit. * diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 7fd019bf..0d85b249 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -673,6 +673,38 @@ public function getProjectBoardsExpectedArray() ]; } + /** + * @test + */ + public function shouldGetIterations(): void + { + $expectedArray = [ + [ + "id" => 5, + "iid" => 2, + "sequence" => 1, + "group_id" => 123, + "title" => "2022: Sprint 1", + "description" => "", + "state" => 3, + "created_at" => "2021-09-29T21:24:43.913Z", + "updated_at" => "2022-03-29T19:09:08.368Z", + "start_date" => "2022-01-10", + "due_date" => "2022-01-23", + "web_url" => "https://example.com/groups/example/-/iterations/34", + ] + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('projects/1/iterations') + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->iterations(1)); + } + /** * @test */ From a550144fbb3aa735c46699f6845fd2c9fbf81ba8 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 25 Apr 2022 21:16:28 -0500 Subject: [PATCH 03/11] update for styleci --- src/Api/Groups.php | 2 +- src/Api/Projects.php | 2 +- tests/Api/GroupsTest.php | 26 +++++++++++++------------- tests/Api/ProjectsTest.php | 26 +++++++++++++------------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index bc7ac625..12b8c0fc 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -624,7 +624,7 @@ public function mergeRequests($group_id, array $parameters = []) * * @var string $state Return opened, upcoming, current (previously started), closed, or all iterations. * Filtering by started state is deprecated starting with 14.1, please use current instead. - * @var string $search Return only iterations with a title matching the provided string. + * @var string $search return only iterations with a title matching the provided string * @var bool $include_ancestors Include iterations from parent group and its ancestors. Defaults to true. * } * diff --git a/src/Api/Projects.php b/src/Api/Projects.php index de7ff66d..273a95cf 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -658,7 +658,7 @@ public function boards($project_id) * * @var string $state Return opened, upcoming, current (previously started), closed, or all iterations. * Filtering by started state is deprecated starting with 14.1, please use current instead. - * @var string $search Return only iterations with a title matching the provided string. + * @var string $search return only iterations with a title matching the provided string * @var bool $include_ancestors Include iterations from parent group and its ancestors. Defaults to true. * } * diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index fdb6b0fd..39b97993 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -683,19 +683,19 @@ public function shouldGetIterations(): void { $expectedArray = [ [ - "id" => 5, - "iid" => 2, - "sequence" => 1, - "group_id" => 123, - "title" => "2022: Sprint 1", - "description" => "", - "state" => 3, - "created_at" => "2021-09-29T21:24:43.913Z", - "updated_at" => "2022-03-29T19:09:08.368Z", - "start_date" => "2022-01-10", - "due_date" => "2022-01-23", - "web_url" => "https://example.com/groups/example/-/iterations/34", - ] + 'id' => 5, + 'iid' => 2, + 'sequence' => 1, + 'group_id' => 123, + 'title' => '2022: Sprint 1', + 'description' => '', + 'state' => 3, + 'created_at' => '2021-09-29T21:24:43.913Z', + 'updated_at' => '2022-03-29T19:09:08.368Z', + 'start_date' => '2022-01-10', + 'due_date' => '2022-01-23', + 'web_url' => 'https://example.com/groups/example/-/iterations/34', + ], ]; $api = $this->getApiMock(); diff --git a/tests/Api/ProjectsTest.php b/tests/Api/ProjectsTest.php index 0d85b249..e0298091 100644 --- a/tests/Api/ProjectsTest.php +++ b/tests/Api/ProjectsTest.php @@ -680,19 +680,19 @@ public function shouldGetIterations(): void { $expectedArray = [ [ - "id" => 5, - "iid" => 2, - "sequence" => 1, - "group_id" => 123, - "title" => "2022: Sprint 1", - "description" => "", - "state" => 3, - "created_at" => "2021-09-29T21:24:43.913Z", - "updated_at" => "2022-03-29T19:09:08.368Z", - "start_date" => "2022-01-10", - "due_date" => "2022-01-23", - "web_url" => "https://example.com/groups/example/-/iterations/34", - ] + 'id' => 5, + 'iid' => 2, + 'sequence' => 1, + 'group_id' => 123, + 'title' => '2022: Sprint 1', + 'description' => '', + 'state' => 3, + 'created_at' => '2021-09-29T21:24:43.913Z', + 'updated_at' => '2022-03-29T19:09:08.368Z', + 'start_date' => '2022-01-10', + 'due_date' => '2022-01-23', + 'web_url' => 'https://example.com/groups/example/-/iterations/34', + ], ]; $api = $this->getApiMock(); From 6211221547eadf54a218d9b3e9f1fa42c4aa322d Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Tue, 26 Apr 2022 09:00:26 -0500 Subject: [PATCH 04/11] add iteration_id and iteration_title to Issues::all() --- src/Api/Issues.php | 11 ++++++++++- tests/Api/IssuesTest.php | 8 ++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Api/Issues.php b/src/Api/Issues.php index cd099bea..1987e1ba 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -41,8 +41,11 @@ class Issues extends AbstractApi * @var int[] $iids return only the issues having the given iid * @var string $order_by return requests ordered by created_at or updated_at fields (default is created_at) * @var string $sort return requests sorted in asc or desc order (default is desc) - * @var bool $confidential filter confidential or public issues + * @var bool $confidential filter confidential or public issues * @var string $search search issues against their title and description + * @var int $assignee_id return issues assigned to the specified user id + * @var int $iteration_id return issues assigned to the specified iteration id + * @var string $iteration_title return issues assigned to the specified iteration title * } * * @return mixed @@ -495,6 +498,12 @@ protected function createOptionsResolver(): OptionsResolver $resolver->setDefined('assignee_id') ->setAllowedTypes('assignee_id', 'integer') ; + $resolver->setDefined('iteration_id') + ->setAllowedTypes('iteration_id', 'integer') + ; + $resolver->setDefined('iteration_title') + ->setAllowedTypes('iteration_title', 'string') + ; $resolver->setDefined('weight') ->setAllowedTypes('weight', 'integer') ; diff --git a/tests/Api/IssuesTest.php b/tests/Api/IssuesTest.php index c62e198f..7c62ffd9 100644 --- a/tests/Api/IssuesTest.php +++ b/tests/Api/IssuesTest.php @@ -91,11 +91,11 @@ public function shouldGetGroupIssuesWithParams(): void $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('groups/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened']) + ->with('groups/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_title' => 'Title', 'assignee_id' => 1]) ->will($this->returnValue($expectedArray)) ; - $this->assertEquals($expectedArray, $api->group(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened'])); + $this->assertEquals($expectedArray, $api->group(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_title' => 'Title', 'assignee_id' => 1])); } /** @@ -131,11 +131,11 @@ public function shouldGetProjectIssuesWithParams(): void $api = $this->getApiMock(); $api->expects($this->once()) ->method('get') - ->with('projects/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened']) + ->with('projects/1/issues', ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_id' => 1, 'assignee_id' => 2]) ->will($this->returnValue($expectedArray)) ; - $this->assertEquals($expectedArray, $api->all(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened'])); + $this->assertEquals($expectedArray, $api->all(1, ['order_by' => 'created_at', 'sort' => 'desc', 'labels' => 'foo,bar', 'state' => 'opened', 'iteration_id' => 1, 'assignee_id' => 2])); } /** From 876ef034c0a5a8f3de144feefece762ee11bda62 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Fri, 27 May 2022 15:15:36 -0500 Subject: [PATCH 05/11] update iteration state allowed values --- src/Api/Groups.php | 2 +- src/Api/Projects.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 12b8c0fc..09e99b4a 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -638,7 +638,7 @@ public function iterations($group_id, array $parameters = []) }; $resolver->setDefined('state') - ->setAllowedValues('state', ['opened', 'upcoming', 'current (previously started)', 'closed', 'all']) + ->setAllowedValues('state', ['opened', 'upcoming', 'current', 'current (previously started)', 'closed', 'all']) ; $resolver->setDefined('include_ancestors') ->setAllowedTypes('include_ancestors', 'bool') diff --git a/src/Api/Projects.php b/src/Api/Projects.php index 273a95cf..44836deb 100644 --- a/src/Api/Projects.php +++ b/src/Api/Projects.php @@ -672,7 +672,7 @@ public function iterations($project_id, array $parameters = []) }; $resolver->setDefined('state') - ->setAllowedValues('state', ['opened', 'upcoming', 'current (previously started)', 'closed', 'all']) + ->setAllowedValues('state', ['opened', 'upcoming', 'current', 'current (previously started)', 'closed', 'all']) ; $resolver->setDefined('include_ancestors') ->setAllowedTypes('include_ancestors', 'bool') From 1cd9aeee7a27ffd655f9f5413c6dc338a117fe81 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 6 Jun 2022 12:47:38 -0500 Subject: [PATCH 06/11] add groups issues --- src/Api/Groups.php | 63 ++++++++++++++++++++++++++++++++++++++++ tests/Api/GroupsTest.php | 21 ++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 09e99b4a..f96a7c07 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -378,6 +378,69 @@ public function subgroups($group_id, array $parameters = []) return $this->get('groups/'.self::encodePath($group_id).'/subgroups', $resolver->resolve($parameters)); } + /** + * @param int|string $group_id + * @param array $parameters { + * + * @var string $assignee_id Return issues assigned to the given user id. Mutually exclusive with assignee_username. + * None returns unassigned issues. Any returns issues with an assignee. + * @var string $assignee_username Return issues assigned to the given username. Similar to assignee_id and mutually exclusive with assignee_id. + * In GitLab CE, the assignee_username array should only contain a single value. Otherwise, an invalid parameter error is returned. + * @var int $author_id Return issues created by the given user id. Mutually exclusive with author_username. + * Combine with scope=all or scope=assigned_to_me. + * @var string $author_username Return issues created by the given username. Similar to author_id and mutually exclusive with author_id. + * @var bool $confidential Filter confidential or public issues. + * @var \DateTimeInterface $created_after Return issues created after the given time (inclusive) + * @var \DateTimeInterface $created_before Return issues created before the given time (inclusive) + * @var integer $iteration_id Return issues assigned to the given iteration ID. None returns issues that do not belong to an iteration. Any returns issues that belong to an iteration. Mutually exclusive with iteration_title. + * @var string $iteration_title Return issues assigned to the iteration with the given title. Similar to iteration_id and mutually exclusive with iteration_id. + * @var string $labels Comma-separated list of label names, issues must have all labels to be returned. None lists all issues with no labels. Any lists all issues with at least one label. No+Label (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. + * @var string $milestone The milestone title. None lists all issues with no milestone. Any lists all issues that have an assigned milestone. + * @var string $my_reaction_emoji Return issues reacted by the authenticated user by the given emoji. None returns issues not given a reaction. Any returns issues given at least one reaction. + * @var boolean $non_archived Return issues from non archived projects. Default is true. + * @var string $not Return issues that do not match the parameters supplied. Accepts: labels, milestone, author_id, author_username, assignee_id, assignee_username, my_reaction_emoji, search, in + * @var string $order_by Return issues ordered by created_at, updated_at, priority, due_date, relative_position, label_priority, milestone_due, popularity, weight fields. Default is created_at + * @var string $scope Return issues for the given scope: created_by_me, assigned_to_me or all. Defaults to all. + * @var string $search Search group issues against their title and description + * @var string $sort Return issues sorted in asc or desc order. Default is desc + * @var string $state Return all issues or just those that are opened or closed + * @var \DateTimeInterface $updated_after Return issues updated on or after the given time. Expected in ISO 8601 format (2019-03-15T08:00:00Z) + * @var \DateTimeInterface $updated_before Return issues updated on or before the given time. Expected in ISO 8601 format (2019-03-15T08:00:00Z) + * @var integer $weight Return issues with the specified weight. None returns issues with no weight assigned. Any returns issues with a weight assigned. + * @var boolean $with_labels_details If true, the response returns more details for each label in labels field: :name, :color, :description, :description_html, :text_color. Default is false. + * } + * + * @return mixed + */ + public function issues($group_id, array $parameters = []) + { + $resolver = $this->createOptionsResolver(); + $booleanNormalizer = function (Options $resolver, $value): string { + return $value ? 'true' : 'false'; + }; + + $resolver->setDefined('confidential') + ->setAllowedTypes('confidential', 'bool') + ->setNormalizer('confidential', $booleanNormalizer) + ; + + $resolver->setDefined('non_archived') + ->setAllowedTypes('non_archived', 'bool') + ->setNormalizer('non_archived', $booleanNormalizer) + ; + + $resolver->setDefined('with_labels_details') + ->setAllowedTypes('with_labels_details', 'bool') + ->setNormalizer('with_labels_details', $booleanNormalizer) + ; + + $resolver->setDefined('state') + ->setAllowedValues('state', ['opened', 'closed']) + ; + + return $this->get('groups/'.self::encodePath($group_id).'/issues', $resolver->resolve($parameters)); + } + /** * @param int|string $group_id * @param array $parameters diff --git a/tests/Api/GroupsTest.php b/tests/Api/GroupsTest.php index 39b97993..1830bcec 100644 --- a/tests/Api/GroupsTest.php +++ b/tests/Api/GroupsTest.php @@ -364,6 +364,27 @@ public function shouldGetAllSubgroups(): void $this->assertEquals($expectedArray, $api->subgroups(1, ['page' => 1, 'per_page' => 10])); } + /** + * @test + */ + public function shouldGetAllIssues(): void + { + $expectedArray = [ + ['id' => 101, 'name' => 'An issue'], + ['id' => 102, 'name' => 'Another issue'], + ['id' => 103, 'name' => 'A third issue'], + ]; + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('groups/1/issues', ['page' => 1, 'per_page' => 10]) + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->issues(1, ['page' => 1, 'per_page' => 10])); + } + /** * @test */ From 24c9cd8520ad40a7253b1fb81d40732754ea62d9 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 6 Jun 2022 13:06:41 -0500 Subject: [PATCH 07/11] add all options to resolver --- src/Api/Groups.php | 70 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 10 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index f96a7c07..c7f9032b 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -418,25 +418,75 @@ public function issues($group_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('assignee_id'); + $resolver->setDefined('assignee_username') + ->setAllowedTypes('assignee_username', 'string'); + + $resolver->setDefined('author_id'); + $resolver->setDefined('author_username') + ->setAllowedTypes('author_username', 'string'); $resolver->setDefined('confidential') ->setAllowedTypes('confidential', 'bool') - ->setNormalizer('confidential', $booleanNormalizer) - ; + ->setNormalizer('confidential', $booleanNormalizer); + + $resolver->setDefined('created_after') + ->setAllowedTypes('created_after', \DateTimeInterface::class) + ->setNormalizer('created_after', $datetimeNormalizer); + $resolver->setDefined('created_before') + ->setAllowedTypes('created_before', \DateTimeInterface::class) + ->setNormalizer('created_before', $datetimeNormalizer); + + $resolver->setDefined('updated_after') + ->setAllowedTypes('updated_after', \DateTimeInterface::class) + ->setNormalizer('updated_after', $datetimeNormalizer); + $resolver->setDefined('updated_before') + ->setAllowedTypes('updated_before', \DateTimeInterface::class) + ->setNormalizer('updated_before', $datetimeNormalizer); + + $resolver->setDefined('iteration_id'); + $resolver->setDefined('iteration_title') + ->setAllowedTypes('iteration_title', 'string'); + + $resolver->setDefined('labels') + ->setAllowedTypes('labels', 'string'); + + $resolver->setDefined('milestone') + ->setAllowedTypes('milestone', 'string'); + + $resolver->setDefined('my_reaction_emoji') + ->setAllowedTypes('my_reaction_emoji', 'string'); $resolver->setDefined('non_archived') ->setAllowedTypes('non_archived', 'bool') - ->setNormalizer('non_archived', $booleanNormalizer) - ; + ->setNormalizer('non_archived', $booleanNormalizer); - $resolver->setDefined('with_labels_details') - ->setAllowedTypes('with_labels_details', 'bool') - ->setNormalizer('with_labels_details', $booleanNormalizer) - ; + $resolver->setDefined('not') + ->setAllowedTypes('not', 'string'); + + $resolver->setDefined('order_by') + ->setAllowedValues('order_by', ['created_at', 'updated_at']); + $resolver->setDefined('sort') + ->setAllowedValues('sort', ['asc', 'desc']); + + $resolver->setDefined('scope') + ->setAllowedTypes('scope', 'string'); + + $resolver->setDefined('search') + ->setAllowedTypes('search', 'string'); $resolver->setDefined('state') - ->setAllowedValues('state', ['opened', 'closed']) - ; + ->setAllowedValues('state', [self::STATE_ALL, self::STATE_OPENED, self::STATE_CLOSED]); + + $resolver->setDefined('weight'); + + $resolver->setDefined('with_labels_details') + ->setAllowedTypes('with_labels_details', 'bool') + ->setNormalizer('with_labels_details', $booleanNormalizer); return $this->get('groups/'.self::encodePath($group_id).'/issues', $resolver->resolve($parameters)); } From b91026198d14dbdb7728a9769f2c429cbfe0082f Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 6 Jun 2022 15:56:02 -0500 Subject: [PATCH 08/11] update code style --- src/Api/Groups.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index c7f9032b..700bbf87 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -389,15 +389,15 @@ public function subgroups($group_id, array $parameters = []) * @var int $author_id Return issues created by the given user id. Mutually exclusive with author_username. * Combine with scope=all or scope=assigned_to_me. * @var string $author_username Return issues created by the given username. Similar to author_id and mutually exclusive with author_id. - * @var bool $confidential Filter confidential or public issues. + * @var bool $confidential filter confidential or public issues * @var \DateTimeInterface $created_after Return issues created after the given time (inclusive) * @var \DateTimeInterface $created_before Return issues created before the given time (inclusive) - * @var integer $iteration_id Return issues assigned to the given iteration ID. None returns issues that do not belong to an iteration. Any returns issues that belong to an iteration. Mutually exclusive with iteration_title. + * @var int $iteration_id Return issues assigned to the given iteration ID. None returns issues that do not belong to an iteration. Any returns issues that belong to an iteration. Mutually exclusive with iteration_title. * @var string $iteration_title Return issues assigned to the iteration with the given title. Similar to iteration_id and mutually exclusive with iteration_id. * @var string $labels Comma-separated list of label names, issues must have all labels to be returned. None lists all issues with no labels. Any lists all issues with at least one label. No+Label (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. * @var string $milestone The milestone title. None lists all issues with no milestone. Any lists all issues that have an assigned milestone. * @var string $my_reaction_emoji Return issues reacted by the authenticated user by the given emoji. None returns issues not given a reaction. Any returns issues given at least one reaction. - * @var boolean $non_archived Return issues from non archived projects. Default is true. + * @var bool $non_archived Return issues from non archived projects. Default is true. * @var string $not Return issues that do not match the parameters supplied. Accepts: labels, milestone, author_id, author_username, assignee_id, assignee_username, my_reaction_emoji, search, in * @var string $order_by Return issues ordered by created_at, updated_at, priority, due_date, relative_position, label_priority, milestone_due, popularity, weight fields. Default is created_at * @var string $scope Return issues for the given scope: created_by_me, assigned_to_me or all. Defaults to all. @@ -406,8 +406,8 @@ public function subgroups($group_id, array $parameters = []) * @var string $state Return all issues or just those that are opened or closed * @var \DateTimeInterface $updated_after Return issues updated on or after the given time. Expected in ISO 8601 format (2019-03-15T08:00:00Z) * @var \DateTimeInterface $updated_before Return issues updated on or before the given time. Expected in ISO 8601 format (2019-03-15T08:00:00Z) - * @var integer $weight Return issues with the specified weight. None returns issues with no weight assigned. Any returns issues with a weight assigned. - * @var boolean $with_labels_details If true, the response returns more details for each label in labels field: :name, :color, :description, :description_html, :text_color. Default is false. + * @var int $weight Return issues with the specified weight. None returns issues with no weight assigned. Any returns issues with a weight assigned. + * @var bool $with_labels_details If true, the response returns more details for each label in labels field: :name, :color, :description, :description_html, :text_color. Default is false. * } * * @return mixed From a70d1c3ebb37939c57e8cd15b383ec5fdf00238a Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 6 Jun 2022 15:56:20 -0500 Subject: [PATCH 09/11] standardize comment format --- src/Api/Groups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 700bbf87..01e41693 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -389,7 +389,7 @@ public function subgroups($group_id, array $parameters = []) * @var int $author_id Return issues created by the given user id. Mutually exclusive with author_username. * Combine with scope=all or scope=assigned_to_me. * @var string $author_username Return issues created by the given username. Similar to author_id and mutually exclusive with author_id. - * @var bool $confidential filter confidential or public issues + * @var bool $confidential Filter confidential or public issues. * @var \DateTimeInterface $created_after Return issues created after the given time (inclusive) * @var \DateTimeInterface $created_before Return issues created before the given time (inclusive) * @var int $iteration_id Return issues assigned to the given iteration ID. None returns issues that do not belong to an iteration. Any returns issues that belong to an iteration. Mutually exclusive with iteration_title. From 0887cf720d47366d0f81eda9d131ed2be5107f50 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Mon, 6 Jun 2022 15:57:15 -0500 Subject: [PATCH 10/11] fix comment style --- src/Api/Groups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Api/Groups.php b/src/Api/Groups.php index 01e41693..a26cf7c9 100644 --- a/src/Api/Groups.php +++ b/src/Api/Groups.php @@ -389,7 +389,7 @@ public function subgroups($group_id, array $parameters = []) * @var int $author_id Return issues created by the given user id. Mutually exclusive with author_username. * Combine with scope=all or scope=assigned_to_me. * @var string $author_username Return issues created by the given username. Similar to author_id and mutually exclusive with author_id. - * @var bool $confidential Filter confidential or public issues. + * @var bool $confidential Filter confidential or public issues * @var \DateTimeInterface $created_after Return issues created after the given time (inclusive) * @var \DateTimeInterface $created_before Return issues created before the given time (inclusive) * @var int $iteration_id Return issues assigned to the given iteration ID. None returns issues that do not belong to an iteration. Any returns issues that belong to an iteration. Mutually exclusive with iteration_title. From 4dbd12e488bc0ecebeb5a1d0711d0ca819d929d5 Mon Sep 17 00:00:00 2001 From: Andrew Minion Date: Fri, 9 Sep 2022 17:11:56 -0500 Subject: [PATCH 11/11] add milestone_id --- src/Api/Issues.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Api/Issues.php b/src/Api/Issues.php index 1987e1ba..360e8b51 100644 --- a/src/Api/Issues.php +++ b/src/Api/Issues.php @@ -468,6 +468,8 @@ protected function createOptionsResolver(): OptionsResolver ; $resolver->setDefined('labels'); $resolver->setDefined('milestone'); + $resolver->setDefined('milestone_id') + ->setAllowedTypes('milestone_id', 'integer'); $resolver->setDefined('with_labels_details') ->setAllowedTypes('with_labels_details', 'bool') ->setNormalizer('with_labels_details', $booleanNormalizer)