better-notion 1.5.2__py3-none-any.whl → 1.5.4__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
- await client.api.blocks.delete(block_id)
393
+ await client.api._request("DELETE", f"/blocks/{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)
@@ -522,9 +522,10 @@ class Page(BaseEntity):
522
522
  if cursor:
523
523
  params["start_cursor"] = cursor
524
524
 
525
- return await self._client.api.blocks.children.list(
526
- block_id=self.id,
527
- **params
525
+ return await self._client.api._request(
526
+ "GET",
527
+ f"/blocks/{self.id}/children",
528
+ params=params
528
529
  )
529
530
 
530
531
  # Define item parser
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: better-notion
3
- Version: 1.5.2
3
+ Version: 1.5.4
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=2l1RRKcxy9H2HezTV4_vhKF4cFdwLpoem8YyD9kjAuc,14461
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
@@ -66,7 +66,7 @@ better_notion/_sdk/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
66
66
  better_notion/_sdk/models/block.py,sha256=4Wpx46zVUy0LrwE2eEvUof37iyflmY-nL-NttC7o8tI,15163
67
67
  better_notion/_sdk/models/comment.py,sha256=R82jfAhQODNCdvVywv8dIrmA9lfKgkI8ZSKThQFvG98,8485
68
68
  better_notion/_sdk/models/database.py,sha256=NaplivKjbbxnpYtB19f80yY6075tHZWuvimCPA9j0h4,16746
69
- better_notion/_sdk/models/page.py,sha256=KVGTdt-xuhEYlb1snmZ0VdjMZAQDSWcUwZ18oK5me4g,20541
69
+ better_notion/_sdk/models/page.py,sha256=fAgz0XmCXsmSMHpHruix8kzTFdmMSnXqZDEBdydgU1I,20571
70
70
  better_notion/_sdk/models/user.py,sha256=1yo4F7horPDf7m9Z1Xl1VGxcmgG7vCn_pEFj_oiPyVo,10261
71
71
  better_notion/_sdk/models/blocks/__init__.py,sha256=8kykYs4cvuBlgn6R1tq7b5RMJu7ng7IcWA-0y7kww6A,1928
72
72
  better_notion/_sdk/models/blocks/audio.py,sha256=tlP6oO9VLgs3c5k1kq8y5B56J719bsHUd4QMytR3GUU,2956
@@ -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.4.dist-info/METADATA,sha256=JvdY_DpZZRM30OoqUazmG4bx6X1djPdoaOd0Scn3kBI,11096
130
+ better_notion-1.5.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
131
+ better_notion-1.5.4.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
132
+ better_notion-1.5.4.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
133
+ better_notion-1.5.4.dist-info/RECORD,,