notionary 0.3.0__py3-none-any.whl → 0.4.0__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.
- notionary/__init__.py +14 -2
- notionary/blocks/enums.py +27 -6
- notionary/blocks/schemas.py +32 -78
- notionary/comments/client.py +6 -9
- notionary/comments/schemas.py +2 -29
- notionary/data_source/http/data_source_instance_client.py +4 -4
- notionary/data_source/properties/schemas.py +128 -107
- notionary/data_source/query/__init__.py +9 -0
- notionary/data_source/query/builder.py +12 -3
- notionary/data_source/query/schema.py +5 -0
- notionary/data_source/schemas.py +2 -2
- notionary/data_source/service.py +43 -132
- notionary/database/schemas.py +2 -2
- notionary/database/service.py +19 -63
- notionary/exceptions/__init__.py +10 -2
- notionary/exceptions/api.py +2 -2
- notionary/exceptions/base.py +1 -1
- notionary/exceptions/block_parsing.py +24 -3
- notionary/exceptions/data_source/builder.py +2 -2
- notionary/exceptions/data_source/properties.py +3 -3
- notionary/exceptions/file_upload.py +67 -0
- notionary/exceptions/properties.py +4 -4
- notionary/exceptions/search.py +4 -4
- notionary/file_upload/__init__.py +4 -0
- notionary/file_upload/client.py +124 -210
- notionary/file_upload/config/__init__.py +17 -0
- notionary/file_upload/config/config.py +32 -0
- notionary/file_upload/config/constants.py +16 -0
- notionary/file_upload/file/reader.py +28 -0
- notionary/file_upload/query/__init__.py +7 -0
- notionary/file_upload/query/builder.py +54 -0
- notionary/file_upload/query/models.py +37 -0
- notionary/file_upload/schemas.py +78 -0
- notionary/file_upload/service.py +152 -289
- notionary/file_upload/validation/factory.py +64 -0
- notionary/file_upload/validation/impl/file_name_length.py +23 -0
- notionary/file_upload/validation/models.py +124 -0
- notionary/file_upload/validation/port.py +7 -0
- notionary/file_upload/validation/service.py +17 -0
- notionary/file_upload/validation/validators/__init__.py +11 -0
- notionary/file_upload/validation/validators/file_exists.py +15 -0
- notionary/file_upload/validation/validators/file_extension.py +122 -0
- notionary/file_upload/validation/validators/file_name_length.py +21 -0
- notionary/file_upload/validation/validators/upload_limit.py +31 -0
- notionary/http/client.py +7 -23
- notionary/page/content/factory.py +2 -0
- notionary/page/content/parser/factory.py +8 -5
- notionary/page/content/parser/parsers/audio.py +8 -33
- notionary/page/content/parser/parsers/embed.py +0 -2
- notionary/page/content/parser/parsers/file.py +8 -35
- notionary/page/content/parser/parsers/file_like_block.py +89 -0
- notionary/page/content/parser/parsers/image.py +8 -35
- notionary/page/content/parser/parsers/pdf.py +8 -35
- notionary/page/content/parser/parsers/video.py +8 -35
- notionary/page/content/parser/pre_processsing/handlers/__init__.py +2 -0
- notionary/page/content/parser/pre_processsing/handlers/column_syntax.py +12 -8
- notionary/page/content/parser/pre_processsing/handlers/indentation.py +2 -0
- notionary/page/content/parser/pre_processsing/handlers/video_syntax.py +66 -0
- notionary/page/content/parser/pre_processsing/handlers/whitespace.py +2 -0
- notionary/page/content/renderer/renderers/audio.py +9 -21
- notionary/page/content/renderer/renderers/file.py +9 -21
- notionary/page/content/renderer/renderers/file_like_block.py +43 -0
- notionary/page/content/renderer/renderers/image.py +9 -21
- notionary/page/content/renderer/renderers/pdf.py +9 -21
- notionary/page/content/renderer/renderers/video.py +9 -21
- notionary/page/content/syntax/__init__.py +2 -1
- notionary/page/content/syntax/registry.py +38 -60
- notionary/page/properties/client.py +3 -3
- notionary/page/properties/{models.py → schemas.py} +93 -107
- notionary/page/properties/service.py +15 -4
- notionary/page/schemas.py +3 -3
- notionary/page/service.py +18 -79
- notionary/shared/entity/dto_parsers.py +1 -36
- notionary/shared/entity/entity_metadata_update_client.py +18 -4
- notionary/shared/entity/schemas.py +6 -6
- notionary/shared/entity/service.py +121 -40
- notionary/shared/models/file.py +34 -6
- notionary/shared/models/icon.py +5 -12
- notionary/user/bot.py +12 -12
- notionary/utils/decorators.py +8 -8
- notionary/utils/pagination.py +36 -32
- notionary/workspace/__init__.py +2 -2
- notionary/workspace/client.py +2 -0
- notionary/workspace/query/__init__.py +3 -2
- notionary/workspace/query/builder.py +25 -1
- notionary/workspace/query/models.py +9 -1
- notionary/workspace/query/service.py +15 -11
- notionary/workspace/service.py +46 -36
- {notionary-0.3.0.dist-info → notionary-0.4.0.dist-info}/METADATA +9 -5
- {notionary-0.3.0.dist-info → notionary-0.4.0.dist-info}/RECORD +92 -71
- notionary/file_upload/models.py +0 -69
- notionary/page/page_context.py +0 -50
- notionary/shared/models/cover.py +0 -20
- {notionary-0.3.0.dist-info → notionary-0.4.0.dist-info}/WHEEL +0 -0
- {notionary-0.3.0.dist-info → notionary-0.4.0.dist-info}/licenses/LICENSE +0 -0
notionary/__init__.py
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
from .data_source.service import NotionDataSource
|
|
2
2
|
from .database.service import NotionDatabase
|
|
3
|
+
from .file_upload import FileUploadQuery, FileUploadQueryBuilder, NotionFileUpload
|
|
3
4
|
from .page.content.markdown.builder import MarkdownBuilder
|
|
4
5
|
from .page.service import NotionPage
|
|
5
|
-
from .workspace import NotionWorkspace
|
|
6
|
+
from .workspace import NotionWorkspace, NotionWorkspaceQueryConfigBuilder, WorkspaceQueryConfig
|
|
6
7
|
|
|
7
|
-
__all__ = [
|
|
8
|
+
__all__ = [
|
|
9
|
+
"FileUploadQuery",
|
|
10
|
+
"FileUploadQueryBuilder",
|
|
11
|
+
"MarkdownBuilder",
|
|
12
|
+
"NotionDataSource",
|
|
13
|
+
"NotionDatabase",
|
|
14
|
+
"NotionFileUpload",
|
|
15
|
+
"NotionPage",
|
|
16
|
+
"NotionWorkspace",
|
|
17
|
+
"NotionWorkspaceQueryConfigBuilder",
|
|
18
|
+
"WorkspaceQueryConfig",
|
|
19
|
+
]
|
notionary/blocks/enums.py
CHANGED
|
@@ -62,12 +62,6 @@ class BlockType(StrEnum):
|
|
|
62
62
|
VIDEO = "video"
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
class FileType(StrEnum):
|
|
66
|
-
EXTERNAL = "external"
|
|
67
|
-
FILE = "file"
|
|
68
|
-
FILE_UPLOAD = "file_upload"
|
|
69
|
-
|
|
70
|
-
|
|
71
65
|
class CodingLanguage(StrEnum):
|
|
72
66
|
ABAP = "abap"
|
|
73
67
|
ARDUINO = "arduino"
|
|
@@ -165,3 +159,30 @@ class CodingLanguage(StrEnum):
|
|
|
165
159
|
return member
|
|
166
160
|
|
|
167
161
|
return default if default is not None else cls.PLAIN_TEXT
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class VideoFileType(StrEnum):
|
|
165
|
+
AMV = ".amv"
|
|
166
|
+
ASF = ".asf"
|
|
167
|
+
AVI = ".avi"
|
|
168
|
+
F4V = ".f4v"
|
|
169
|
+
FLV = ".flv"
|
|
170
|
+
GIFV = ".gifv"
|
|
171
|
+
MKV = ".mkv"
|
|
172
|
+
MOV = ".mov"
|
|
173
|
+
MPG = ".mpg"
|
|
174
|
+
MPEG = ".mpeg"
|
|
175
|
+
MPV = ".mpv"
|
|
176
|
+
MP4 = ".mp4"
|
|
177
|
+
M4V = ".m4v"
|
|
178
|
+
QT = ".qt"
|
|
179
|
+
WMV = ".wmv"
|
|
180
|
+
|
|
181
|
+
@classmethod
|
|
182
|
+
def get_all_extensions(cls) -> set[str]:
|
|
183
|
+
return {ext.value for ext in cls}
|
|
184
|
+
|
|
185
|
+
@classmethod
|
|
186
|
+
def is_valid_extension(cls, filename: str) -> bool:
|
|
187
|
+
lower_filename = filename.lower()
|
|
188
|
+
return any(lower_filename.endswith(ext.value) for ext in cls)
|
notionary/blocks/schemas.py
CHANGED
|
@@ -4,41 +4,38 @@ from typing import Annotated, Literal
|
|
|
4
4
|
|
|
5
5
|
from pydantic import BaseModel, ConfigDict, Field
|
|
6
6
|
|
|
7
|
-
from notionary.blocks.enums import BlockColor, BlockType, CodingLanguage
|
|
7
|
+
from notionary.blocks.enums import BlockColor, BlockType, CodingLanguage
|
|
8
8
|
from notionary.blocks.rich_text.models import RichText
|
|
9
|
+
from notionary.shared.models.file import ExternalFile, FileUploadFile, NotionHostedFile
|
|
9
10
|
from notionary.shared.models.icon import Icon
|
|
10
11
|
from notionary.shared.models.parent import Parent
|
|
11
12
|
from notionary.user.schemas import PartialUserDto
|
|
12
13
|
|
|
13
14
|
# ============================================================================
|
|
14
|
-
# File
|
|
15
|
+
# File Data wrapper with caption
|
|
15
16
|
# ============================================================================
|
|
16
17
|
|
|
17
18
|
|
|
18
|
-
class
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
class CaptionMixin(BaseModel):
|
|
20
|
+
caption: list[RichText] = Field(default_factory=list)
|
|
21
|
+
name: str | None = None
|
|
21
22
|
|
|
22
23
|
|
|
23
|
-
class
|
|
24
|
-
|
|
25
|
-
url: str
|
|
26
|
-
expiry_time: str
|
|
24
|
+
class ExternalFileWithCaption(CaptionMixin, ExternalFile):
|
|
25
|
+
pass
|
|
27
26
|
|
|
28
27
|
|
|
29
|
-
class
|
|
30
|
-
|
|
31
|
-
id: str
|
|
28
|
+
class NotionHostedFileWithCaption(CaptionMixin, NotionHostedFile):
|
|
29
|
+
pass
|
|
32
30
|
|
|
33
31
|
|
|
34
|
-
class
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
name: str | None = None
|
|
32
|
+
class FileUploadFileWithCaption(CaptionMixin, FileUploadFile):
|
|
33
|
+
pass
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
type FileWithCaption = Annotated[
|
|
37
|
+
ExternalFileWithCaption | NotionHostedFileWithCaption | FileUploadFileWithCaption, Field(discriminator="type")
|
|
38
|
+
]
|
|
42
39
|
|
|
43
40
|
|
|
44
41
|
# ============================================================================
|
|
@@ -65,24 +62,14 @@ class BaseBlock(BaseModel):
|
|
|
65
62
|
# ============================================================================
|
|
66
63
|
|
|
67
64
|
|
|
68
|
-
class AudioData(BaseModel):
|
|
69
|
-
model_config = ConfigDict(from_attributes=True)
|
|
70
|
-
caption: list[RichText] = Field(default_factory=list)
|
|
71
|
-
type: FileType
|
|
72
|
-
external: ExternalFile | None = None
|
|
73
|
-
file: NotionHostedFile | None = None
|
|
74
|
-
file_upload: FileUploadFile | None = None
|
|
75
|
-
name: str | None = None
|
|
76
|
-
|
|
77
|
-
|
|
78
65
|
class AudioBlock(BaseBlock):
|
|
79
66
|
type: Literal[BlockType.AUDIO] = BlockType.AUDIO
|
|
80
|
-
audio:
|
|
67
|
+
audio: FileWithCaption
|
|
81
68
|
|
|
82
69
|
|
|
83
70
|
class CreateAudioBlock(BaseModel):
|
|
84
71
|
type: Literal[BlockType.AUDIO] = BlockType.AUDIO
|
|
85
|
-
audio:
|
|
72
|
+
audio: FileWithCaption
|
|
86
73
|
|
|
87
74
|
|
|
88
75
|
# ============================================================================
|
|
@@ -90,8 +77,7 @@ class CreateAudioBlock(BaseModel):
|
|
|
90
77
|
# ============================================================================
|
|
91
78
|
|
|
92
79
|
|
|
93
|
-
class BookmarkData(
|
|
94
|
-
caption: list[RichText] = Field(default_factory=list)
|
|
80
|
+
class BookmarkData(CaptionMixin):
|
|
95
81
|
url: str
|
|
96
82
|
|
|
97
83
|
|
|
@@ -224,8 +210,7 @@ class CreateChildDatabaseBlock(BaseModel):
|
|
|
224
210
|
# ============================================================================
|
|
225
211
|
|
|
226
212
|
|
|
227
|
-
class CodeData(
|
|
228
|
-
caption: list[RichText] = Field(default_factory=list)
|
|
213
|
+
class CodeData(CaptionMixin):
|
|
229
214
|
rich_text: list[RichText]
|
|
230
215
|
language: CodingLanguage = CodingLanguage.PLAIN_TEXT
|
|
231
216
|
|
|
@@ -311,9 +296,8 @@ class CreateDividerBlock(BaseModel):
|
|
|
311
296
|
# ============================================================================
|
|
312
297
|
|
|
313
298
|
|
|
314
|
-
class EmbedData(
|
|
299
|
+
class EmbedData(CaptionMixin):
|
|
315
300
|
url: str
|
|
316
|
-
caption: list[RichText] = Field(default_factory=list)
|
|
317
301
|
|
|
318
302
|
|
|
319
303
|
class EmbedBlock(BaseBlock):
|
|
@@ -352,12 +336,12 @@ class CreateEquationBlock(BaseModel):
|
|
|
352
336
|
|
|
353
337
|
class FileBlock(BaseBlock):
|
|
354
338
|
type: Literal[BlockType.FILE] = BlockType.FILE
|
|
355
|
-
file:
|
|
339
|
+
file: FileWithCaption
|
|
356
340
|
|
|
357
341
|
|
|
358
342
|
class CreateFileBlock(BaseModel):
|
|
359
343
|
type: Literal[BlockType.FILE] = BlockType.FILE
|
|
360
|
-
file:
|
|
344
|
+
file: FileWithCaption
|
|
361
345
|
|
|
362
346
|
|
|
363
347
|
# ============================================================================
|
|
@@ -416,24 +400,14 @@ CreateHeadingBlock = CreateHeading1Block | CreateHeading2Block | CreateHeading3B
|
|
|
416
400
|
# ============================================================================
|
|
417
401
|
|
|
418
402
|
|
|
419
|
-
class ImageData(BaseModel):
|
|
420
|
-
model_config = ConfigDict(from_attributes=True)
|
|
421
|
-
caption: list[RichText] = Field(default_factory=list)
|
|
422
|
-
type: FileType
|
|
423
|
-
external: ExternalFile | None = None
|
|
424
|
-
file: NotionHostedFile | None = None
|
|
425
|
-
file_upload: FileUploadFile | None = None
|
|
426
|
-
name: str | None = None
|
|
427
|
-
|
|
428
|
-
|
|
429
403
|
class ImageBlock(BaseBlock):
|
|
430
404
|
type: Literal[BlockType.IMAGE] = BlockType.IMAGE
|
|
431
|
-
image:
|
|
405
|
+
image: FileWithCaption
|
|
432
406
|
|
|
433
407
|
|
|
434
408
|
class CreateImageBlock(BaseModel):
|
|
435
409
|
type: Literal[BlockType.IMAGE] = BlockType.IMAGE
|
|
436
|
-
image:
|
|
410
|
+
image: FileWithCaption
|
|
437
411
|
|
|
438
412
|
|
|
439
413
|
# ============================================================================
|
|
@@ -497,24 +471,14 @@ class CreateParagraphBlock(BaseModel):
|
|
|
497
471
|
# ============================================================================
|
|
498
472
|
|
|
499
473
|
|
|
500
|
-
class PdfData(BaseModel):
|
|
501
|
-
model_config = ConfigDict(from_attributes=True)
|
|
502
|
-
caption: list[RichText] = Field(default_factory=list)
|
|
503
|
-
type: FileType
|
|
504
|
-
external: ExternalFile | None = None
|
|
505
|
-
file: NotionHostedFile | None = None
|
|
506
|
-
file_upload: FileUploadFile | None = None
|
|
507
|
-
name: str | None = None
|
|
508
|
-
|
|
509
|
-
|
|
510
474
|
class PdfBlock(BaseBlock):
|
|
511
475
|
type: Literal[BlockType.PDF] = BlockType.PDF
|
|
512
|
-
pdf:
|
|
476
|
+
pdf: FileWithCaption
|
|
513
477
|
|
|
514
478
|
|
|
515
479
|
class CreatePdfBlock(BaseModel):
|
|
516
480
|
type: Literal[BlockType.PDF] = BlockType.PDF
|
|
517
|
-
pdf:
|
|
481
|
+
pdf: FileWithCaption
|
|
518
482
|
|
|
519
483
|
|
|
520
484
|
# ============================================================================
|
|
@@ -669,31 +633,21 @@ class CreateToggleBlock(BaseModel):
|
|
|
669
633
|
# ============================================================================
|
|
670
634
|
|
|
671
635
|
|
|
672
|
-
class VideoData(BaseModel):
|
|
673
|
-
model_config = ConfigDict(from_attributes=True)
|
|
674
|
-
caption: list[RichText] = Field(default_factory=list)
|
|
675
|
-
type: FileType
|
|
676
|
-
external: ExternalFile | None = None
|
|
677
|
-
file: NotionHostedFile | None = None
|
|
678
|
-
file_upload: FileUploadFile | None = None
|
|
679
|
-
name: str | None = None
|
|
680
|
-
|
|
681
|
-
|
|
682
636
|
class VideoBlock(BaseBlock):
|
|
683
637
|
type: Literal[BlockType.VIDEO] = BlockType.VIDEO
|
|
684
|
-
video:
|
|
638
|
+
video: FileWithCaption
|
|
685
639
|
|
|
686
640
|
|
|
687
641
|
class CreateVideoBlock(BaseModel):
|
|
688
642
|
type: Literal[BlockType.VIDEO] = BlockType.VIDEO
|
|
689
|
-
video:
|
|
643
|
+
video: FileWithCaption
|
|
690
644
|
|
|
691
645
|
|
|
692
646
|
# ============================================================================
|
|
693
647
|
# Block Union Type
|
|
694
648
|
# ============================================================================
|
|
695
649
|
|
|
696
|
-
Block = Annotated[
|
|
650
|
+
type Block = Annotated[
|
|
697
651
|
(
|
|
698
652
|
AudioBlock
|
|
699
653
|
| BookmarkBlock
|
|
@@ -743,7 +697,7 @@ class BlockChildrenResponse(BaseModel):
|
|
|
743
697
|
request_id: str
|
|
744
698
|
|
|
745
699
|
|
|
746
|
-
BlockCreatePayload = Annotated[
|
|
700
|
+
type BlockCreatePayload = Annotated[
|
|
747
701
|
(
|
|
748
702
|
CreateAudioBlock
|
|
749
703
|
| CreateBookmarkBlock
|
notionary/comments/client.py
CHANGED
|
@@ -18,20 +18,17 @@ class CommentClient(NotionHttpClient):
|
|
|
18
18
|
async def iter_comments(
|
|
19
19
|
self,
|
|
20
20
|
block_id: str,
|
|
21
|
-
|
|
22
|
-
page_size: int = 100,
|
|
21
|
+
total_results_limit: int | None = None,
|
|
23
22
|
) -> AsyncGenerator[CommentDto]:
|
|
24
|
-
"""
|
|
25
|
-
Iterates through all comments for a block, yielding each comment individually.
|
|
26
|
-
Uses pagination to handle large result sets efficiently without loading everything into memory.
|
|
27
|
-
"""
|
|
28
23
|
async for comment in paginate_notion_api_generator(
|
|
29
|
-
self._list_comments_page, block_id=block_id,
|
|
24
|
+
self._list_comments_page, block_id=block_id, total_results_limit=total_results_limit
|
|
30
25
|
):
|
|
31
26
|
yield comment
|
|
32
27
|
|
|
33
|
-
async def get_all_comments(self, block_id: str, *,
|
|
34
|
-
all_comments = await paginate_notion_api(
|
|
28
|
+
async def get_all_comments(self, block_id: str, *, total_results_limit: int | None = None) -> list[CommentDto]:
|
|
29
|
+
all_comments = await paginate_notion_api(
|
|
30
|
+
self._list_comments_page, block_id=block_id, total_results_limit=total_results_limit
|
|
31
|
+
)
|
|
35
32
|
|
|
36
33
|
self.logger.debug("Retrieved %d total comments for block %s", len(all_comments), block_id)
|
|
37
34
|
return all_comments
|
notionary/comments/schemas.py
CHANGED
|
@@ -8,10 +8,6 @@ from pydantic import BaseModel, Field
|
|
|
8
8
|
|
|
9
9
|
from notionary.blocks.rich_text.models import RichText
|
|
10
10
|
|
|
11
|
-
# ---------------------------
|
|
12
|
-
# Comment Parent
|
|
13
|
-
# ---------------------------
|
|
14
|
-
|
|
15
11
|
|
|
16
12
|
class CommentParentType(StrEnum):
|
|
17
13
|
PAGE_ID = "page_id"
|
|
@@ -28,7 +24,7 @@ class BlockCommentParent(BaseModel):
|
|
|
28
24
|
block_id: str
|
|
29
25
|
|
|
30
26
|
|
|
31
|
-
CommentParent = PageCommentParent | BlockCommentParent
|
|
27
|
+
type CommentParent = PageCommentParent | BlockCommentParent
|
|
32
28
|
|
|
33
29
|
|
|
34
30
|
# ---------------------------
|
|
@@ -96,7 +92,7 @@ class CustomCommentDisplayName(BaseModel):
|
|
|
96
92
|
custom: CustomDisplayName
|
|
97
93
|
|
|
98
94
|
|
|
99
|
-
CommentDisplayNameInput = IntegrationDisplayName | UserDisplayName | CustomCommentDisplayName
|
|
95
|
+
type CommentDisplayNameInput = IntegrationDisplayName | UserDisplayName | CustomCommentDisplayName
|
|
100
96
|
|
|
101
97
|
|
|
102
98
|
class CommentDisplayNameDto(BaseModel):
|
|
@@ -189,8 +185,6 @@ class UserRef(BaseModel):
|
|
|
189
185
|
|
|
190
186
|
|
|
191
187
|
class CommentDto(BaseModel):
|
|
192
|
-
"""Comment object as returned by the API"""
|
|
193
|
-
|
|
194
188
|
object: Literal["comment"] = "comment"
|
|
195
189
|
id: str
|
|
196
190
|
|
|
@@ -217,24 +211,3 @@ class CommentListResponse(BaseModel):
|
|
|
217
211
|
results: list[CommentDto] = Field(default_factory=list)
|
|
218
212
|
next_cursor: str | None = None
|
|
219
213
|
has_more: bool = False
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
# ---------------------------
|
|
223
|
-
# Convenience Builders
|
|
224
|
-
# ---------------------------
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
class CommentDisplayNameBuilder:
|
|
228
|
-
"""Helper class to build display names easily"""
|
|
229
|
-
|
|
230
|
-
@staticmethod
|
|
231
|
-
def integration() -> IntegrationDisplayName:
|
|
232
|
-
return IntegrationDisplayName()
|
|
233
|
-
|
|
234
|
-
@staticmethod
|
|
235
|
-
def user() -> UserDisplayName:
|
|
236
|
-
return UserDisplayName()
|
|
237
|
-
|
|
238
|
-
@staticmethod
|
|
239
|
-
def custom(name: str) -> CustomCommentDisplayName:
|
|
240
|
-
return CustomCommentDisplayName(custom=CustomDisplayName(name=name))
|
|
@@ -58,10 +58,10 @@ class DataSourceInstanceClient(NotionHttpClient, EntityMetadataUpdateClient):
|
|
|
58
58
|
|
|
59
59
|
async def query(self, query_params: DataSourceQueryParams | None = None) -> QueryDataSourceResponse:
|
|
60
60
|
query_params_dict = query_params.to_api_params() if query_params else {}
|
|
61
|
-
|
|
61
|
+
total_result_limit = query_params.total_results_limit if query_params else None
|
|
62
62
|
|
|
63
63
|
all_results = await paginate_notion_api(
|
|
64
|
-
self._make_query_request, query_data=query_params_dict or {},
|
|
64
|
+
self._make_query_request, query_data=query_params_dict or {}, total_result_limit=total_result_limit
|
|
65
65
|
)
|
|
66
66
|
|
|
67
67
|
return QueryDataSourceResponse(
|
|
@@ -72,10 +72,10 @@ class DataSourceInstanceClient(NotionHttpClient, EntityMetadataUpdateClient):
|
|
|
72
72
|
|
|
73
73
|
async def query_stream(self, query_params: DataSourceQueryParams | None = None) -> AsyncIterator[Any]:
|
|
74
74
|
query_params_dict = query_params.model_dump() if query_params else {}
|
|
75
|
-
|
|
75
|
+
total_result_limit = query_params.total_results_limit if query_params else None
|
|
76
76
|
|
|
77
77
|
async for result in paginate_notion_api_generator(
|
|
78
|
-
self._make_query_request, query_data=query_params_dict or {},
|
|
78
|
+
self._make_query_request, query_data=query_params_dict or {}, total_results_limit=total_result_limit
|
|
79
79
|
):
|
|
80
80
|
yield result
|
|
81
81
|
|