Skip to content

Commit 2ac3ddf

Browse files
committed
Added Shorthand to access all pages possible via search endpoint
1 parent c1319a2 commit 2ac3ddf

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Endpoints/Pages.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
namespace FiveamCode\LaravelNotionApi\Endpoints;
44

5+
use FiveamCode\LaravelNotionApi\Entities\Collections\EntityCollection;
6+
use FiveamCode\LaravelNotionApi\Entities\Collections\PageCollection;
57
use FiveamCode\LaravelNotionApi\Entities\Page;
68
use FiveamCode\LaravelNotionApi\Exceptions\NotionException;
79
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
10+
use FiveamCode\LaravelNotionApi\Notion;
811

912
/**
1013
* Class Pages
@@ -58,7 +61,7 @@ public function createInDatabase(string $parentId, Page $page): Page
5861
return new Page($response);
5962
}
6063

61-
/**
64+
/**
6265
* @return Page
6366
*/
6467
public function createInPage(string $parentId, Page $page): Page
@@ -84,7 +87,17 @@ public function createInPage(string $parentId, Page $page): Page
8487
return new Page($response);
8588
}
8689

87-
90+
/**
91+
* Return all pages possible.
92+
*
93+
* @return EntityCollection
94+
* @throws HandlingException
95+
* @throws NotionException
96+
*/
97+
public function all(): EntityCollection
98+
{
99+
return $this->notion->search()->onlyPages()->query();
100+
}
88101

89102
/**
90103
* @return array

0 commit comments

Comments
 (0)