@@ -55,6 +55,16 @@ class Page extends Entity
5555 */
5656 private string $ coverType = '' ;
5757
58+ /**
59+ * @var string
60+ */
61+ private string $ parentId = '' ;
62+
63+ /**
64+ * @var string
65+ */
66+ private string $ parentType = '' ;
67+
5868 /**
5969 * @var string
6070 */
@@ -122,6 +132,7 @@ protected function setResponseData(array $responseData): void
122132 private function fillFromRaw (): void
123133 {
124134 $ this ->fillId ();
135+ $ this ->fillParent ();
125136 $ this ->fillObjectType ();
126137 $ this ->fillProperties ();
127138 $ this ->fillTitle (); // This has to be called after fillProperties(), since title is provided by properties
@@ -205,6 +216,20 @@ private function fillPageUrl(): void
205216 }
206217 }
207218
219+ private function fillParent (): void
220+ {
221+ if (Arr::exists ($ this ->responseData , 'parent ' )) {
222+ $ this ->parentType = $ this ->responseData ['parent ' ]['type ' ];
223+ if (Arr::exists ($ this ->responseData ['parent ' ], 'database_id ' )) {
224+ $ this ->parentId = $ this ->responseData ['parent ' ]['database_id ' ];
225+ } elseif (Arr::exists ($ this ->responseData ['parent ' ], 'page_id ' )) {
226+ $ this ->parentId = $ this ->responseData ['parent ' ]['page_id ' ];
227+ } elseif (Arr::exists ($ this ->responseData ['parent ' ], 'workspace ' )) {
228+ $ this ->parentId = $ this ->responseData ['parent ' ]['workspace ' ];
229+ }
230+ }
231+ }
232+
208233 /**
209234 * @param $propertyTitle
210235 * @param $property
@@ -458,6 +483,22 @@ public function getObjectType(): string
458483 return $ this ->objectType ;
459484 }
460485
486+ /**
487+ * @return string
488+ */
489+ public function getParentId (): string
490+ {
491+ return $ this ->parentId ;
492+ }
493+
494+ /**
495+ * @return string
496+ */
497+ public function getParentType (): string
498+ {
499+ return $ this ->parentType ;
500+ }
501+
461502 /**
462503 * @return array
463504 */
0 commit comments