notionary 0.2.19__py3-none-any.whl → 0.2.22__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.
Files changed (220) hide show
  1. notionary/__init__.py +8 -4
  2. notionary/base_notion_client.py +3 -1
  3. notionary/blocks/__init__.py +2 -91
  4. notionary/blocks/_bootstrap.py +271 -0
  5. notionary/blocks/audio/__init__.py +8 -2
  6. notionary/blocks/audio/audio_element.py +69 -106
  7. notionary/blocks/audio/audio_markdown_node.py +13 -5
  8. notionary/blocks/audio/audio_models.py +6 -55
  9. notionary/blocks/base_block_element.py +42 -0
  10. notionary/blocks/bookmark/__init__.py +9 -2
  11. notionary/blocks/bookmark/bookmark_element.py +49 -139
  12. notionary/blocks/bookmark/bookmark_markdown_node.py +19 -18
  13. notionary/blocks/bookmark/bookmark_models.py +15 -0
  14. notionary/blocks/breadcrumbs/__init__.py +17 -0
  15. notionary/blocks/breadcrumbs/breadcrumb_element.py +39 -0
  16. notionary/blocks/breadcrumbs/breadcrumb_markdown_node.py +32 -0
  17. notionary/blocks/breadcrumbs/breadcrumb_models.py +12 -0
  18. notionary/blocks/bulleted_list/__init__.py +12 -2
  19. notionary/blocks/bulleted_list/bulleted_list_element.py +55 -53
  20. notionary/blocks/bulleted_list/bulleted_list_markdown_node.py +2 -1
  21. notionary/blocks/bulleted_list/bulleted_list_models.py +18 -0
  22. notionary/blocks/callout/__init__.py +9 -2
  23. notionary/blocks/callout/callout_element.py +53 -86
  24. notionary/blocks/callout/callout_markdown_node.py +3 -1
  25. notionary/blocks/callout/callout_models.py +33 -0
  26. notionary/blocks/child_database/__init__.py +14 -0
  27. notionary/blocks/child_database/child_database_element.py +61 -0
  28. notionary/blocks/child_database/child_database_models.py +12 -0
  29. notionary/blocks/child_page/__init__.py +9 -0
  30. notionary/blocks/child_page/child_page_element.py +94 -0
  31. notionary/blocks/child_page/child_page_models.py +12 -0
  32. notionary/blocks/{shared/block_client.py → client.py} +54 -54
  33. notionary/blocks/code/__init__.py +6 -2
  34. notionary/blocks/code/code_element.py +96 -181
  35. notionary/blocks/code/code_markdown_node.py +64 -13
  36. notionary/blocks/code/code_models.py +94 -0
  37. notionary/blocks/column/__init__.py +25 -1
  38. notionary/blocks/column/column_element.py +44 -312
  39. notionary/blocks/column/column_list_element.py +52 -0
  40. notionary/blocks/column/column_list_markdown_node.py +50 -0
  41. notionary/blocks/column/column_markdown_node.py +59 -0
  42. notionary/blocks/column/column_models.py +26 -0
  43. notionary/blocks/divider/__init__.py +9 -2
  44. notionary/blocks/divider/divider_element.py +18 -49
  45. notionary/blocks/divider/divider_markdown_node.py +2 -1
  46. notionary/blocks/divider/divider_models.py +12 -0
  47. notionary/blocks/embed/__init__.py +9 -2
  48. notionary/blocks/embed/embed_element.py +65 -111
  49. notionary/blocks/embed/embed_markdown_node.py +3 -1
  50. notionary/blocks/embed/embed_models.py +14 -0
  51. notionary/blocks/equation/__init__.py +14 -0
  52. notionary/blocks/equation/equation_element.py +133 -0
  53. notionary/blocks/equation/equation_element_markdown_node.py +35 -0
  54. notionary/blocks/equation/equation_models.py +11 -0
  55. notionary/blocks/file/__init__.py +25 -0
  56. notionary/blocks/file/file_element.py +112 -0
  57. notionary/blocks/file/file_element_markdown_node.py +37 -0
  58. notionary/blocks/file/file_element_models.py +39 -0
  59. notionary/blocks/guards.py +22 -0
  60. notionary/blocks/heading/__init__.py +16 -2
  61. notionary/blocks/heading/heading_element.py +83 -69
  62. notionary/blocks/heading/heading_markdown_node.py +2 -1
  63. notionary/blocks/heading/heading_models.py +29 -0
  64. notionary/blocks/image_block/__init__.py +13 -0
  65. notionary/blocks/image_block/image_element.py +89 -0
  66. notionary/blocks/{image → image_block}/image_markdown_node.py +13 -6
  67. notionary/blocks/image_block/image_models.py +10 -0
  68. notionary/blocks/mixins/captions/__init__.py +4 -0
  69. notionary/blocks/mixins/captions/caption_markdown_node_mixin.py +31 -0
  70. notionary/blocks/mixins/captions/caption_mixin.py +92 -0
  71. notionary/blocks/models.py +174 -0
  72. notionary/blocks/numbered_list/__init__.py +12 -2
  73. notionary/blocks/numbered_list/numbered_list_element.py +48 -56
  74. notionary/blocks/numbered_list/numbered_list_markdown_node.py +3 -1
  75. notionary/blocks/numbered_list/numbered_list_models.py +17 -0
  76. notionary/blocks/paragraph/__init__.py +12 -2
  77. notionary/blocks/paragraph/paragraph_element.py +40 -66
  78. notionary/blocks/paragraph/paragraph_markdown_node.py +2 -1
  79. notionary/blocks/paragraph/paragraph_models.py +16 -0
  80. notionary/blocks/pdf/__init__.py +13 -0
  81. notionary/blocks/pdf/pdf_element.py +97 -0
  82. notionary/blocks/pdf/pdf_markdown_node.py +37 -0
  83. notionary/blocks/pdf/pdf_models.py +11 -0
  84. notionary/blocks/quote/__init__.py +11 -2
  85. notionary/blocks/quote/quote_element.py +45 -62
  86. notionary/blocks/quote/quote_markdown_node.py +6 -3
  87. notionary/blocks/quote/quote_models.py +18 -0
  88. notionary/blocks/registry/__init__.py +4 -0
  89. notionary/blocks/registry/block_registry.py +60 -121
  90. notionary/blocks/registry/block_registry_builder.py +115 -59
  91. notionary/blocks/rich_text/__init__.py +33 -0
  92. notionary/blocks/rich_text/name_to_id_resolver.py +205 -0
  93. notionary/blocks/rich_text/rich_text_models.py +221 -0
  94. notionary/blocks/rich_text/text_inline_formatter.py +456 -0
  95. notionary/blocks/syntax_prompt_builder.py +137 -0
  96. notionary/blocks/table/__init__.py +16 -2
  97. notionary/blocks/table/table_element.py +136 -228
  98. notionary/blocks/table/table_markdown_node.py +2 -1
  99. notionary/blocks/table/table_models.py +28 -0
  100. notionary/blocks/table_of_contents/__init__.py +19 -0
  101. notionary/blocks/table_of_contents/table_of_contents_element.py +68 -0
  102. notionary/blocks/table_of_contents/table_of_contents_markdown_node.py +35 -0
  103. notionary/blocks/table_of_contents/table_of_contents_models.py +18 -0
  104. notionary/blocks/todo/__init__.py +9 -2
  105. notionary/blocks/todo/todo_element.py +52 -92
  106. notionary/blocks/todo/todo_markdown_node.py +2 -1
  107. notionary/blocks/todo/todo_models.py +19 -0
  108. notionary/blocks/toggle/__init__.py +13 -3
  109. notionary/blocks/toggle/toggle_element.py +69 -260
  110. notionary/blocks/toggle/toggle_markdown_node.py +25 -15
  111. notionary/blocks/toggle/toggle_models.py +17 -0
  112. notionary/blocks/toggleable_heading/__init__.py +6 -2
  113. notionary/blocks/toggleable_heading/toggleable_heading_element.py +86 -241
  114. notionary/blocks/toggleable_heading/toggleable_heading_markdown_node.py +26 -18
  115. notionary/blocks/types.py +130 -0
  116. notionary/blocks/video/__init__.py +8 -2
  117. notionary/blocks/video/video_element.py +70 -141
  118. notionary/blocks/video/video_element_models.py +10 -0
  119. notionary/blocks/video/video_markdown_node.py +13 -6
  120. notionary/database/client.py +26 -8
  121. notionary/database/database.py +13 -14
  122. notionary/database/database_filter_builder.py +2 -2
  123. notionary/database/database_provider.py +5 -4
  124. notionary/database/models.py +337 -0
  125. notionary/database/notion_database.py +6 -7
  126. notionary/file_upload/client.py +5 -7
  127. notionary/file_upload/models.py +3 -2
  128. notionary/file_upload/notion_file_upload.py +2 -3
  129. notionary/markdown/markdown_builder.py +729 -0
  130. notionary/markdown/markdown_document_model.py +228 -0
  131. notionary/{blocks → markdown}/markdown_node.py +1 -0
  132. notionary/models/notion_database_response.py +0 -338
  133. notionary/page/client.py +34 -15
  134. notionary/page/models.py +327 -0
  135. notionary/page/notion_page.py +136 -58
  136. notionary/page/{content/page_content_writer.py → page_content_deleting_service.py} +25 -59
  137. notionary/page/page_content_writer.py +177 -0
  138. notionary/page/page_context.py +65 -0
  139. notionary/page/reader/handler/__init__.py +19 -0
  140. notionary/page/reader/handler/base_block_renderer.py +44 -0
  141. notionary/page/reader/handler/block_processing_context.py +35 -0
  142. notionary/page/reader/handler/block_rendering_context.py +48 -0
  143. notionary/page/reader/handler/column_list_renderer.py +51 -0
  144. notionary/page/reader/handler/column_renderer.py +60 -0
  145. notionary/page/reader/handler/line_renderer.py +73 -0
  146. notionary/page/reader/handler/numbered_list_renderer.py +85 -0
  147. notionary/page/reader/handler/toggle_renderer.py +69 -0
  148. notionary/page/reader/handler/toggleable_heading_renderer.py +89 -0
  149. notionary/page/reader/page_content_retriever.py +81 -0
  150. notionary/page/search_filter_builder.py +2 -1
  151. notionary/page/writer/handler/__init__.py +24 -0
  152. notionary/page/writer/handler/code_handler.py +72 -0
  153. notionary/page/writer/handler/column_handler.py +141 -0
  154. notionary/page/writer/handler/column_list_handler.py +139 -0
  155. notionary/page/writer/handler/equation_handler.py +74 -0
  156. notionary/page/writer/handler/line_handler.py +35 -0
  157. notionary/page/writer/handler/line_processing_context.py +54 -0
  158. notionary/page/writer/handler/regular_line_handler.py +86 -0
  159. notionary/page/writer/handler/table_handler.py +66 -0
  160. notionary/page/writer/handler/toggle_handler.py +155 -0
  161. notionary/page/writer/handler/toggleable_heading_handler.py +173 -0
  162. notionary/page/writer/markdown_to_notion_converter.py +95 -0
  163. notionary/page/writer/markdown_to_notion_converter_context.py +30 -0
  164. notionary/page/writer/markdown_to_notion_formatting_post_processor.py +73 -0
  165. notionary/page/writer/notion_text_length_processor.py +150 -0
  166. notionary/telemetry/__init__.py +2 -2
  167. notionary/telemetry/service.py +3 -3
  168. notionary/user/__init__.py +2 -2
  169. notionary/user/base_notion_user.py +2 -1
  170. notionary/user/client.py +2 -3
  171. notionary/user/models.py +1 -0
  172. notionary/user/notion_bot_user.py +4 -5
  173. notionary/user/notion_user.py +3 -4
  174. notionary/user/notion_user_manager.py +23 -95
  175. notionary/util/__init__.py +3 -2
  176. notionary/util/fuzzy.py +2 -1
  177. notionary/util/logging_mixin.py +2 -2
  178. notionary/util/singleton_metaclass.py +1 -1
  179. notionary/workspace.py +6 -5
  180. notionary-0.2.22.dist-info/METADATA +237 -0
  181. notionary-0.2.22.dist-info/RECORD +200 -0
  182. notionary/blocks/document/__init__.py +0 -7
  183. notionary/blocks/document/document_element.py +0 -102
  184. notionary/blocks/document/document_markdown_node.py +0 -31
  185. notionary/blocks/image/__init__.py +0 -7
  186. notionary/blocks/image/image_element.py +0 -151
  187. notionary/blocks/markdown_builder.py +0 -356
  188. notionary/blocks/mention/__init__.py +0 -7
  189. notionary/blocks/mention/mention_element.py +0 -229
  190. notionary/blocks/mention/mention_markdown_node.py +0 -38
  191. notionary/blocks/prompts/element_prompt_builder.py +0 -83
  192. notionary/blocks/prompts/element_prompt_content.py +0 -41
  193. notionary/blocks/shared/models.py +0 -713
  194. notionary/blocks/shared/notion_block_element.py +0 -37
  195. notionary/blocks/shared/text_inline_formatter.py +0 -262
  196. notionary/blocks/shared/text_inline_formatter_new.py +0 -139
  197. notionary/database/models/page_result.py +0 -10
  198. notionary/models/notion_block_response.py +0 -264
  199. notionary/models/notion_page_response.py +0 -78
  200. notionary/models/search_response.py +0 -0
  201. notionary/page/__init__.py +0 -0
  202. notionary/page/content/markdown_whitespace_processor.py +0 -80
  203. notionary/page/content/notion_text_length_utils.py +0 -87
  204. notionary/page/content/page_content_retriever.py +0 -60
  205. notionary/page/formatting/line_processor.py +0 -153
  206. notionary/page/formatting/markdown_to_notion_converter.py +0 -153
  207. notionary/page/markdown_syntax_prompt_generator.py +0 -114
  208. notionary/page/notion_to_markdown_converter.py +0 -179
  209. notionary/page/properites/property_value_extractor.py +0 -0
  210. notionary/user/notion_user_provider.py +0 -1
  211. notionary-0.2.19.dist-info/METADATA +0 -225
  212. notionary-0.2.19.dist-info/RECORD +0 -150
  213. /notionary/{blocks/document/document_models.py → markdown/___init__.py} +0 -0
  214. /notionary/{blocks/image/image_models.py → markdown/makdown_document_model.py} +0 -0
  215. /notionary/{blocks/mention/mention_models.py → page/reader/handler/equation_renderer.py} +0 -0
  216. /notionary/{blocks/shared/__init__.py → page/writer/markdown_to_notion_post_processor.py} +0 -0
  217. /notionary/{blocks/toggleable_heading/toggleable_heading_models.py → page/writer/markdown_to_notion_text_length_post_processor.py} +0 -0
  218. /notionary/{elements/__init__.py → util/concurrency_limiter.py} +0 -0
  219. {notionary-0.2.19.dist-info → notionary-0.2.22.dist-info}/LICENSE +0 -0
  220. {notionary-0.2.19.dist-info → notionary-0.2.22.dist-info}/WHEEL +0 -0
