From 2ac3ddffa7ea654ade7ef35b31046a56c2ce129e Mon Sep 17 00:00:00 2001 From: Diana Scharf Date: Sun, 27 Jun 2021 20:11:02 +0200 Subject: [PATCH] Added Shorthand to access all pages possible via search endpoint --- src/Endpoints/Pages.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Endpoints/Pages.php b/src/Endpoints/Pages.php index 2452b86..c9b8132 100644 --- a/src/Endpoints/Pages.php +++ b/src/Endpoints/Pages.php @@ -2,9 +2,12 @@ namespace FiveamCode\LaravelNotionApi\Endpoints; +use FiveamCode\LaravelNotionApi\Entities\Collections\EntityCollection; +use FiveamCode\LaravelNotionApi\Entities\Collections\PageCollection; use FiveamCode\LaravelNotionApi\Entities\Page; use FiveamCode\LaravelNotionApi\Exceptions\NotionException; use FiveamCode\LaravelNotionApi\Exceptions\HandlingException; +use FiveamCode\LaravelNotionApi\Notion; /** * Class Pages @@ -58,7 +61,7 @@ public function createInDatabase(string $parentId, Page $page): Page return new Page($response); } - /** + /** * @return Page */ public function createInPage(string $parentId, Page $page): Page @@ -84,7 +87,17 @@ public function createInPage(string $parentId, Page $page): Page return new Page($response); } - + /** + * Return all pages possible. + * + * @return EntityCollection + * @throws HandlingException + * @throws NotionException + */ + public function all(): EntityCollection + { + return $this->notion->search()->onlyPages()->query(); + } /** * @return array