From f1c09e27f48d4c730fc60f7364ec379cb66a01fa Mon Sep 17 00:00:00 2001 From: humanoidvani Date: Thu, 7 Dec 2023 15:52:22 +0800 Subject: [PATCH] Added "Page body" to response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://developer.bigcommerce.com/docs/rest-content/pages#get-a-page include in query - string Include the requested property in the response. The body property returns the page’s markup, text, or raw content. Allowed values: body --- src/BigCommerce/Api/Pages/PagesApi.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/BigCommerce/Api/Pages/PagesApi.php b/src/BigCommerce/Api/Pages/PagesApi.php index c74d604..42118f4 100644 --- a/src/BigCommerce/Api/Pages/PagesApi.php +++ b/src/BigCommerce/Api/Pages/PagesApi.php @@ -24,6 +24,8 @@ protected function maxBatchSize(): int private const PAGE_ENDPOINT = 'content/pages/%d'; private const PAGES_ENDPOINT = 'content/pages'; private const RESOURCE_NAME = 'pages'; + + public const FILTER_INCLUDE = 'include'; public function batchUpdate(array $resources): PagesResponse { @@ -45,9 +47,14 @@ protected function resourceName(): string return self::RESOURCE_NAME; } - public function get(): PageResponse + public function get(?string $include = null): PageResponse { - return new PageResponse($this->getResource()); + $params = []; + + if (!is_null($include)) { + $params[self::FILTER_INCLUDE] = $include; + } + return new PageResponse($this->getResource($params)); } public function getAll(array $filters = [], int $page = 1, int $limit = 250): PagesResponse