@visus-io/notion-sdk-ts 3.0.2 → 3.1.1

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 (130) hide show
  1. package/README.md +20 -87
  2. package/dist/api/asyncTasks.api.d.ts +72 -0
  3. package/dist/api/asyncTasks.api.js +70 -0
  4. package/dist/api/base.api.d.ts +15 -4
  5. package/dist/api/base.api.js +20 -8
  6. package/dist/api/blocks.api.d.ts +435 -73
  7. package/dist/api/blocks.api.js +43 -1
  8. package/dist/api/comments.api.d.ts +42 -5
  9. package/dist/api/comments.api.js +45 -1
  10. package/dist/api/customEmojis.api.d.ts +38 -0
  11. package/dist/api/customEmojis.api.js +38 -0
  12. package/dist/api/dataSources.api.d.ts +67 -14
  13. package/dist/api/dataSources.api.js +26 -1
  14. package/dist/api/databases.api.d.ts +47 -11
  15. package/dist/api/databases.api.js +4 -1
  16. package/dist/api/fileUploads.api.d.ts +8 -5
  17. package/dist/api/fileUploads.api.js +11 -7
  18. package/dist/api/index.d.ts +3 -0
  19. package/dist/api/index.js +7 -1
  20. package/dist/api/pages.api.d.ts +144 -10
  21. package/dist/api/pages.api.js +66 -0
  22. package/dist/api/search.api.d.ts +12 -2
  23. package/dist/api/search.api.js +5 -2
  24. package/dist/api/users.api.d.ts +3 -0
  25. package/dist/api/users.api.js +2 -0
  26. package/dist/api/views.api.d.ts +286 -0
  27. package/dist/api/views.api.js +172 -0
  28. package/dist/client.d.ts +17 -17
  29. package/dist/client.js +25 -30
  30. package/dist/errors.d.ts +19 -5
  31. package/dist/errors.js +16 -4
  32. package/dist/helpers/block.helpers.d.ts +49 -5
  33. package/dist/helpers/block.helpers.js +50 -6
  34. package/dist/helpers/file.helpers.d.ts +46 -5
  35. package/dist/helpers/file.helpers.js +36 -8
  36. package/dist/helpers/filter.helpers.d.ts +8 -6
  37. package/dist/helpers/filter.helpers.js +2 -0
  38. package/dist/helpers/index.d.ts +3 -2
  39. package/dist/helpers/index.js +5 -1
  40. package/dist/helpers/pagination.helpers.d.ts +85 -13
  41. package/dist/helpers/pagination.helpers.js +114 -8
  42. package/dist/helpers/parent.helpers.d.ts +5 -3
  43. package/dist/helpers/parent.helpers.js +5 -3
  44. package/dist/helpers/property.helpers.d.ts +31 -0
  45. package/dist/helpers/property.helpers.js +30 -1
  46. package/dist/helpers/richText.helpers.d.ts +10 -5
  47. package/dist/helpers/richText.helpers.js +11 -6
  48. package/dist/helpers/sort.helpers.d.ts +2 -0
  49. package/dist/helpers/sort.helpers.js +2 -0
  50. package/dist/helpers/webhook.helpers.d.ts +54 -0
  51. package/dist/helpers/webhook.helpers.js +83 -0
  52. package/dist/models/asyncTask.model.d.ts +61 -0
  53. package/dist/models/asyncTask.model.js +91 -0
  54. package/dist/models/base.model.d.ts +16 -4
  55. package/dist/models/base.model.js +17 -5
  56. package/dist/models/block.model.d.ts +6 -2
  57. package/dist/models/block.model.js +48 -33
  58. package/dist/models/comment.model.d.ts +4 -2
  59. package/dist/models/comment.model.js +4 -2
  60. package/dist/models/customEmoji.model.d.ts +30 -0
  61. package/dist/models/customEmoji.model.js +44 -0
  62. package/dist/models/dataSource.model.d.ts +7 -5
  63. package/dist/models/dataSource.model.js +5 -3
  64. package/dist/models/database.model.d.ts +13 -5
  65. package/dist/models/database.model.js +15 -5
  66. package/dist/models/fileUpload.model.d.ts +6 -4
  67. package/dist/models/fileUpload.model.js +6 -4
  68. package/dist/models/index.d.ts +3 -0
  69. package/dist/models/index.js +7 -1
  70. package/dist/models/page.model.d.ts +8 -2
  71. package/dist/models/page.model.js +14 -4
  72. package/dist/models/richText.model.d.ts +3 -1
  73. package/dist/models/richText.model.js +3 -1
  74. package/dist/models/user.model.d.ts +4 -2
  75. package/dist/models/user.model.js +4 -2
  76. package/dist/models/view.model.d.ts +81 -0
  77. package/dist/models/view.model.js +121 -0
  78. package/dist/notion.d.ts +32 -8
  79. package/dist/notion.js +25 -4
  80. package/dist/schemas/asyncTask.schema.d.ts +53 -0
  81. package/dist/schemas/asyncTask.schema.js +88 -0
  82. package/dist/schemas/block.schema.d.ts +390 -73
  83. package/dist/schemas/block.schema.js +39 -8
  84. package/dist/schemas/codeLanguages.d.ts +7 -1
  85. package/dist/schemas/codeLanguages.js +4 -1
  86. package/dist/schemas/colors.d.ts +7 -1
  87. package/dist/schemas/colors.js +4 -1
  88. package/dist/schemas/comment.schema.d.ts +28 -5
  89. package/dist/schemas/comment.schema.js +11 -2
  90. package/dist/schemas/customEmoji.schema.d.ts +18 -0
  91. package/dist/schemas/customEmoji.schema.js +50 -0
  92. package/dist/schemas/dataSource.schema.d.ts +84 -10
  93. package/dist/schemas/dataSource.schema.js +31 -6
  94. package/dist/schemas/database.schema.d.ts +51 -7
  95. package/dist/schemas/database.schema.js +10 -3
  96. package/dist/schemas/emoji.schema.d.ts +7 -2
  97. package/dist/schemas/emoji.schema.js +4 -2
  98. package/dist/schemas/file.schema.d.ts +18 -2
  99. package/dist/schemas/file.schema.js +6 -2
  100. package/dist/schemas/fileUpload.schema.d.ts +9 -3
  101. package/dist/schemas/fileUpload.schema.js +5 -2
  102. package/dist/schemas/icon.schema.d.ts +116 -0
  103. package/dist/schemas/icon.schema.js +100 -0
  104. package/dist/schemas/index.d.ts +6 -0
  105. package/dist/schemas/index.js +6 -0
  106. package/dist/schemas/meetingNotesQuery.schema.d.ts +4198 -0
  107. package/dist/schemas/meetingNotesQuery.schema.js +67 -0
  108. package/dist/schemas/page.schema.d.ts +51 -9
  109. package/dist/schemas/page.schema.js +6 -2
  110. package/dist/schemas/pageMarkdown.schema.d.ts +70 -0
  111. package/dist/schemas/pageMarkdown.schema.js +70 -0
  112. package/dist/schemas/pageProperties.schema.d.ts +105 -21
  113. package/dist/schemas/pageProperties.schema.js +8 -6
  114. package/dist/schemas/pagination.schema.d.ts +57 -7
  115. package/dist/schemas/pagination.schema.js +25 -1
  116. package/dist/schemas/parent.schema.d.ts +39 -3
  117. package/dist/schemas/parent.schema.js +17 -5
  118. package/dist/schemas/propertyObjects.schema.d.ts +93 -15
  119. package/dist/schemas/propertyObjects.schema.js +11 -5
  120. package/dist/schemas/richText.schema.d.ts +23 -6
  121. package/dist/schemas/richText.schema.js +7 -4
  122. package/dist/schemas/shared.schema.d.ts +6 -3
  123. package/dist/schemas/shared.schema.js +6 -3
  124. package/dist/schemas/user.schema.d.ts +17 -0
  125. package/dist/schemas/user.schema.js +7 -3
  126. package/dist/schemas/view.schema.d.ts +1111 -0
  127. package/dist/schemas/view.schema.js +134 -0
  128. package/dist/validation.d.ts +11 -4
  129. package/dist/validation.js +11 -4
  130. package/package.json +6 -3
