Skip to content

Commit

Permalink
PCC-61: Allowing query args in debug endpoint. (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
purushotamrai authored May 28, 2024
1 parent 33ef588 commit 16d63d7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Controller/DebugSiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use PccPhpSdk\api\ArticlesApi;
use PccPhpSdk\api\Query\ArticleQueryArgs;
use PccPhpSdk\api\Query\ArticleSearchArgs;
use PccPhpSdk\api\Query\Enums\ArticleSortField;
use PccPhpSdk\api\Query\Enums\ArticleSortOrder;
use PccPhpSdk\api\Query\Enums\ContentType;
use PccPhpSdk\api\Query\Enums\PublishStatus;
use PccPhpSdk\api\SitesApi;
use PccPhpSdk\core\PccClient;
Expand Down Expand Up @@ -153,7 +156,15 @@ public function getArticleBySlug(string $slug): JsonResponse {
*/
public function searchArticles(): JsonResponse {
$contentApi = new ArticlesApi($this->pccClient);
$response = $contentApi->searchArticles(new ArticleQueryArgs(), new ArticleSearchArgs(
$response = $contentApi->searchArticles(
new ArticleQueryArgs(
ArticleSortField::from($this->getQueryArg('sortField') ?? 'updatedAt'),
ArticleSortOrder::from($this->getQueryArg('sortOrder') ?? 'DESC'),
$this->getQueryArg('pageSize') ?? 10,
$this->getQueryArg('pageIndex') ?? 1,
ContentType::from($this->getQueryArg('contentType') ?? 'TREE_PANTHEON_V2')
),
new ArticleSearchArgs(
$this->getQueryArg('bodyContains') ?? '',
$this->getQueryArg('tagContains') ?? '',
$this->getQueryArg('titleContains') ?? '',
Expand Down

0 comments on commit 16d63d7

Please sign in to comment.