class FileBlock(UploadBlock): """ File Block. """ _type = "file" size = property_map("size") title = property_map("title")
class FileBlock(UploadBlock): """ File Block. """ _type = "file" size = property_map("size") title = property_map("title") def upload_file(self, path: str): super().upload_file(path) self.size = human_size(path)
class TextBlock(TB): title_plaintext = property_map( "title", python_to_api=plaintext_to_notion, api_to_python=notion_to_plaintext, markdown=True, )
class BookmarkBlock(EmbedBlock): """ Bookmark Block. """ _type = "bookmark" bookmark_cover = field_map("format.bookmark_cover") bookmark_icon = field_map("format.bookmark_icon") description = property_map("description") link = property_map("link") title = property_map("title") def set_new_link(self, link: str): data = {"blockId": self.id, "url": link} self._client.post("setBookmarkMetadata", data) self.refresh()
class BasicBlock(Block): _type = "block" _str_fields = "title" title = property_map("title") title_plaintext = plaintext_property_map("title") color = field_map("format.block_color")
class MediaBlock(Block): """ Media block. """ _type = "media" _str_fields = "caption" caption = property_map("caption")
class CodeBlock(BasicBlock): _type = "code" language = property_map("language") wrap = field_map("format.code_wrap")