Skip to content

Commit

Permalink
add #72
Browse files Browse the repository at this point in the history
  • Loading branch information
petrpaluba committed Oct 4, 2023
1 parent 3e9106b commit 909945b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [#68](https://github.com/lastorel/pytion/issues/68): insert Block support
- [#70](https://github.com/lastorel/pytion/issues/70): fix database filtering using `*_time` attribute
- [#72](https://github.com/lastorel/pytion/issues/72): `public_url` attr added

## v1.3.4

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ There is a list of available methods for communicate with **api.notion.com**. Th

`.block_update(id_, block_obj, new_text, archived)` - Update text in Block.

`.block_append(id_, block, blocks)` - Append block or blocks children.
`.block_append(id_, block, blocks, after)` - Append block or blocks children.

`.get_myself()` - Retrieve my bot User.

Expand Down Expand Up @@ -218,12 +218,14 @@ There are classes **based on API** structures:
- use `.db_filter()` to get database content with filtering and/or sorting
- has `.description` attr
- has `.is_inline` attr with the value True if the database appears in the page as an inline block
- has `.public_url` attr when a page or database has been shared publicly
- `Page` based on [Page object](https://developers.notion.com/reference/page)
- You can create object `Page.create(...)` and/or use `.page_create(...)` API method
- use `.page_update()` method to modify attributes or delete the page
- use `.get_block_children()` to get page content (without nested blocks) (it will be `BlockArray`)
- use `.get_block_children_recursive()` to get page content with nested blocks
- use `.get_page_property()` to retrieve the specific `PropertyValue` of the page
- has `.public_url` attr when a page or database has been shared publicly
- `Block` based on [Block object](https://developers.notion.com/reference/block)
- You can create object `Block.create(...)` of specific type from [_support matrix_](#supported-block-types) below and then use it while creating pages or appending
- use `.block_update()` to replace content or change _extension attributes_ or delete the block
Expand Down
2 changes: 2 additions & 0 deletions pytion/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ def __init__(self, **kwargs) -> None:
}
self.parent = kwargs["parent"] if isinstance(kwargs.get("parent"), LinkTo) else LinkTo(**kwargs["parent"])
self.url: str = kwargs.get("url")
self.public_url = kwargs.get("public_url")
self.description = None
if "description" in kwargs and kwargs["description"]:
if isinstance(kwargs["description"], RichTextArray):
Expand Down Expand Up @@ -614,6 +615,7 @@ def __init__(self, **kwargs) -> None:
self.parent = kwargs["parent"] if isinstance(kwargs.get("parent"), LinkTo) else LinkTo(**kwargs["parent"])
self.archived: bool = kwargs.get("archived")
self.url: str = kwargs.get("url")
self.public_url = kwargs.get("public_url")
self.children = kwargs["children"] if "children" in kwargs else LinkTo(block=self)
self.properties = {
name: (PropertyValue(data, name) if not isinstance(data, PropertyValue) else data)
Expand Down

0 comments on commit 909945b

Please sign in to comment.