@@ -1,5 +1,5 @@
1
1
  import type { NotionClient } from '../client';
2
- import type { NotionPage } from '../schemas';
2
+ import type { MarkdownContentResponse, NotionPage, PageMarkdown } from '../schemas';
3
3
  import { Page } from '../models';
4
4
  import { BaseAPI } from './base.api';
5
5
  /**
@@ -35,6 +35,11 @@ export interface CreatePageOptions {
35
35
  cover?: unknown;
36
36
  /** Page content blocks (max 100) */
37
37
  children?: unknown[];
38
+ /**
39
+ * Page content as a markdown string, as an alternative to `properties`/`children`.
40
+ * Mutually exclusive with `properties` and `children`.
41
+ */
42
+ markdown?: string;
38
43
  /** Template to apply when creating the page */
39
44
  template?: {
40
45
  type: 'none';
@@ -56,6 +61,62 @@ export interface CreatePageOptions {
56
61
  type: 'page_end';
57
62
  };
58
63
  }
64
+ /**
65
+ * Parent for moving a page.
66
+ */
67
+ export type MovePageParent = {
68
+ type: 'page_id';
69
+ page_id: string;
70
+ } | {
71
+ type: 'data_source_id';
72
+ data_source_id: string;
73
+ };
74
+ /**
75
+ * Options for retrieving a page's content as markdown.
76
+ */
77
+ export interface GetPageMarkdownOptions {
78
+ /** Include meeting-note transcript content in the markdown output */
79
+ include_transcript?: boolean;
80
+ }
81
+ /**
82
+ * A single find-and-replace edit against a page's markdown content.
83
+ */
84
+ export interface MarkdownContentUpdate {
85
+ /** The exact existing markdown substring to replace */
86
+ old_str: string;
87
+ /** The replacement markdown content */
88
+ new_str: string;
89
+ /** Replace all occurrences of `old_str` instead of just the first */
90
+ replace_all_matches?: boolean;
91
+ }
92
+ /**
93
+ * Options for updating a page's markdown content.
94
+ */
95
+ export type UpdatePageMarkdownOptions = {
96
+ type: 'update_content';
97
+ content_updates: MarkdownContentUpdate[];
98
+ allow_deleting_content?: boolean;
99
+ allow_async?: boolean;
100
+ } | {
101
+ type: 'replace_content';
102
+ new_str: string;
103
+ allow_deleting_content?: boolean;
104
+ allow_async?: boolean;
105
+ } | {
106
+ type: 'insert_content';
107
+ content: string;
108
+ position?: {
109
+ type: 'start' | 'end';
110
+ };
111
+ after?: string;
112
+ allow_async?: boolean;
113
+ } | {
114
+ type: 'replace_content_range';
115
+ content: string;
116
+ content_range: unknown;
117
+ allow_deleting_content?: boolean;
118
+ allow_async?: boolean;
119
+ };
59
120
  /**
60
121
  * Options for updating a page.
61
122
  */
