File tree Expand file tree Collapse file tree 4 files changed +52
-4
lines changed Expand file tree Collapse file tree 4 files changed +52
-4
lines changed Original file line number Diff line number Diff line change 44
55use FiveamCode \LaravelNotionApi \Entities \Entity ;
66use FiveamCode \LaravelNotionApi \Exceptions \HandlingException ;
7+ use FiveamCode \LaravelNotionApi \Traits \HasArchive ;
78use FiveamCode \LaravelNotionApi \Traits \HasParent ;
89use FiveamCode \LaravelNotionApi \Traits \HasTimestamps ;
910use Illuminate \Support \Arr ;
1314 */
1415class Block extends Entity
1516{
16- use HasTimestamps, HasParent;
17+ use HasTimestamps, HasArchive, HasParent;
1718
1819 /**
1920 * @var string
@@ -63,6 +64,7 @@ protected function fillFromRaw(): void
6364 $ this ->fillRawContent ();
6465 $ this ->fillHasChildren ();
6566 $ this ->fillParentProperties ();
67+ $ this ->fillArchivedProperties ();
6668 $ this ->fillTimestampableProperties ();
6769 }
6870
Original file line number Diff line number Diff line change 55use FiveamCode \LaravelNotionApi \Entities \Properties \Property ;
66use FiveamCode \LaravelNotionApi \Entities \PropertyItems \RichText ;
77use FiveamCode \LaravelNotionApi \Exceptions \HandlingException ;
8+ use FiveamCode \LaravelNotionApi \Traits \HasArchive ;
89use FiveamCode \LaravelNotionApi \Traits \HasParent ;
910use FiveamCode \LaravelNotionApi \Traits \HasTimestamps ;
1011use Illuminate \Support \Arr ;
1516 */
1617class Database extends Entity
1718{
18- use HasTimestamps, HasParent;
19+ use HasTimestamps, HasArchive, HasParent;
1920
2021 /**
2122 * @var string
@@ -113,6 +114,7 @@ private function fillFromRaw()
113114 $ this ->fillProperties ();
114115 $ this ->fillDatabaseUrl ();
115116 $ this ->fillParentProperties ();
117+ $ this ->fillArchivedProperties ();
116118 $ this ->fillTimestampableProperties ();
117119 }
118120
@@ -226,7 +228,7 @@ public function getTitle(): string
226228 /**
227229 * @return bool
228230 */
229- public function getIsInline (): bool
231+ public function isInline (): bool
230232 {
231233 return $ this ->isInline ;
232234 }
Original file line number Diff line number Diff line change 1717use FiveamCode \LaravelNotionApi \Entities \Properties \Title ;
1818use FiveamCode \LaravelNotionApi \Entities \Properties \Url ;
1919use FiveamCode \LaravelNotionApi \Exceptions \HandlingException ;
20+ use FiveamCode \LaravelNotionApi \Traits \HasArchive ;
2021use FiveamCode \LaravelNotionApi \Traits \HasParent ;
2122use FiveamCode \LaravelNotionApi \Traits \HasTimestamps ;
2223use Illuminate \Support \Arr ;
2728 */
2829class Page extends Entity
2930{
30- use HasTimestamps, HasParent;
31+ use HasTimestamps, HasArchive, HasParent;
3132
3233 /**
3334 * @var string
@@ -123,6 +124,7 @@ private function fillFromRaw(): void
123124 $ this ->fillIcon ();
124125 $ this ->fillCover ();
125126 $ this ->fillParentProperties ();
127+ $ this ->fillArchivedProperties ();
126128 $ this ->fillTimestampableProperties ();
127129 }
128130
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace FiveamCode \LaravelNotionApi \Traits ;
4+
5+ use Illuminate \Support \Arr ;
6+
7+ /**
8+ * Trait HasArchive
9+ */
10+ trait HasArchive
11+ {
12+ /**
13+ * @var array
14+ */
15+ protected array $ responseData = [];
16+
17+ /**
18+ * @var bool
19+ */
20+ private bool $ archived = false ;
21+
22+
23+ protected function fillArchivedProperties (): void
24+ {
25+ $ this ->fillArchived ();
26+ }
27+
28+ private function fillArchived (): void
29+ {
30+ if (Arr::exists ($ this ->responseData , 'archived ' )) {
31+ $ this ->archived = $ this ->responseData ['archived ' ];
32+ }
33+ }
34+
35+ /**
36+ * @return bool
37+ */
38+ public function isArchived (): bool
39+ {
40+ return $ this ->archived ;
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments