better-notion 1.8.2__py3-none-any.whl → 1.8.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.
@@ -10,6 +10,7 @@ from better_notion._api.properties.number import Number
10
10
  from better_notion._api.properties.url import URL
11
11
  from better_notion._api.properties.email import Email
12
12
  from better_notion._api.properties.phone import Phone
13
+ from better_notion._api.properties.relation import Relation
13
14
 
14
15
  __all__ = [
15
16
  "Property",
@@ -27,4 +28,5 @@ __all__ = [
27
28
  "URL",
28
29
  "Email",
29
30
  "Phone",
31
+ "Relation",
30
32
  ]
@@ -0,0 +1,27 @@
1
+ """Relation property builder."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from better_notion._api.properties.base import Property
8
+
9
+
10
+ class Relation(Property):
11
+ """Builder for relation properties."""
12
+
13
+ def __init__(self, page_ids: list[str]) -> None:
14
+ """Initialize a relation property.
15
+
16
+ Args:
17
+ page_ids: List of related page IDs.
18
+ """
19
+ super().__init__("Relation")
20
+ self._page_ids = page_ids
21
+
22
+ def to_dict(self) -> dict[str, Any]:
23
+ """Convert to Notion API format."""
24
+ return {
25
+ "type": "relation",
26
+ "relation": [{"id": page_id} for page_id in self._page_ids]
27
+ }
@@ -61,15 +61,20 @@ class RichText(Property):
61
61
  if self._code:
62
62
  annotations["code"] = True
63
63
 
64
- rich_text_obj: dict[str, Any] = {
64
+ # Build the inner text object
65
+ inner_text_obj: dict[str, Any] = {
65
66
  "type": "text",
66
67
  "text": text_obj,
67
68
  }
68
69
 
69
70
  if annotations:
70
- rich_text_obj["annotations"] = annotations
71
+ inner_text_obj["annotations"] = annotations
71
72
 
72
- return rich_text_obj
73
+ # Return proper rich_text property format
74
+ return {
75
+ "type": "rich_text",
76
+ "rich_text": [inner_text_obj]
77
+ }
73
78
 
74
79
 
75
80
  class Text(Property):
@@ -180,11 +180,22 @@ class Page(BaseEntity):
180
180
  if title_prop:
181
181
  props[title_prop] = Title(name=title_prop, content=title).to_dict()
182
182
 
183
+ # Merge additional kwargs into properties (except for special keys)
184
+ # Special keys that belong at root level: icon, cover, children
185
+ root_level_keys = {"icon", "cover", "children"}
186
+ api_kwargs = {}
187
+ for key, value in kwargs.items():
188
+ if key in root_level_keys:
189
+ api_kwargs[key] = value
190
+ else:
191
+ # Everything else goes into properties
192
+ props[key] = value
193
+
183
194
  # Create page via API
184
195
  data = await client.api.pages.create(
185
196
  parent=parent_ref,
186
197
  properties=props,
187
- **kwargs
198
+ **api_kwargs
188
199
  )
189
200
 
190
201
  page = cls(client, data)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: better-notion
3
- Version: 1.8.2
3
+ Version: 1.8.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
@@ -15,14 +15,15 @@ better_notion/_api/entities/comment.py,sha256=li4bZEA0Q4VwpeSSvg1QJRfIKZL_h79LNT
15
15
  better_notion/_api/entities/database.py,sha256=MsR7AjBihzgo6oGLubECJ0rmeFOxMxa3S-0oESAKAQg,1753
16
16
  better_notion/_api/entities/page.py,sha256=7Xi1IES6dE6gASB1RLHOGLvaUk5yYy98gkRgLHavgns,4595
17
17
  better_notion/_api/entities/user.py,sha256=EVjwvj3ksSoOVIbMlR6Ez3j0PtzNRchvTb8rr5aNJ-s,1145
18
- better_notion/_api/properties/__init__.py,sha256=fdnuzzh3BerMh0GZni-HPjqN_opQ0VXimCgT2-UemOk,926
18
+ better_notion/_api/properties/__init__.py,sha256=WH4hLn4aQuPFFMjGE7N0iawidEcOHaIRrIAnWu2che4,1002
19
19
  better_notion/_api/properties/base.py,sha256=3lSkj50Zm9smlbSANx1ngrjP82ygXnfux3tG02aeFms,895
20
20
  better_notion/_api/properties/checkbox.py,sha256=DTJjq3KxOukoPlpQ7UB173Sf9WHDlND5-7QSwydL7Pc,691
21
21
  better_notion/_api/properties/date.py,sha256=E2rIMcgTMuPf8rS5AdT8M0UyYEDobJ8zJRYoBaFSR9s,2372
22
22
  better_notion/_api/properties/email.py,sha256=JaWHUNJoO837PqGGNPQ7fixG7al3U7i7Ipap7wTLOok,659
23
23
  better_notion/_api/properties/number.py,sha256=6XpDOpnU5D4_Fr7DOX7IoGOk4o9ggyMbcZua-UDL0Kk,671
24
24
  better_notion/_api/properties/phone.py,sha256=EDKKUku51RK86rPt92sbuobJgbhvPhuYe9IlfHzSnI4,678
25
- better_notion/_api/properties/rich_text.py,sha256=4pyHK56nGFRCoZ8Qla5wM8PsjYkU9-3GXL6VcTDr7LQ,3466
25
+ better_notion/_api/properties/relation.py,sha256=e0VKMNhCyoxaqPkTGRZP4D22eNatDvej5Rz726FskpI,708
26
+ better_notion/_api/properties/rich_text.py,sha256=yqdr-snhTQYAcaNs881-OptNkbz2-1N-eTg6fauRO80,3629
26
27
  better_notion/_api/properties/select.py,sha256=5NMzj6dykXiH6xCWx8xWP3eeyUvQICScdTPjJJOQZ_c,1347
27
28
  better_notion/_api/properties/title.py,sha256=SmcSXmiPtnM05hBH7EnJeJW7SYfGrOoPO9cIw1Zs-Jo,815
28
29
  better_notion/_api/properties/url.py,sha256=1_vHKHENevN1b8F3b6pYsZboQXGAPOfsEMgjCe6HXKM,632
@@ -70,7 +71,7 @@ better_notion/_sdk/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
70
71
  better_notion/_sdk/models/block.py,sha256=4Wpx46zVUy0LrwE2eEvUof37iyflmY-nL-NttC7o8tI,15163
71
72
  better_notion/_sdk/models/comment.py,sha256=R82jfAhQODNCdvVywv8dIrmA9lfKgkI8ZSKThQFvG98,8485
72
73
  better_notion/_sdk/models/database.py,sha256=NaplivKjbbxnpYtB19f80yY6075tHZWuvimCPA9j0h4,16746
73
- better_notion/_sdk/models/page.py,sha256=fAgz0XmCXsmSMHpHruix8kzTFdmMSnXqZDEBdydgU1I,20571
74
+ better_notion/_sdk/models/page.py,sha256=bKthDi2UJW2OhT5HHgMtLihTKzC6Zdcj7LQy5OjBHtE,21084
74
75
  better_notion/_sdk/models/user.py,sha256=1yo4F7horPDf7m9Z1Xl1VGxcmgG7vCn_pEFj_oiPyVo,10261
75
76
  better_notion/_sdk/models/blocks/__init__.py,sha256=8kykYs4cvuBlgn6R1tq7b5RMJu7ng7IcWA-0y7kww6A,1928
76
77
  better_notion/_sdk/models/blocks/audio.py,sha256=tlP6oO9VLgs3c5k1kq8y5B56J719bsHUd4QMytR3GUU,2956
@@ -132,8 +133,8 @@ better_notion/utils/agents/rbac.py,sha256=8ZA8Y7wbOiVZDbpjpH7iC35SZrZ0jl4fcJ3xWC
132
133
  better_notion/utils/agents/schemas.py,sha256=eHfGhY90FAPXA3E8qE6gP75dgNzn-9z5Ju1FMwBKnQQ,22120
133
134
  better_notion/utils/agents/state_machine.py,sha256=xUBEeDTbU1Xq-rsRo2sbr6AUYpYrV9DTHOtZT2cWES8,6699
134
135
  better_notion/utils/agents/workspace.py,sha256=Uy8bqLsT_VFGYAPoiQJNuCvGdjMceaSiVGbR9saMpoU,16558
135
- better_notion-1.8.2.dist-info/METADATA,sha256=XsjD6-RtKML0RxB5AgHncysulQj2CbIZiyXFCq1K3M0,11096
136
- better_notion-1.8.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
137
- better_notion-1.8.2.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
138
- better_notion-1.8.2.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
139
- better_notion-1.8.2.dist-info/RECORD,,
136
+ better_notion-1.8.4.dist-info/METADATA,sha256=3fwjaBaqq3PPC4tSzn8Q4PJSJcW-yBRkqjw8Ic979iE,11096
137
+ better_notion-1.8.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
138
+ better_notion-1.8.4.dist-info/entry_points.txt,sha256=D0bUcP7Z00Zyjxw7r2p29T95UrwioDO0aGDoHe9I6fo,55
139
+ better_notion-1.8.4.dist-info/licenses/LICENSE,sha256=BAdN3JpgMY_y_fWqZSCFSvSbC2mTHP-BKDAzF5FXQAI,1069
140
+ better_notion-1.8.4.dist-info/RECORD,,