@@ -0,0 +1,337 @@
1
+ from dataclasses import dataclass
2
+ from typing import Any, Dict, List, Literal, Optional, Union
3
+
4
+ from pydantic import BaseModel, ConfigDict
5
+
6
+ from notionary.page.models import Cover, Icon
7
+
8
+
9
+ @dataclass
10
+ class TextContent:
11
+ content: str
12
+ link: Optional[str] = None
13
+
14
+
15
+ @dataclass
16
+ class RichText:
17
+ type: str
18
+ text: TextContent
19
+ plain_text: str
20
+ href: Optional[str]
21
+
22
+
23
+ @dataclass
24
+ class User:
25
+ object: str
26
+ id: str
27
+
28
+
29
+ @dataclass
30
+ class Parent:
31
+ type: Literal["page_id", "workspace", "block_id", "database_id"]
32
+ page_id: Optional[str] = None
33
+ block_id: Optional[str] = None
34
+ database_id: Optional[str] = None
35
+
36
+
37
+ # Rich text types for Pydantic models
38
+ class TextContentPydantic(BaseModel):
39
+ content: str
40
+ link: Optional[Dict[str, str]] = None
41
+
42
+
43
+ class Annotations(BaseModel):
44
+ bold: bool
45
+ italic: bool
46
+ strikethrough: bool
47
+ underline: bool
48
+ code: bool
49
+ color: str
50
+
51
+
52
+ class RichTextItemPydantic(BaseModel):
53
+ type: str # 'text', 'mention', 'equation'
54
+ text: Optional[TextContentPydantic] = None
55
+ annotations: Annotations
56
+ plain_text: str
57
+ href: Optional[str] = None
58
+
59
+
60
+ # Database property schema types (these are schema definitions, not values)
61
+ class StatusOption(BaseModel):
62
+ id: str
63
+ name: str
64
+ color: str
65
+ description: Optional[str] = None
66
+
67
+
68
+ class StatusGroup(BaseModel):
69
+ id: str
70
+ name: str
71
+ color: str
72
+ option_ids: List[str]
73
+
74
+
75
+ class StatusPropertySchema(BaseModel):
76
+ options: List[StatusOption]
77
+ groups: List[StatusGroup]
78
+
79
+
80
+ class DatabaseStatusProperty(BaseModel):
81
+ id: str
82
+ name: str
83
+ type: Literal["status"]
84
+ status: StatusPropertySchema
85
+
86
+
87
+ class RelationPropertySchema(BaseModel):
88
+ database_id: str
89
+ type: str # "single_property"
90
+ single_property: Dict[str, Any]
91
+
92
+
93
+ class DatabaseRelationProperty(BaseModel):
94
+ id: str
95
+ name: str
96
+ type: Literal["relation"]
97
+ relation: RelationPropertySchema
98
+
99
+
100
+ class DatabaseUrlProperty(BaseModel):
101
+ id: str
102
+ name: str
103
+ type: Literal["url"]
104
+ url: Dict[str, Any] # Usually empty dict
105
+
106
+
107
+ class DatabaseRichTextProperty(BaseModel):
108
+ id: str
109
+ name: str
110
+ type: Literal["rich_text"]
111
+ rich_text: Dict[str, Any] # Usually empty dict
112
+
113
+
114
+ class MultiSelectOption(BaseModel):
115
+ id: str
116
+ name: str
117
+ color: str
118
+ description: Optional[str] = None
119
+
120
+
121
+ class MultiSelectPropertySchema(BaseModel):
122
+ options: List[MultiSelectOption]
123
+
124
+
125
+ class DatabaseMultiSelectProperty(BaseModel):
126
+ id: str
127
+ name: str
128
+ type: Literal["multi_select"]
129
+ multi_select: MultiSelectPropertySchema
130
+
131
+
132
+ class DatabaseTitleProperty(BaseModel):
133
+ id: str
134
+ name: str
135
+ type: Literal["title"]
136
+ title: Dict[str, Any] # Usually empty dict
137
+
138
+
139
+ # Generic database property for unknown types
140
+ class GenericDatabaseProperty(BaseModel):
141
+ id: str
142
+ name: str
143
+ type: str
144
+
145
+ model_config = ConfigDict(extra="allow")
146
+
147
+
148
+ # Union of all database property types
149
+ DatabaseProperty = Union[
150
+ DatabaseStatusProperty,
151
+ DatabaseRelationProperty,
152
+ DatabaseUrlProperty,
153
+ DatabaseRichTextProperty,
154
+ DatabaseMultiSelectProperty,
155
+ DatabaseTitleProperty,
156
+ GenericDatabaseProperty,
157
+ ]
158
+
159
+
160
+ # Page property value types (these are actual values, not schemas)
161
+ class StatusValue(BaseModel):
162
+ id: str
163
+ name: str
164
+ color: str
165
+
166
+
167
+ class StatusProperty(BaseModel):
168
+ id: str
169
+ type: str # 'status'
170
+ status: Optional[StatusValue] = None
171
+
172
+
173
+ class RelationItem(BaseModel):
174
+ id: str
175
+
176
+
177
+ class RelationProperty(BaseModel):
178
+ id: str
179
+ type: str # 'relation'
180
+ relation: List[RelationItem]
181
+ has_more: bool
182
+
183
+
184
+ class UrlProperty(BaseModel):
185
+ id: str
186
+ type: str # 'url'
187
+ url: Optional[str] = None
188
+
189
+
190
+ class RichTextProperty(BaseModel):
191
+ id: str
192
+ type: str # 'rich_text'
193
+ rich_text: List[RichTextItemPydantic]
194
+
195
+
196
+ class MultiSelectItem(BaseModel):
197
+ id: str
198
+ name: str
199
+ color: str
200
+
201
+
202
+ class MultiSelectProperty(BaseModel):
203
+ id: str
204
+ type: str # 'multi_select'
205
+ multi_select: List[MultiSelectItem]
206
+
207
+
208
+ class TitleProperty(BaseModel):
209
+ id: str
210
+ type: str # 'title'
211
+ title: List[RichTextItemPydantic]
212
+
213
+
214
+ # Cover types
215
+ class ExternalCover(BaseModel):
216
+ url: str
217
+
218
+
219
+ class NotionCover(BaseModel):
220
+ type: str # 'external', 'file'
221
+ external: Optional[ExternalCover] = None
222
+
223
+
224
+ # Parent types for Pydantic
225
+ class NotionParent(BaseModel):
226
+ type: str # 'database_id', 'page_id', 'workspace'
227
+ database_id: Optional[str] = None
228
+ page_id: Optional[str] = None
229
+
230
+
231
+ # User type for Pydantic
232
+ class NotionUser(BaseModel):
233
+ object: str # 'user'
234
+ id: str
235
+
236
+
237
+ # Database object
238
+ class NotionDatabaseResponse(BaseModel):
239
+ """
240
+ Represents the response from the Notion API when retrieving a database.
241
+ """
242
+
243
+ object: Literal["database"]
244
+ id: str
245
+ cover: Optional[Any] = None
246
+ icon: Optional[Icon] = None
247
+ cover: Optional[Cover]
248
+ created_time: str
249
+ last_edited_time: str
250
+ created_by: NotionUser
251
+ last_edited_by: NotionUser
252
+ title: List[RichTextItemPydantic]
253
+ description: List[Any]
254
+ is_inline: bool
255
+ properties: Dict[
256
+ str, Any
257
+ ] # Using Any for flexibility with different property schemas
258
+ parent: NotionParent
259
+ url: str
260
+ public_url: Optional[str] = None
261
+ archived: bool
262
+ in_trash: bool
263
+
264
+
265
+ class NotionPageResponse(BaseModel):
266
+ object: Literal["page"]
267
+ id: str
268
+ created_time: str
269
+ last_edited_time: str
270
+ created_by: NotionUser
271
+ last_edited_by: NotionUser
272
+ cover: Optional[NotionCover] = None
273
+ icon: Optional[Icon] = None
274
+ parent: NotionParent
275
+ archived: bool
276
+ in_trash: bool
277
+ properties: Dict[str, Any]
278
+ url: str
279
+ public_url: Optional[str] = None
280
+
281
+
282
+ class NotionQueryResponse(BaseModel):
283
+ """
284
+ Complete Notion search/query response model that can contain both pages and databases.
285
+ """
286
+
287
+ object: Literal["list"]
288
+ results: List[Union[NotionPageResponse, NotionDatabaseResponse]]
289
+ next_cursor: Optional[str] = None
290
+ has_more: bool
291
+ type: Literal["page_or_database"]
292
+ page_or_database: Dict[str, Any]
293
+ request_id: str
294
+
295
+
296
+ # Specific response type for database queries (pages only)
297
+ class NotionQueryDatabaseResponse(BaseModel):
298
+ """
299
+ Notion database query response model for querying pages within a database.
300
+ """
301
+
302
+ object: Literal["list"]
303
+ results: List[NotionPageResponse]
304
+ next_cursor: Optional[str] = None
305
+ has_more: bool
306
+ type: Literal["page_or_database"]
307
+ page_or_database: Dict[str, Any]
308
+ request_id: str
309
+
310
+
311
+ # Specific response type for search results (can be mixed)
312
+ class NotionSearchResponse(BaseModel):
313
+ """
314
+ Notion search response model that can return both pages and databases.
315
+ """
316
+
317
+ object: Literal["list"]
318
+ results: List[Union[NotionPageResponse, NotionDatabaseResponse]]
319
+ next_cursor: Optional[str] = None
320
+ has_more: bool
321
+ type: Literal["page_or_database"]
322
+ page_or_database: Dict[str, Any]
323
+ request_id: str
324
+
325
+
326
+ class NotionDatabaseSearchResponse(BaseModel):
327
+ """
328
+ Notion search response model for database-only searches.
329
+ """
330
+
331
+ object: Literal["list"]
332
+ results: List[NotionDatabaseResponse]
333
+ next_cursor: Optional[str] = None
334
+ has_more: bool
335
+ type: Literal["page_or_database"]
336
+ page_or_database: Dict[str, Any]
337
+ request_id: str
@@ -1,25 +1,24 @@
1
1
  from __future__ import annotations
