Skip to content

Commit

Permalink
Correct documentation for ->change...() methods (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariosimao authored Jan 9, 2023
1 parent a4a7218 commit 592e746
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions docs/how-to/add-row-to-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ $notion = Notion::create($token);
$databaseId = "your_database_id_here";
$parent = \Notion\Pages\PageParent::database($databaseId);

$title = \Notion\Pages\Properties\Title::create("Superbad");
$title = \Notion\Pages\Properties\Title::fromText("Superbad");
$release = \Notion\Pages\Properties\Date::create(new DateTimeImmutable("2007-10-19"));
$category = \Notion\Pages\Properties\Select::fromName("Comedy")
->withColor(\Notion\Pages\Properties\Option::COLOR_BROWN);
->changeColor(\Notion\Common\Color::Brown);

$page = \Notion\Pages\Page::create($parent)
->withAddedProperty("Title", $title)
->withAddedProperty("Release date", $release)
->withAddedProperty("Category", $category);
->addProperty("Title", $title)
->addProperty("Release date", $release)
->addProperty("Category", $category);
```
8 changes: 4 additions & 4 deletions docs/how-to/create-a-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ $notion = Notion::create($token);

$parent = PageParent::page("c986d7b0-7051-4f18-b165-cc0b9503ffc2");
$page = Page::create($parent)
->withTitle("Empty page")
->withIcon(Emoji::create("⭐"));
->changeTitle("Empty page")
->changeIcon(Emoji::create("⭐"));

$page = $notion->pages()->create($page);
```
Expand All @@ -38,8 +38,8 @@ $notion = Notion::create($token);

$parent = PageParent::page("c986d7b0-7051-4f18-b165-cc0b9503ffc2");
$page = Page::create($parent)
->withTitle("Shopping list")
->withIcon(Emoji::create("🛒"));
->changeTitle("Shopping list")
->changeIcon(Emoji::create("🛒"));

$content = [
Heading1::fromString("Supermarket"),
Expand Down
4 changes: 2 additions & 2 deletions docs/how-to/query-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ $databaseId = "c986d7b0-7051-4f18-b165-cc0b9503ffc2";
$database = $notion->databases()->find($databaseId);

$query = Query::create()
->withFilter(
->changeFilter(
CompoundFilter::and(
DateFilter::createdTime::pastWeek(),
TextFilter::property("Name")->contains("John"),
)
)
->addSort(Sort::property("Name")->ascending())
->withPageSize(20);
->changePageSize(20);

$result = $notion->databases()->query($database, $query);

Expand Down
6 changes: 3 additions & 3 deletions docs/how-to/update-a-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ $notion = Notion::create($token);

$pageId = "c986d7b0-7051-4f18-b165-cc0b9503ffc2";
$page = $notion->pages()->find($pageId);
$page = $page->withTitle("New title")
->withIcon(Emoji::create(🚲));
$page = $page->changeTitle("New title")
->changeIcon(Emoji::create(🚲));

$notion->pages()->update($page);
```
Expand All @@ -33,7 +33,7 @@ $pageId = "c986d7b0-7051-4f18-b165-cc0b9503ffc2";
$page = $notion->pages()->find($pageId);

$updatedRelease = \Notion\Pages\Properties\Date::create(new DateTimeImmutable("2008-11-04"));
$updatedPage = $page->withAddedProperty("Release date", $updatedRelease);
$updatedPage = $page->addProperty("Release date", $updatedRelease);

$notion->pages()->update($updatedPage);
```

0 comments on commit 592e746

Please sign in to comment.