Skip to content

Commit b9797bf

Browse files
committed
add is_inline property to database entity
- add missing prop to stub - add check for property within database test
1 parent 0cccb2e commit b9797bf

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/Entities/Database.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ class Database extends Entity
6767
*/
6868
protected ?RichText $richDescription = null;
6969

70+
/**
71+
* @var bool
72+
*/
73+
protected bool $isInline = false;
74+
7075
/**
7176
* @var array
7277
*/
@@ -102,6 +107,7 @@ private function fillFromRaw()
102107
$this->fillIcon();
103108
$this->fillCover();
104109
$this->fillTitle();
110+
$this->fillIsInline();
105111
$this->fillDescription();
106112
$this->fillObjectType();
107113
$this->fillProperties();
@@ -118,6 +124,13 @@ private function fillTitle(): void
118124
}
119125
}
120126

127+
private function fillIsInline(): void
128+
{
129+
if (Arr::exists($this->responseData, 'is_inline')) {
130+
$this->isInline = $this->responseData['is_inline'];
131+
}
132+
}
133+
121134
private function fillDescription(): void
122135
{
123136
if (Arr::exists($this->responseData, 'description') && is_array($this->responseData['description'])) {
@@ -210,6 +223,14 @@ public function getTitle(): string
210223
return $this->title;
211224
}
212225

226+
/**
227+
* @return bool
228+
*/
229+
public function getIsInline(): bool
230+
{
231+
return $this->isInline;
232+
}
233+
213234
/**
214235
* @return string
215236
*/

tests/EndpointDatabasesTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ public function it_returns_database_entity_with_filled_properties()
9393
$this->assertSame('Grocery List', $databaseResult->getTitle());
9494
$this->assertSame('Grocery List Description', $databaseResult->getDescription());
9595
$this->assertSame('database', $databaseResult->getObjectType());
96+
$this->assertSame('668d797c-76fa-4934-9b05-ad288df2d136', $databaseResult->getId());
97+
$this->assertTrue($databaseResult->getIsInline());
9698

9799
$this->assertInstanceOf(RichText::class, $databaseResult->getRichTitle());
98100
$this->assertInstanceOf(RichText::class, $databaseResult->getRichDescription());

tests/stubs/endpoints/databases/response_specific_200.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"type": "page_id",
88
"page_id": "f2939732-f694-4ce2-b613-f28db6ded673"
99
},
10+
"is_inline": true,
1011
"description": [
1112
{
1213
"type": "text",

0 commit comments

Comments
 (0)