2
+
2
3
  import asyncio
3
4
  import random
4
5
  from typing import Any, AsyncGenerator, Dict, Optional
5
6
 
7
+ from notionary import NotionPage
6
8
  from notionary.database.client import NotionDatabaseClient
9
+ from notionary.database.database_filter_builder import DatabaseFilterBuilder
10
+ from notionary.database.database_provider import NotionDatabaseProvider
7
11
  from notionary.models.notion_database_response import (
8
12
  NotionDatabaseResponse,
9
13
  NotionPageResponse,
10
14
  NotionQueryDatabaseResponse,
11
15
  )
12
- from notionary import NotionPage
13
-
14
- from notionary.database.database_provider import NotionDatabaseProvider
15
-
16
- from notionary.database.database_filter_builder import DatabaseFilterBuilder
17
16
  from notionary.telemetry import (
18
- ProductTelemetry,
19
17
  DatabaseFactoryUsedEvent,
18
+ ProductTelemetry,
20
19
  QueryOperationEvent,
21
20
  )
22
- from notionary.util import factory_only, LoggingMixin
21
+ from notionary.util import LoggingMixin, factory_only
23
22
 
24
23
 
25
24
  class NotionDatabase(LoggingMixin):
@@ -1,21 +1,19 @@
1
- from typing import Optional, BinaryIO
2
1
  from io import BytesIO
