better-notion 1.5.1__py3-none-any.whl → 1.5.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- better_notion/_cli/commands/pages.py +45 -0
- {better_notion-1.5.1.dist-info → better_notion-1.5.3.dist-info}/METADATA +1 -1
- {better_notion-1.5.1.dist-info → better_notion-1.5.3.dist-info}/RECORD +6 -6
- {better_notion-1.5.1.dist-info → better_notion-1.5.3.dist-info}/WHEEL +0 -0
- {better_notion-1.5.1.dist-info → better_notion-1.5.3.dist-info}/entry_points.txt +0 -0
- {better_notion-1.5.1.dist-info → better_notion-1.5.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -359,6 +359,51 @@ async def restore(page_id: str) -> None:
|
|
|
359
359
|
typer.echo(result)
|
|
360
360
|
|
|
361
361
|
|
|
362
|
+
@app.command()
|
|
363
|
+
async def clear(page_id: str) -> None:
|
|
364
|
+
"""
|
|
365
|
+
Clear all blocks from a page.
|
|
366
|
+
|
|
367
|
+
Deletes all content blocks from a page while keeping the page itself.
|
|
368
|
+
The page title and properties are preserved.
|
|
369
|
+
"""
|
|
370
|
+
client = get_client()
|
|
371
|
+
page = await client.pages.get(page_id)
|
|
372
|
+
|
|
373
|
+
# Collect all block IDs using direct API call
|
|
374
|
+
block_ids = []
|
|
375
|
+
response = await client.api._request("GET", f"/blocks/{page_id}/children")
|
|
376
|
+
for block_data in response.get("results", []):
|
|
377
|
+
block_ids.append(block_data["id"])
|
|
378
|
+
|
|
379
|
+
# Handle pagination if there are more blocks
|
|
380
|
+
while response.get("next_cursor"):
|
|
381
|
+
response = await client.api._request(
|
|
382
|
+
"GET",
|
|
383
|
+
f"/blocks/{page_id}/children",
|
|
384
|
+
params={"start_cursor": response["next_cursor"]}
|
|
385
|
+
)
|
|
386
|
+
for block_data in response.get("results", []):
|
|
387
|
+
block_ids.append(block_data["id"])
|
|
388
|
+
|
|
389
|
+
# Delete all blocks
|
|
390
|
+
deleted_count = 0
|
|
391
|
+
for block_id in block_ids:
|
|
392
|
+
try:
|
|
393
|
+
await client.api.blocks.delete(block_id)
|
|
394
|
+
deleted_count += 1
|
|
395
|
+
except Exception:
|
|
396
|
+
# Continue even if deletion fails
|
|
397
|
+
pass
|
|
398
|
+
|
|
399
|
+
result = format_success({
|
|
400
|
+
"id": page_id,
|
|
401
|
+
"blocks_deleted": deleted_count,
|
|
402
|
+
"status": "cleared",
|
|
403
|
+
})
|
|
404
|
+
typer.echo(result)
|
|
405
|
+
|
|
406
|
+
|
|
362
407
|
@app.command("create-from-md")
|
|
363
408
|
async def create_from_md(
|
|
364
409
|
file: str = typer.Option(..., "--file", "-f", help="Path to markdown file"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: better-notion
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.3
|
|
4
4
|
Summary: A high-level Python SDK for the Notion API with developer experience in mind.
|
|
5
5
|
Project-URL: Homepage, https://github.com/nesalia-inc/better-notion
|
|
6
6
|
Project-URL: Documentation, https://github.com/nesalia-inc/better-notion#readme
|
|
@@ -42,7 +42,7 @@ better_notion/_cli/commands/blocks.py,sha256=ErcR-SHhPoz6B9uy0xOG6CGZB-bhvny5lxB
|
|
|
42
42
|
better_notion/_cli/commands/comments.py,sha256=dBdxvpkjk_yA_1WUivXl1Nt8Ig-uYD5-k4XtenHU_cI,4981
|
|
43
43
|
better_notion/_cli/commands/config.py,sha256=3bOCmcRnpTb5SHB2TJPXdxrRshy84nZRAsULxfbSqk0,5360
|
|
44
44
|
better_notion/_cli/commands/databases.py,sha256=SRfUi74Cm7YVvdwPjbcwP1g__DiZsMyY0YLQTY-skx4,12953
|
|
45
|
-
better_notion/_cli/commands/pages.py,sha256=
|
|
45
|
+
better_notion/_cli/commands/pages.py,sha256=tx3lggtxOHwWzpWJWhDLVDAnQEoAIQQx1Z-cncIymXs,14443
|
|
46
46
|
better_notion/_cli/commands/plugins.py,sha256=mBYSVciwwgnCRXYOuJfSYDV2UMAr_9P8KwPuiC-pY2A,27067
|
|
47
47
|
better_notion/_cli/commands/search.py,sha256=JM20W5TiohsOKLyEUABEaWr0yB82W2_qAGQ1w64_pGk,4671
|
|
48
48
|
better_notion/_cli/commands/update.py,sha256=NfmijzTpCbVTEY2h0QdcJZXEiGmWkk-iyEtZCqrgmAk,4997
|
|
@@ -126,8 +126,8 @@ better_notion/utils/agents/rbac.py,sha256=8ZA8Y7wbOiVZDbpjpH7iC35SZrZ0jl4fcJ3xWC
|
|
|
126
126
|
better_notion/utils/agents/schemas.py,sha256=eHfGhY90FAPXA3E8qE6gP75dgNzn-9z5Ju1FMwBKnQQ,22120
|
|
127
127
|
better_notion/utils/agents/state_machine.py,sha256=xUBEeDTbU1Xq-rsRo2sbr6AUYpYrV9DTHOtZT2cWES8,6699
|
|
128
128
|
better_notion/utils/agents/workspace.py,sha256=FYarHj8eD2OeUG0KMPelqpBavm4RnYBoW2PVuwYkKI4,13614
|
|
129
|
-
better_notion-1.5.
|
|
130
|
-
better_notion-1.5.
|
|
131
|
-
better_notion-1.5.
|
|
132
|
-
better_notion-1.5.
|
|
133
|
-
better_notion-1.5.
|
|
129
|
+
better_notion-1.5.3.dist-info/METADATA,sha256=0JpACcjFHf_ddfRCKrx_Typngqi6jLjK46w8KYGuxps,11096
|
|
130
|
+
better_notion-1.5.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
131
|
+
better_notion-1.5.3.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
|
|
132
|
+
better_notion-1.5.3.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
|
|
133
|
+
better_notion-1.5.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|