Skip to content

Commit ffa4145

Browse files
authored
Merge pull request 5am-code#13 from 5am-code/feature/improved-properties
improve properties and collections
2 parents fc186d5 + b0390a2 commit ffa4145

28 files changed

+117
-98
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ Head over to the [Documentation](https://5amco.de/docs) of this package.
3737
### 🔥 Code Examples to jumpstart your Notion API Project
3838

3939
#### Basic Setup
40+
4041
```php
4142
use FiveamCode\LaravelNotionApi\Notion;
42-
use Illuminate\Support\Collection;
43-
use FiveamCode\LaravelNotionApi\Query\Sorting;
44-
use FiveamCode\LaravelNotionApi\Query\Filter;
4543

4644
// Setup basic API connection
4745
$notion = new Notion();

src/Endpoints/Database.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77
use FiveamCode\LaravelNotionApi\Notion;
88
use FiveamCode\LaravelNotionApi\Query\Filter;
99
use FiveamCode\LaravelNotionApi\Query\Sorting;
10-
use FiveamCode\LaravelNotionApi\Query\StartCursor;
11-
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
12-
use Symfony\Component\VarDumper\Cloner\Data;
1310

1411
class Database extends Endpoint
1512
{
@@ -29,7 +26,7 @@ public function __construct(string $databaseId, Notion $notion)
2926
parent::__construct($notion);
3027
}
3128

32-
public function query(): Collection
29+
public function query(): PageCollection
3330
{
3431
$postData = [];
3532

@@ -54,8 +51,7 @@ public function query(): Collection
5451

5552
->json();
5653

57-
$pageCollection = new PageCollection($response);
58-
return $pageCollection->getResults();
54+
return new PageCollection($response);
5955
}
6056

6157
public function filterBy(Collection $filter)

src/Endpoints/Databases.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
use FiveamCode\LaravelNotionApi\Entities\Database;
66
use FiveamCode\LaravelNotionApi\Entities\Collections\DatabaseCollection;
77
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
8-
use FiveamCode\LaravelNotionApi\Notion;
9-
use FiveamCode\LaravelNotionApi\Query\StartCursor;
108
use Illuminate\Support\Collection;
119

1210

src/Endpoints/Pages.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use FiveamCode\LaravelNotionApi\Entities\Page;
66
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
7-
use FiveamCode\LaravelNotionApi\Notion;
87

98
class Pages extends Endpoint implements EndpointInterface
109
{

src/Endpoints/Search.php

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

33
namespace FiveamCode\LaravelNotionApi\Endpoints;
44

5-
use FiveamCode\LaravelNotionApi\Entities\Collections\EntityCollection;
6-
use FiveamCode\LaravelNotionApi\Entities\Collections\PageCollection;
75
use Illuminate\Support\Collection;
86
use FiveamCode\LaravelNotionApi\Notion;
9-
use FiveamCode\LaravelNotionApi\Query\Filter;
107
use FiveamCode\LaravelNotionApi\Query\Sorting;
11-
use FiveamCode\LaravelNotionApi\Query\StartCursor;
12-
use FiveamCode\LaravelNotionApi\Exceptions\WrapperException;
13-
use Symfony\Component\VarDumper\Cloner\Data;
8+
use FiveamCode\LaravelNotionApi\Entities\Collections\EntityCollection;
149

1510
class Search extends Endpoint
1611
{
@@ -43,7 +38,7 @@ public function query(): EntityCollection
4338

4439
if ($this->searchText !== null)
4540
$postData['query'] = $this->searchText;
46-
41+
4742
$response = $this
4843
->post(
4944
$this->url(Endpoint::SEARCH),

src/Endpoints/Users.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
use FiveamCode\LaravelNotionApi\Entities\User;
66
use FiveamCode\LaravelNotionApi\Entities\Collections\UserCollection;
77
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
8-
use FiveamCode\LaravelNotionApi\Notion;
9-
use FiveamCode\LaravelNotionApi\Query\StartCursor;
108
use Illuminate\Support\Collection;
119

1210
class Users extends Endpoint implements EndpointInterface

src/Entities/Blocks/Block.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use DateTime;
66
use FiveamCode\LaravelNotionApi\Entities\Entity;
77
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
8-
use FiveamCode\LaravelNotionApi\Notion;
98
use Illuminate\Support\Arr;
109

1110
class Block extends Entity

src/Entities/Collections/BlockCollection.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
namespace FiveamCode\LaravelNotionApi\Entities\Collections;
44

55
use FiveamCode\LaravelNotionApi\Entities\Blocks\Block;
6-
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
7-
use FiveamCode\LaravelNotionApi\Notion;
8-
use Illuminate\Support\Arr;
96
use Illuminate\Support\Collection;
107

118

src/Entities/Collections/DatabaseCollection.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
namespace FiveamCode\LaravelNotionApi\Entities\Collections;
44

55
use FiveamCode\LaravelNotionApi\Entities\Database;
6-
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
7-
use FiveamCode\LaravelNotionApi\Notion;
8-
use Illuminate\Support\Arr;
96
use Illuminate\Support\Collection;
107

118

src/Entities/Collections/PageCollection.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
namespace FiveamCode\LaravelNotionApi\Entities\Collections;
44

55
use FiveamCode\LaravelNotionApi\Entities\Page;
6-
use FiveamCode\LaravelNotionApi\Exceptions\HandlingException;
7-
use FiveamCode\LaravelNotionApi\Notion;
8-
use Illuminate\Support\Arr;
96
use Illuminate\Support\Collection;
107

118

0 commit comments

Comments
 (0)