better-notion 1.5.2__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.
@@ -370,22 +370,35 @@ async def clear(page_id: str) -> None:
370
370
  client = get_client()
371
371
  page = await client.pages.get(page_id)
372
372
 
373
- # Collect all block IDs first
373
+ # Collect all block IDs using direct API call
374
374
  block_ids = []
375
- async for block in page.children():
376
- block_ids.append(block.id)
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"])
377
388
 
378
389
  # Delete all blocks
390
+ deleted_count = 0
379
391
  for block_id in block_ids:
380
392
  try:
381
393
  await client.api.blocks.delete(block_id)
394
+ deleted_count += 1
382
395
  except Exception:
383
396
  # Continue even if deletion fails
384
397
  pass
385
398
 
386
399
  result = format_success({
387
400
  "id": page_id,
388
- "blocks_deleted": len(block_ids),
401
+ "blocks_deleted": deleted_count,
389
402
  "status": "cleared",
390
403
  })
391
404
  typer.echo(result)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: better-notion
3
- Version: 1.5.2
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=JMeD-UfrzG2cu73G4X84vZV3gjqFIvS3XifWMSFES18,13894
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.2.dist-info/METADATA,sha256=9aN87PKPI9zNpR7TRBVCMERbB-b-dfaYxNsoZRi2HkQ,11096
130
- better_notion-1.5.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
131
- better_notion-1.5.2.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
132
- better_notion-1.5.2.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
133
- better_notion-1.5.2.dist-info/RECORD,,
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,,