@@ -82,6 +143,8 @@ export interface UpdatePageOptions {
82
143
  }
83
144
  /**
84
145
  * Pages API client for working with Notion pages.
146
+ *
147
+ * @category Pages
85
148
  */
86
149
  export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
87
150
  protected readonly client: NotionClient;
@@ -98,6 +161,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
98
161
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
99
162
  person: import("zod").ZodObject<{
100
163
  email: import("zod").ZodEmail;
164
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
101
165
  }, import("zod/v4/core").$strip>;
102
166
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
103
167
  object: import("zod").ZodLiteral<"user">;
@@ -131,6 +195,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
131
195
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
132
196
  person: import("zod").ZodObject<{
133
197
  email: import("zod").ZodEmail;
198
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
134
199
  }, import("zod/v4/core").$strip>;
135
200
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
136
201
  object: import("zod").ZodLiteral<"user">;
@@ -156,6 +221,8 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
156
221
  id: import("zod").ZodUUID;
157
222
  }, import("zod/v4/core").$strip>]>;
158
223
  in_trash: import("zod").ZodBoolean;
224
+ is_archived: import("zod").ZodOptional<import("zod").ZodBoolean>;
225
+ is_locked: import("zod").ZodOptional<import("zod").ZodBoolean>;
159
226
  icon: import("zod").ZodNullable<import("zod").ZodUnion<readonly [import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
160
227
  type: import("zod").ZodLiteral<"file">;
161
228
  file: import("zod").ZodObject<{
@@ -175,6 +242,30 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
175
242
  }, import("zod/v4/core").$strip>], "type">, import("zod").ZodObject<{
176
243
  type: import("zod").ZodLiteral<"emoji">;
177
244
  emoji: import("zod").ZodString;
245
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
246
+ type: import("zod").ZodLiteral<"icon">;
247
+ icon: import("zod").ZodObject<{
248
+ name: import("zod").ZodString;
249
+ color: import("zod").ZodOptional<import("zod").ZodEnum<{
250
+ blue: "blue";
251
+ brown: "brown";
252
+ gray: "gray";
253
+ green: "green";
254
+ orange: "orange";
255
+ pink: "pink";
256
+ purple: "purple";
257
+ red: "red";
258
+ yellow: "yellow";
259
+ lightgray: "lightgray";
260
+ }>>;
261
+ }, import("zod/v4/core").$strip>;
262
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
263
+ type: import("zod").ZodLiteral<"custom_emoji">;
264
+ custom_emoji: import("zod").ZodObject<{
265
+ id: import("zod").ZodUUID;
266
+ name: import("zod").ZodOptional<import("zod").ZodString>;
267
+ url: import("zod").ZodOptional<import("zod").ZodURL>;
268
+ }, import("zod/v4/core").$strip>;
178
269
  }, import("zod/v4/core").$strip>]>>;
