-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from mariosimao/release-0.4.0
Release 0.4.0
- Loading branch information
Showing
65 changed files
with
1,299 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add content to page | ||
|
||
```php | ||
<?php | ||
|
||
use Notion\Blocks\Paragraph; | ||
use Notion\Notion; | ||
|
||
$token = $_ENV["NOTION_SECRET"]; | ||
|
||
$notion = Notion::create($token); | ||
|
||
$pageId = "c986d7b0-7051-4f18-b165-cc0b9503ffc2"; | ||
|
||
$content = [ | ||
Paragraph::fromString("This paragraph will be appended."), | ||
Paragraph::fromString("This other paragraph too!"), | ||
]; | ||
|
||
$notion->blocks()->append($pageId, $content); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Create a page | ||
|
||
## Empty page | ||
|
||
```php | ||
<?php | ||
|
||
use Notion\Notion; | ||
use Notion\Common\Emoji; | ||
use Notion\Pages\Page; | ||
use Notion\Pages\PageParent; | ||
|
||
$token = $_ENV["NOTION_SECRET"]; | ||
|
||
$notion = Notion::create($token); | ||
|
||
$parent = PageParent::page("c986d7b0-7051-4f18-b165-cc0b9503ffc2"); | ||
$page = Page::create($parent) | ||
->withTitle("Empty page") | ||
->withIcon(Emoji::create("⭐")); | ||
|
||
$page = $notion->pages()->create($page); | ||
``` | ||
|
||
## Page with content | ||
|
||
```php | ||
<?php | ||
|
||
use Notion\Blocks\Heading1; | ||
use Notion\Notion; | ||
use Notion\Blocks\ToDo; | ||
use Notion\Common\Emoji; | ||
use Notion\Pages\Page; | ||
use Notion\Pages\PageParent; | ||
|
||
$token = $_ENV["NOTION_SECRET"]; | ||
|
||
$notion = Notion::create($token); | ||
|
||
$parent = PageParent::page("c986d7b0-7051-4f18-b165-cc0b9503ffc2"); | ||
$page = Page::create($parent) | ||
->withTitle("Shopping list") | ||
->withIcon(Emoji::create("🛒")); | ||
|
||
$content = [ | ||
Heading1::fromString("Supermarket"), | ||
ToDo::fromString("Tomato"), | ||
ToDo::fromString("Sugar"), | ||
ToDo::fromString("Apple"), | ||
ToDo::fromString("Milk"), | ||
Heading1::fromString("Mall"), | ||
ToDo::fromString("Black T-shirt"), | ||
]; | ||
|
||
$page = $notion->pages()->create($page, $content); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Delete a page | ||
|
||
Deleted pages are archived. It is possible to recover archived pages. | ||
|
||
```php | ||
<?php | ||
|
||
use Notion\Notion; | ||
|
||
$token = $_ENV["NOTION_SECRET"]; | ||
|
||
$notion = Notion::create($token); | ||
|
||
$pageId = "c986d7b0-7051-4f18-b165-cc0b9503ffc2"; | ||
$page = $notion->pages()->find($pageId); | ||
$page = $notion->pages()->delete($page); | ||
|
||
$page->archived(); // true | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Find a page | ||
|
||
It is possible to retrieve a page by knowing its ID. | ||
|
||
```php | ||
<?php | ||
|
||
use Notion\Notion; | ||
|
||
$token = $_ENV["NOTION_SECRET"]; | ||
|
||
$notion = Notion::create($token); | ||
|
||
$pageId = "c986d7b0-7051-4f18-b165-cc0b9503ffc2"; | ||
$page = $notion->pages()->find($pageId); | ||
|
||
echo $page->title()->toString(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Update a page | ||
|
||
```php | ||
<?php | ||
|
||
use Notion\Notion; | ||
use Notion\Common\Emoji; | ||
|
||
$token = $_ENV["NOTION_SECRET"]; | ||
|
||
$notion = Notion::create($token); | ||
|
||
$pageId = "c986d7b0-7051-4f18-b165-cc0b9503ffc2"; | ||
$page = $notion->pages()->find($pageId); | ||
$page = $page->withTitle("New title") | ||
->withIcon(Emoji::create(🚲)); | ||
|
||
$notion->pages()->update($page); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.