From 56a0fe5e47ad0d5b0741b2444607192a2f969d8d Mon Sep 17 00:00:00 2001 From: Matthias Neid Date: Thu, 20 Jul 2023 19:20:53 +0200 Subject: [PATCH] set alias for image list params, added sort param --- src/Common/Api/AbstractParams.php | 2 ++ src/Images/v2/Api.php | 1 + src/Images/v2/Params.php | 13 +++++++++++++ 3 files changed, 16 insertions(+) diff --git a/src/Common/Api/AbstractParams.php b/src/Common/Api/AbstractParams.php index 02546062c..7b7b2c775 100644 --- a/src/Common/Api/AbstractParams.php +++ b/src/Common/Api/AbstractParams.php @@ -85,6 +85,7 @@ public function sortDir(): array return [ 'type' => self::STRING_TYPE, 'location' => self::QUERY, + 'sentAs' => 'sort_dir', 'description' => 'Sorts by one or more sets of attribute and sort direction combinations.', 'enum' => ['asc', 'desc'], ]; @@ -95,6 +96,7 @@ public function sortKey(): array return [ 'type' => self::STRING_TYPE, 'location' => self::QUERY, + 'sentAs' => 'sort_key', 'description' => 'Sorts by one or more sets of attribute and sort direction combinations.', ]; } diff --git a/src/Images/v2/Api.php b/src/Images/v2/Api.php index 0616763f9..ab3b330ca 100644 --- a/src/Images/v2/Api.php +++ b/src/Images/v2/Api.php @@ -44,6 +44,7 @@ public function getImages(): array 'marker' => $this->params->marker(), 'sortKey' => $this->params->sortKey(), 'sortDir' => $this->params->sortDir(), + 'sort' => $this->params->sort(), 'name' => $this->params->queryName(), 'visibility' => $this->params->queryVisibility(), 'memberStatus' => $this->params->queryMemberStatus(), diff --git a/src/Images/v2/Params.php b/src/Images/v2/Params.php index 4b8c31fd4..f26c2f030 100644 --- a/src/Images/v2/Params.php +++ b/src/Images/v2/Params.php @@ -113,6 +113,7 @@ public function queryMemberStatus(): array return [ 'location' => self::QUERY, 'type' => self::STRING_TYPE, + 'sentAs' => 'member_status', 'description' => 'Shows only images with this member status.', 'enum' => ['accepted', 'pending', 'rejected', 'all'], ]; @@ -142,6 +143,7 @@ public function querySizeMin(): array return [ 'location' => self::QUERY, 'type' => self::INT_TYPE, + 'sentAs' => 'size_min', 'description' => 'Shows only images with this minimum image size.', ]; } @@ -151,6 +153,7 @@ public function querySizeMax(): array return [ 'location' => self::QUERY, 'type' => self::INT_TYPE, + 'sentAs' => 'size_max', 'description' => 'Shows only images with this maximum image size.', ]; } @@ -164,6 +167,16 @@ public function queryTag(): array ]; } + public function sort(): array + { + return [ + 'location' => self::QUERY, + 'type' => self::STRING_TYPE, + 'description' => 'Sorts the response by one or more attribute and sort direction combinations. You can ' . + 'also set multiple sort keys and directions. Default direction is desc.' + ]; + } + public function contentType(): array { return [