179
270
  cover: import("zod").ZodNullable<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
180
271
  type: import("zod").ZodLiteral<"file">;
@@ -208,6 +299,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
208
299
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
209
300
  person: import("zod").ZodObject<{
210
301
  email: import("zod").ZodEmail;
302
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
211
303
  }, import("zod/v4/core").$strip>;
212
304
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
213
305
  object: import("zod").ZodLiteral<"user">;
@@ -300,6 +392,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
300
392
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
301
393
  person: import("zod").ZodObject<{
302
394
  email: import("zod").ZodEmail;
395
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
303
396
  }, import("zod/v4/core").$strip>;
304
397
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
305
398
  object: import("zod").ZodLiteral<"user">;
@@ -335,11 +428,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
335
428
  id: import("zod").ZodString;
336
429
  name: import("zod").ZodString;
337
430
  color: import("zod").ZodEnum<{
431
+ default: "default";
338
432
  blue: "blue";
339
433
  blue_background: "blue_background";
340
434
  brown: "brown";
341
435
  brown_background: "brown_background";
342
- default: "default";
343
436
  gray: "gray";
344
437
  gray_background: "gray_background";
345
438
  green: "green";
@@ -371,6 +464,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
371
464
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
372
465
  person: import("zod").ZodObject<{
373
466
  email: import("zod").ZodEmail;
467
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
374
468
  }, import("zod/v4/core").$strip>;
375
469
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
376
470
  object: import("zod").ZodLiteral<"user">;
@@ -424,11 +518,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
424
518
  underline: import("zod").ZodBoolean;
425
519
  code: import("zod").ZodBoolean;
426
520
  color: import("zod").ZodEnum<{
521
+ default: "default";
427
522
  blue: "blue";
428
523
  blue_background: "blue_background";
429
524
  brown: "brown";
430
525
  brown_background: "brown_background";
431
- default: "default";
432
526
  gray: "gray";
433
527
  gray_background: "gray_background";
434
528
  green: "green";
@@ -493,6 +587,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
493
587
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
494
588
  person: import("zod").ZodObject<{
495
589
  email: import("zod").ZodEmail;
590
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
496
591
  }, import("zod/v4/core").$strip>;
497
592
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
498
593
  object: import("zod").ZodLiteral<"user">;
@@ -525,11 +620,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
525
620
  underline: import("zod").ZodBoolean;
526
621
  code: import("zod").ZodBoolean;
527
622
  color: import("zod").ZodEnum<{
623
+ default: "default";
528
624
  blue: "blue";
529
625
  blue_background: "blue_background";
530
626
  brown: "brown";
531
627
  brown_background: "brown_background";
532
- default: "default";
533
628
  gray: "gray";
534
629
  gray_background: "gray_background";
535
630
  green: "green";
@@ -560,11 +655,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
560
655
  underline: import("zod").ZodBoolean;
561
656
  code: import("zod").ZodBoolean;
562
657
  color: import("zod").ZodEnum<{
658
+ default: "default";
563
659
  blue: "blue";
564
660
  blue_background: "blue_background";
565
661
  brown: "brown";
566
662
  brown_background: "brown_background";
567
- default: "default";
568
663
  gray: "gray";
569
664
  gray_background: "gray_background";
570
665
  green: "green";
@@ -636,11 +731,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
636
731
  id: import("zod").ZodString;
637
732
  name: import("zod").ZodString;
638
733
  color: import("zod").ZodEnum<{
734
+ default: "default";
639
735
  blue: "blue";
640
736
  blue_background: "blue_background";
641
737
  brown: "brown";
642
738
  brown_background: "brown_background";
643
- default: "default";
644
739
  gray: "gray";
645
740
  gray_background: "gray_background";
646
741
  green: "green";
@@ -664,11 +759,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
664
759
  id: import("zod").ZodString;
665
760
  name: import("zod").ZodString;
666
761
  color: import("zod").ZodEnum<{
762
+ default: "default";
667
763
  blue: "blue";
668
764
  blue_background: "blue_background";
669
765
  brown: "brown";
670
766
  brown_background: "brown_background";
671
- default: "default";
672
767
  gray: "gray";
673
768
  gray_background: "gray_background";
674
769
  green: "green";
@@ -703,11 +798,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
703
798
  underline: import("zod").ZodBoolean;
704
799
  code: import("zod").ZodBoolean;
705
800
  color: import("zod").ZodEnum<{
801
+ default: "default";
706
802
  blue: "blue";
707
803
  blue_background: "blue_background";
708
804
  brown: "brown";
709
805
  brown_background: "brown_background";
710
- default: "default";
711
806
  gray: "gray";
712
807
  gray_background: "gray_background";
713
808
  green: "green";
@@ -772,6 +867,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
772
867
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
773
868
  person: import("zod").ZodObject<{
774
869
  email: import("zod").ZodEmail;
870
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
775
871
  }, import("zod/v4/core").$strip>;
776
872
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
777
873
  object: import("zod").ZodLiteral<"user">;
@@ -804,11 +900,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
804
900
  underline: import("zod").ZodBoolean;
805
901
  code: import("zod").ZodBoolean;
806
902
  color: import("zod").ZodEnum<{
903
+ default: "default";
807
904
  blue: "blue";
808
905
  blue_background: "blue_background";
809
906
  brown: "brown";
810
907
  brown_background: "brown_background";
811
- default: "default";
812
908
  gray: "gray";
813
909
  gray_background: "gray_background";
814
910
  green: "green";
@@ -839,11 +935,11 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
839
935
  underline: import("zod").ZodBoolean;
840
936
  code: import("zod").ZodBoolean;
841
937
  color: import("zod").ZodEnum<{
938
+ default: "default";
842
939
  blue: "blue";
843
940
  blue_background: "blue_background";
844
941
  brown: "brown";
845
942
  brown_background: "brown_background";
846
- default: "default";
847
943
  gray: "gray";
848
944
  gray_background: "gray_background";
849
945
  green: "green";
@@ -890,6 +986,7 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
890
986
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
891
987
  person: import("zod").ZodObject<{
892
988
  email: import("zod").ZodEmail;
989
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
893
990
  }, import("zod/v4/core").$strip>;
894
991
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
895
992
  object: import("zod").ZodLiteral<"user">;
@@ -937,6 +1034,9 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
937
1034
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
938
1035
  type: import("zod").ZodLiteral<"block_id">;
939
1036
  block_id: import("zod").ZodUUID;
1037
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1038
+ type: import("zod").ZodLiteral<"agent_id">;
1039
+ agent_id: import("zod").ZodUUID;
940
1040
  }, import("zod/v4/core").$strip>], "type">;
941
1041
  url: import("zod").ZodURL;
942
1042
  public_url: import("zod").ZodNullable<import("zod").ZodURL>;
@@ -964,6 +1064,30 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
964
1064
  * @see https://developers.notion.com/reference/post-page
965
1065
  */
966
1066
  create(options: CreatePageOptions): Promise<Page>;
1067
+ /**
1068
+ * Retrieve a page's content as markdown.
1069
+ *
1070
+ * @param pageId - The ID of the page to retrieve
1071
+ * @param options - Options for retrieving the markdown content
1072
+ * @returns The page's markdown content
1073
+ *
1074
+ * @see https://developers.notion.com/guides/data-apis/working-with-markdown-content
1075
+ */
1076
+ getMarkdown(pageId: string, options?: GetPageMarkdownOptions): Promise<PageMarkdown>;
1077
+ /**
1078
+ * Update a page's content as markdown.
1079
+ *
1080
+ * Set `allow_async: true` to allow asynchronous processing for large writes.
1081
+ * In that case, the API returns an `async_task` handle instead of the completed
1082
+ * content. Poll the task with `notion.asyncTasks.poll(task.id)`.
1083
+ *
1084
+ * @param pageId - The ID of the page to update
1085
+ * @param options - The markdown update to apply
1086
+ * @returns The updated markdown content, or an async task handle if processed asynchronously
1087
+ *
1088
+ * @see https://developers.notion.com/guides/data-apis/working-with-markdown-content
1089
+ */
1090
+ updateMarkdown(pageId: string, options: UpdatePageMarkdownOptions): Promise<MarkdownContentResponse>;
967
1091
  /**
968
1092
  * Update a page's properties, icon, cover, or trash status.
969
1093
  *
@@ -974,6 +1098,16 @@ export declare class PagesAPI extends BaseAPI<NotionPage, Page> {
974
1098
  * @see https://developers.notion.com/reference/patch-page
975
1099
  */
976
1100
  update(pageId: string, options: UpdatePageOptions): Promise<Page>;
1101
+ /**
1102
+ * Move a page to a new parent page or data source.
1103
+ *
1104
+ * @param pageId - The ID of the page to move
1105
+ * @param parent - The new parent (a page or a data source)
1106
+ * @returns The moved page wrapped in a Page model
1107
+ *
1108
+ * @see https://developers.notion.com/reference/move-page
1109
+ */
1110
+ move(pageId: string, parent: MovePageParent): Promise<Page>;
977
1111
  /**
978
1112
  * Move a page to trash (convenience method).
979
1113
  *
@@ -5,8 +5,20 @@ const schemas_1 = require("../schemas");
5
5
  const models_1 = require("../models");
6
6
  const validation_1 = require("../validation");
7
7
  const base_api_1 = require("./base.api");
8
+ /**
9
+ * Assert that `markdown` isn't combined with `properties`/`children` when creating a page.
10
+ *
11
+ * @throws {NotionValidationError}
12
+ */
13
+ function validateMarkdownExclusivity(options) {
14
+ if (options.markdown !== undefined && (options.properties || options.children)) {
15
+ throw new validation_1.NotionValidationError('markdown cannot be combined with properties or children');
16
+ }
17
+ }
8
18
  /**
9
19
  * Pages API client for working with Notion pages.
20
+ *
21
+ * @category Pages
10
22
  */
11
23
  class PagesAPI extends base_api_1.BaseAPI {
12
24
  constructor(client) {
@@ -42,11 +54,53 @@ class PagesAPI extends base_api_1.BaseAPI {
42
54
  * @see https://developers.notion.com/reference/post-page
43
55
  */
44
56
  async create(options) {
57
+ validateMarkdownExclusivity(options);
45
58
  if (options.children) {
46
59
  (0, validation_1.validateArrayLength)(options.children, validation_1.LIMITS.ARRAY_ELEMENTS, 'children');
47
60
  }
48
61
  return this.createResource('/pages', options);
49
62
  }
63
+ /**
64
+ * Retrieve a page's content as markdown.
65
+ *
66
+ * @param pageId - The ID of the page to retrieve
67
+ * @param options - Options for retrieving the markdown content
68
+ * @returns The page's markdown content
69
+ *
70
+ * @see https://developers.notion.com/guides/data-apis/working-with-markdown-content
71
+ */
72
+ async getMarkdown(pageId, options) {
73
+ const query = options?.include_transcript !== undefined
74
+ ? { include_transcript: String(options.include_transcript) }
75
+ : undefined;
76
+ const response = await this.client.request({
77
+ method: 'GET',
78
+ path: `/pages/${pageId}/markdown`,
79
+ query,
80
+ });
81
+ return schemas_1.pageMarkdownSchema.parse(response);
82
+ }
83
+ /**
84
+ * Update a page's content as markdown.
85
+ *
86
+ * Set `allow_async: true` to allow asynchronous processing for large writes.
87
+ * In that case, the API returns an `async_task` handle instead of the completed
88
+ * content. Poll the task with `notion.asyncTasks.poll(task.id)`.
89
+ *
90
+ * @param pageId - The ID of the page to update
91
+ * @param options - The markdown update to apply
92
+ * @returns The updated markdown content, or an async task handle if processed asynchronously
93
+ *
94
+ * @see https://developers.notion.com/guides/data-apis/working-with-markdown-content
95
+ */
96
+ async updateMarkdown(pageId, options) {
97
+ const response = await this.client.request({
98
+ method: 'PATCH',
99
+ path: `/pages/${pageId}/markdown`,
100
+ body: options,
101
+ });
102
+ return schemas_1.markdownContentResponseSchema.parse(response);
103
+ }
50
104
  /**
51
105
  * Update a page's properties, icon, cover, or trash status.
52
106
  *
@@ -59,6 +113,18 @@ class PagesAPI extends base_api_1.BaseAPI {
59
113
  async update(pageId, options) {
60
114
  return this.updateResource(`/pages/${pageId}`, options);
61
115
  }
116
+ /**
117
+ * Move a page to a new parent page or data source.
118
+ *
119
+ * @param pageId - The ID of the page to move
120
+ * @param parent - The new parent (a page or a data source)
121
+ * @returns The moved page wrapped in a Page model
122
+ *
123
+ * @see https://developers.notion.com/reference/move-page
124
+ */
125
+ async move(pageId, parent) {
126
+ return this.createResource(`/pages/${pageId}/move`, { parent });
127
+ }
62
128
  /**
63
129
  * Move a page to trash (convenience method).
64
130
  *
@@ -8,13 +8,21 @@ import { DataSource, Page } from '../models';
8
8
  export type SearchFilterObject = 'page' | 'data_source';
9
9
  /**
10
10
  * Search filter configuration.
11
+ *
12
+ * Combine `in_trash` with the object filter (`property`/`value`), or use it alone
13
+ * to list only trashed content.
11
14
  */
12
- export interface SearchFilter {
15
+ export type SearchFilter = {
13
16
  /** Filter by object type */
14
17
  value: SearchFilterObject;
15
18
  /** Property to filter on (always "object" for this filter type) */
16
19
  property: 'object';
17
- }
20
+ /** Whether to list only trashed pages and data sources */
21
+ in_trash?: boolean;
22
+ } | {
23
+ /** Whether to list only trashed pages and data sources */
24
+ in_trash: boolean;
25
+ };
18
26
  /**
19
27
  * Search sort configuration.
20
28
  */
@@ -42,6 +50,8 @@ export interface SearchOptions extends PaginationParameters {
42
50
  export type SearchResult = Page | DataSource;
43
51
  /**
44
52
  * Search API client for searching across the workspace.
53
+ *
54
+ * @category Search
45
55
  */
46
56
  export declare class SearchAPI {
47
57
  private readonly client;
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SearchAPI = void 0;
4
4
  const schemas_1 = require("../schemas");
5
5
  const models_1 = require("../models");
6
+ const base_model_1 = require("../models/base.model");
6
7
  /**
7
8
  * Search API client for searching across the workspace.
9
+ *
10
+ * @category Search
8
11
  */
9
12
  class SearchAPI {
10
13
  constructor(client) {
@@ -41,11 +44,11 @@ class SearchAPI {
41
44
  const results = response.results.map((item) => {
42
45
  if (item.object === 'page') {
43
46
  const parsed = schemas_1.pageSchema.parse(item);
44
- return new models_1.Page(parsed);
47
+ return new models_1.Page(parsed, base_model_1.TRUSTED);
45
48
  }
46
49
  else {
47
50
  const parsed = schemas_1.dataSourceSchema.parse(item);
48
- return new models_1.DataSource(parsed);
51
+ return new models_1.DataSource(parsed, base_model_1.TRUSTED);
49
52
  }
50
53
  });
51
54
  return {
@@ -4,6 +4,8 @@ import { User } from '../models';
4
4
  import { BaseAPI } from './base.api';
5
5
  /**
6
6
  * Users API client for working with Notion users.
7
+ *
8
+ * @category Users
7
9
  */
8
10
  export declare class UsersAPI extends BaseAPI<NotionUser, User> {
9
11
  protected readonly client: NotionClient;
@@ -16,6 +18,7 @@ export declare class UsersAPI extends BaseAPI<NotionUser, User> {
16
18
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
17
19
  person: import("zod").ZodObject<{
18
20
  email: import("zod").ZodEmail;
21
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
19
22
  }, import("zod/v4/core").$strip>;
20
23
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
21
24
  object: import("zod").ZodLiteral<"user">;
@@ -6,6 +6,8 @@ const models_1 = require("../models");
6
6
  const base_api_1 = require("./base.api");
7
7
  /**
8
8
  * Users API client for working with Notion users.
9
+ *
10
+ * @category Users
9
11
  */
10
12
  class UsersAPI extends base_api_1.BaseAPI {
11
13
  constructor(client) {