3
2
  from pathlib import Path
4
- import httpx
3
+ from typing import BinaryIO, Optional
5
4
 
6
5
  import aiofiles
6
+ import httpx
7
7
 
8
8
  from notionary.base_notion_client import BaseNotionClient
9
9
  from notionary.file_upload.models import (
10
- FileUploadResponse,
11
- FileUploadListResponse,
12
- FileUploadCreateRequest,
13
10
  FileUploadCompleteRequest,
11
+ FileUploadCreateRequest,
12
+ FileUploadListResponse,
13
+ FileUploadResponse,
14
14
  )
15
- from notionary.util import singleton
16
15
 
17
16
 
18
- @singleton
19
17
  class NotionFileUploadClient(BaseNotionClient):
20
18
  """
21
19
  Client for Notion file upload operations.
@@ -1,4 +1,5 @@
1
- from typing import Literal, Optional, List
1
+ from typing import Literal, Optional
2
+
2
3
  from pydantic import BaseModel
3
4
 
4
5
 
@@ -27,7 +28,7 @@ class FileUploadListResponse(BaseModel):
27
28
  """
28
29
 
29
30
  object: Literal["list"]
30
- results: List[FileUploadResponse]
31
+ results: list[FileUploadResponse]
31
32
  next_cursor: Optional[str] = None
32
33
  has_more: bool
33
34
  type: Literal["file_upload"]
@@ -1,10 +1,9 @@
1
1
  import asyncio
2
2
  import mimetypes
3
- from typing import Optional
4
- from pathlib import Path
5
3
  from datetime import datetime, timedelta
6
4
  from io import BytesIO
7
-
5
+ from pathlib import Path
6
+ from typing import Optional
8
7
 
9
8
  from notionary.file_upload.models import FileUploadResponse
10
9
  from notionary.util import LoggingMixin