Skip to content
This repository was archived by the owner on Jun 21, 2022. It is now read-only.

Commit b5ccb9f

Browse files
Added function for getting the page from the page object
1 parent 1fefcbc commit b5ccb9f

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/Notion/Objects/Database.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public function newPage()
1414
{
1515
return (new Page(null, $this->notion))
1616
->setParent('database', $this->id)
17-
->initProperties($this->properties)
18-
->setContext('create');
17+
->initProperties($this->properties);
1918
}
2019
}

src/Notion/Objects/Page.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
11
<?php namespace Notion\Objects;
22

3-
use Notion\RichText;
43
use Notion\ObjectBase;
54

65
class Page extends ObjectBase
76
{
8-
protected $context = 'update';
7+
protected $endpoint = 'pages';
98

109
protected $properties = [];
1110

1211
protected $parent;
1312

1413
protected $children = [];
1514

15+
public function get(): self
16+
{
17+
$client = $this->notion->getClient();
18+
19+
$response = $client->get('pages/' . $this->id);
20+
21+
$data = $response->getJson();
22+
23+
$this->handleResponse($data);
24+
25+
return $this;
26+
}
27+
1628
public function setParent($type, $id): self
1729
{
1830
$this->parent[$type . '_id'] = $id;

0 commit comments

Comments
 (0)