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

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 (91) hide show
  1. package/README.md +7 -6
  2. package/dist/api/asyncTasks.api.d.ts +70 -0
  3. package/dist/api/asyncTasks.api.js +68 -0
  4. package/dist/api/base.api.js +1 -0
  5. package/dist/api/blocks.api.d.ts +433 -73
  6. package/dist/api/blocks.api.js +39 -0
  7. package/dist/api/comments.api.d.ts +40 -5
  8. package/dist/api/comments.api.js +43 -1
  9. package/dist/api/customEmojis.api.d.ts +36 -0
  10. package/dist/api/customEmojis.api.js +36 -0
  11. package/dist/api/dataSources.api.d.ts +62 -11
  12. package/dist/api/dataSources.api.js +22 -0
  13. package/dist/api/databases.api.d.ts +40 -6
  14. package/dist/api/fileUploads.api.d.ts +1 -1
  15. package/dist/api/index.d.ts +3 -0
  16. package/dist/api/index.js +7 -1
  17. package/dist/api/pages.api.d.ts +142 -10
  18. package/dist/api/pages.api.js +64 -0
  19. package/dist/api/search.api.d.ts +10 -2
  20. package/dist/api/users.api.d.ts +1 -0
  21. package/dist/api/views.api.d.ts +284 -0
  22. package/dist/api/views.api.js +169 -0
  23. package/dist/client.js +3 -3
  24. package/dist/errors.d.ts +5 -1
  25. package/dist/errors.js +6 -0
  26. package/dist/helpers/block.helpers.d.ts +38 -1
  27. package/dist/helpers/block.helpers.js +45 -3
  28. package/dist/helpers/file.helpers.d.ts +36 -1
  29. package/dist/helpers/file.helpers.js +26 -4
  30. package/dist/helpers/filter.helpers.d.ts +6 -6
  31. package/dist/helpers/index.d.ts +3 -2
  32. package/dist/helpers/index.js +5 -1
  33. package/dist/helpers/pagination.helpers.d.ts +56 -0
  34. package/dist/helpers/pagination.helpers.js +86 -0
  35. package/dist/helpers/property.helpers.d.ts +29 -0
  36. package/dist/helpers/property.helpers.js +27 -0
  37. package/dist/helpers/webhook.helpers.d.ts +52 -0
  38. package/dist/helpers/webhook.helpers.js +81 -0
  39. package/dist/models/asyncTask.model.d.ts +59 -0
  40. package/dist/models/asyncTask.model.js +89 -0
  41. package/dist/models/block.model.js +4 -1
  42. package/dist/models/customEmoji.model.d.ts +28 -0
  43. package/dist/models/customEmoji.model.js +42 -0
  44. package/dist/models/dataSource.model.d.ts +3 -3
  45. package/dist/models/dataSource.model.js +1 -1
  46. package/dist/models/database.model.d.ts +7 -3
  47. package/dist/models/database.model.js +7 -1
  48. package/dist/models/index.d.ts +3 -0
  49. package/dist/models/index.js +7 -1
  50. package/dist/models/page.model.d.ts +2 -0
  51. package/dist/models/page.model.js +6 -0
  52. package/dist/models/view.model.d.ts +79 -0
  53. package/dist/models/view.model.js +119 -0
  54. package/dist/notion.d.ts +26 -7
  55. package/dist/notion.js +19 -3
  56. package/dist/schemas/asyncTask.schema.d.ts +42 -0
  57. package/dist/schemas/asyncTask.schema.js +83 -0
  58. package/dist/schemas/block.schema.d.ts +378 -72
  59. package/dist/schemas/block.schema.js +33 -7
  60. package/dist/schemas/comment.schema.d.ts +8 -3
  61. package/dist/schemas/customEmoji.schema.d.ts +13 -0
  62. package/dist/schemas/customEmoji.schema.js +48 -0
  63. package/dist/schemas/dataSource.schema.d.ts +68 -10
  64. package/dist/schemas/dataSource.schema.js +22 -4
  65. package/dist/schemas/database.schema.d.ts +38 -6
  66. package/dist/schemas/database.schema.js +3 -2
  67. package/dist/schemas/fileUpload.schema.d.ts +1 -1
  68. package/dist/schemas/icon.schema.d.ts +92 -0
  69. package/dist/schemas/icon.schema.js +88 -0
  70. package/dist/schemas/index.d.ts +6 -0
  71. package/dist/schemas/index.js +6 -0
  72. package/dist/schemas/meetingNotesQuery.schema.d.ts +4187 -0
  73. package/dist/schemas/meetingNotesQuery.schema.js +62 -0
  74. package/dist/schemas/page.schema.d.ts +46 -9
  75. package/dist/schemas/page.schema.js +4 -2
  76. package/dist/schemas/pageMarkdown.schema.d.ts +59 -0
  77. package/dist/schemas/pageMarkdown.schema.js +65 -0
  78. package/dist/schemas/pageProperties.schema.d.ts +30 -18
  79. package/dist/schemas/pageProperties.schema.js +2 -3
  80. package/dist/schemas/pagination.schema.d.ts +30 -3
  81. package/dist/schemas/pagination.schema.js +18 -1
  82. package/dist/schemas/parent.schema.d.ts +10 -1
  83. package/dist/schemas/parent.schema.js +9 -3
  84. package/dist/schemas/propertyObjects.schema.d.ts +12 -12
  85. package/dist/schemas/richText.schema.d.ts +8 -6
  86. package/dist/schemas/richText.schema.js +1 -1
  87. package/dist/schemas/user.schema.d.ts +2 -0
  88. package/dist/schemas/user.schema.js +2 -1
  89. package/dist/schemas/view.schema.d.ts +1077 -0
  90. package/dist/schemas/view.schema.js +115 -0
  91. package/package.json +2 -2
@@ -59,6 +59,45 @@ class BlocksAPI extends base_api_1.BaseAPI {
59
59
  };
60
60
  },
61
61
  };
62
+ /**
63
+ * Meeting-notes query operations.
64
+ */
65
+ this.meetingNotes = {
66
+ /**
67
+ * Query meeting-notes blocks across the workspace.
68
+ *
69
+ * @param options - Filter, sort, and limit options
70
+ * @returns Matching meeting-notes blocks
71
+ *
72
+ * @see https://developers.notion.com/reference/query-meeting-notes
73
+ */
74
+ query: async (options) => {
75
+ if (options?.sort) {
76
+ (0, validation_1.validateArrayLength)(options.sort, validation_1.LIMITS.ARRAY_ELEMENTS, 'sort');
77
+ }
78
+ const body = {};
79
+ if (options?.filter) {
80
+ body.filter = options.filter;
81
+ }
82
+ if (options?.sort) {
83
+ body.sort = options.sort;
84
+ }
85
+ if (options?.limit) {
86
+ body.limit = options.limit;
87
+ }
88
+ const response = await this.client.request({
89
+ method: 'POST',
90
+ path: '/blocks/meeting_notes/query',
91
+ body: Object.keys(body).length > 0 ? body : undefined,
92
+ });
93
+ const parsed = schemas_1.meetingNotesQueryResponseSchema.parse(response);
94
+ return {
95
+ results: parsed.results.map((b) => new models_1.Block(b)),
96
+ hasMore: parsed.has_more,
97
+ requestStatus: parsed.request_status,
98
+ };
99
+ },
100
+ };
62
101
  }
63
102
  /**
64
103
  * Retrieve a block by ID.
@@ -36,13 +36,24 @@ export interface CreateCommentOptions {
36
36
  };
37
37
  /** Optional discussion thread ID to add the comment to */
38
38
  discussion_id?: string;
39
- /** The comment content as rich text array (max 100 items) */
40
- rich_text: unknown[];
39
+ /** The comment content as rich text array (max 100 items). Exactly one of `rich_text`/`markdown` must be provided. */
40
+ rich_text?: unknown[];
41
+ /** The comment content as a markdown string (inline formatting only). Exactly one of `rich_text`/`markdown` must be provided. */
42
+ markdown?: string;
41
43
  /** File attachments (max 3 allowed) */
42
44
  attachments?: CommentAttachment[];
43
45
  /** Custom display name for the comment */
44
46
  display_name?: CommentDisplayName;
45
47
  }
48
+ /**
49
+ * Options for updating a comment.
50
+ */
51
+ export interface UpdateCommentOptions {
52
+ /** The comment content as rich text array (max 100 items). Exactly one of `rich_text`/`markdown` must be provided. */
53
+ rich_text?: unknown[];
54
+ /** The comment content as a markdown string (inline formatting only). Exactly one of `rich_text`/`markdown` must be provided. */
55
+ markdown?: string;
56
+ }
46
57
  /**
47
58
  * Comments API client for working with Notion comments.
48
59
  */
@@ -68,6 +79,9 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
68
79
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
69
80
  type: import("zod").ZodLiteral<"block_id">;
70
81
  block_id: import("zod").ZodUUID;
82
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
83
+ type: import("zod").ZodLiteral<"agent_id">;
84
+ agent_id: import("zod").ZodUUID;
71
85
  }, import("zod/v4/core").$strip>], "type">;
72
86
  discussion_id: import("zod").ZodUUID;
73
87
  created_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
@@ -79,6 +93,7 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
79
93
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
80
94
  person: import("zod").ZodObject<{
81
95
  email: import("zod").ZodEmail;
96
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
82
97
  }, import("zod/v4/core").$strip>;
83
98
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
84
99
  object: import("zod").ZodLiteral<"user">;
@@ -119,11 +134,11 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
119
134
  underline: import("zod").ZodBoolean;
120
135
  code: import("zod").ZodBoolean;
121
136
  color: import("zod").ZodEnum<{
137
+ default: "default";
122
138
  blue: "blue";
123
139
  blue_background: "blue_background";
124
140
  brown: "brown";
125
141
  brown_background: "brown_background";
126
- default: "default";
127
142
  gray: "gray";
128
143
  gray_background: "gray_background";
129
144
  green: "green";
@@ -188,6 +203,7 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
188
203
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
189
204
  person: import("zod").ZodObject<{
190
205
  email: import("zod").ZodEmail;
206
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
191
207
  }, import("zod/v4/core").$strip>;
192
208
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
193
209
  object: import("zod").ZodLiteral<"user">;
@@ -220,11 +236,11 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
220
236
  underline: import("zod").ZodBoolean;
221
237
  code: import("zod").ZodBoolean;
222
238
  color: import("zod").ZodEnum<{
239
+ default: "default";
223
240
  blue: "blue";
224
241
  blue_background: "blue_background";
225
242
  brown: "brown";
226
243
  brown_background: "brown_background";
227
- default: "default";
228
244
  gray: "gray";
229
245
  gray_background: "gray_background";
230
246
  green: "green";
@@ -255,11 +271,11 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
255
271
  underline: import("zod").ZodBoolean;
256
272
  code: import("zod").ZodBoolean;
257
273
  color: import("zod").ZodEnum<{
274
+ default: "default";
258
275
  blue: "blue";
259
276
  blue_background: "blue_background";
260
277
  brown: "brown";
261
278
  brown_background: "brown_background";
262
- default: "default";
263
279
  gray: "gray";
264
280
  gray_background: "gray_background";
265
281
  green: "green";
@@ -323,4 +339,23 @@ export declare class CommentsAPI extends BaseAPI<NotionComment, Comment> {
323
339
  * @see https://developers.notion.com/reference/create-a-comment
324
340
  */
325
341
  create(options: CreateCommentOptions): Promise<Comment>;
342
+ /**
343
+ * Update an existing comment's content.
344
+ *
345
+ * @param commentId - The ID of the comment to update
346
+ * @param options - The updated comment content (`rich_text` or `markdown`)
347
+ * @returns The updated comment wrapped in a Comment model
348
+ *
349
+ * @see https://developers.notion.com/reference/update-a-comment
350
+ */
351
+ update(commentId: string, options: UpdateCommentOptions): Promise<Comment>;
352
+ /**
353
+ * Delete a comment. A connection can only delete comments it created.
354
+ *
355
+ * @param commentId - The ID of the comment to delete
356
+ * @returns The deleted comment wrapped in a Comment model
357
+ *
358
+ * @see https://developers.notion.com/reference/delete-a-comment
359
+ */
360
+ delete(commentId: string): Promise<Comment>;
326
361
  }
@@ -5,6 +5,18 @@ 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 exactly one of `rich_text`/`markdown` is provided for a comment body.
10
+ *
11
+ * @throws {NotionValidationError}
12
+ */
13
+ function validateCommentContent(options) {
14
+ const hasRichText = options.rich_text !== undefined;
15
+ const hasMarkdown = options.markdown !== undefined;
16
+ if (hasRichText === hasMarkdown) {
17
+ throw new validation_1.NotionValidationError('Exactly one of rich_text or markdown must be provided');
18
+ }
19
+ }
8
20
  /**
9
21
  * Comments API client for working with Notion comments.
10
22
  */
@@ -43,11 +55,41 @@ class CommentsAPI extends base_api_1.BaseAPI {
43
55
  * @see https://developers.notion.com/reference/create-a-comment
44
56
  */
45
57
  async create(options) {
46
- (0, validation_1.validateArrayLength)(options.rich_text, validation_1.LIMITS.ARRAY_ELEMENTS, 'rich_text');
58
+ validateCommentContent(options);
59
+ if (options.rich_text) {
60
+ (0, validation_1.validateArrayLength)(options.rich_text, validation_1.LIMITS.ARRAY_ELEMENTS, 'rich_text');
61
+ }
47
62
  if (options.attachments) {
48
63
  (0, validation_1.validateArrayLength)(options.attachments, validation_1.LIMITS.COMMENT_ATTACHMENTS, 'attachments');
49
64
  }
50
65
  return this.createResource('/comments', options);
51
66
  }
67
+ /**
68
+ * Update an existing comment's content.
69
+ *
70
+ * @param commentId - The ID of the comment to update
71
+ * @param options - The updated comment content (`rich_text` or `markdown`)
72
+ * @returns The updated comment wrapped in a Comment model
73
+ *
74
+ * @see https://developers.notion.com/reference/update-a-comment
75
+ */
76
+ async update(commentId, options) {
77
+ validateCommentContent(options);
78
+ if (options.rich_text) {
79
+ (0, validation_1.validateArrayLength)(options.rich_text, validation_1.LIMITS.ARRAY_ELEMENTS, 'rich_text');
80
+ }
81
+ return this.updateResource(`/comments/${commentId}`, options);
82
+ }
83
+ /**
84
+ * Delete a comment. A connection can only delete comments it created.
85
+ *
86
+ * @param commentId - The ID of the comment to delete
87
+ * @returns The deleted comment wrapped in a Comment model
88
+ *
89
+ * @see https://developers.notion.com/reference/delete-a-comment
90
+ */
91
+ async delete(commentId) {
92
+ return this.deleteResource(`/comments/${commentId}`);
93
+ }
52
94
  }
53
95
  exports.CommentsAPI = CommentsAPI;
@@ -0,0 +1,36 @@
1
+ import type { NotionClient } from '../client';
2
+ import { type NotionCustomEmoji, type PaginatedList, type PaginationParameters } from '../schemas';
3
+ import { CustomEmoji } from '../models';
4
+ import { BaseAPI } from './base.api';
5
+ /**
6
+ * Options for listing custom emojis.
7
+ */
8
+ export interface ListCustomEmojisOptions extends PaginationParameters {
9
+ /** Filter custom emojis by exact name match */
10
+ name?: string;
11
+ }
12
+ /**
13
+ * Custom Emojis API client for working with Notion workspace custom emojis.
14
+ */
15
+ export declare class CustomEmojisAPI extends BaseAPI<NotionCustomEmoji, CustomEmoji> {
16
+ protected readonly client: NotionClient;
17
+ protected config: {
18
+ schema: import("zod").ZodObject<{
19
+ id: import("zod").ZodUUID;
20
+ name: import("zod").ZodString;
21
+ url: import("zod").ZodURL;
22
+ }, import("zod/v4/core").$strip>;
23
+ ModelClass: typeof CustomEmoji;
24
+ listType: "custom_emoji";
25
+ };
26
+ constructor(client: NotionClient);
27
+ /**
28
+ * List the custom emojis available in the workspace (paginated).
29
+ *
30
+ * @param options - Options for filtering by name and paginating results
31
+ * @returns Paginated list of custom emojis
32
+ *
33
+ * @see https://developers.notion.com/reference/list-custom-emojis
34
+ */
35
+ list(options?: ListCustomEmojisOptions): Promise<PaginatedList<CustomEmoji>>;
36
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CustomEmojisAPI = void 0;
4
+ const schemas_1 = require("../schemas");
5
+ const models_1 = require("../models");
6
+ const base_api_1 = require("./base.api");
7
+ /**
8
+ * Custom Emojis API client for working with Notion workspace custom emojis.
9
+ */
10
+ class CustomEmojisAPI extends base_api_1.BaseAPI {
11
+ constructor(client) {
12
+ super(client);
13
+ this.client = client;
14
+ this.config = {
15
+ schema: schemas_1.customEmojiSchema,
16
+ ModelClass: models_1.CustomEmoji,
17
+ listType: 'custom_emoji',
18
+ };
19
+ }
20
+ /**
21
+ * List the custom emojis available in the workspace (paginated).
22
+ *
23
+ * @param options - Options for filtering by name and paginating results
24
+ * @returns Paginated list of custom emojis
25
+ *
26
+ * @see https://developers.notion.com/reference/list-custom-emojis
27
+ */
28
+ async list(options) {
29
+ const query = {
30
+ ...(options?.name ? { name: options.name } : {}),
31
+ ...this.buildPaginationQuery(options),
32
+ };
33
+ return this.listResources('/custom_emojis', query);
34
+ }
35
+ }
36
+ exports.CustomEmojisAPI = CustomEmojisAPI;
@@ -1,5 +1,5 @@
1
1
  import type { NotionClient } from '../client';
2
- import { type NotionDataSource, type PaginatedList, type PaginationParameters } from '../schemas';
2
+ import { type DataSourceTemplateList, type NotionDataSource, type PaginatedList, type PaginationParameters } from '../schemas';
3
3
  import { DataSource, Page } from '../models';
4
4
  import { BaseAPI } from './base.api';
5
5
  /**
@@ -43,6 +43,13 @@ export interface RetrieveDataSourceOptions {
43
43
  /** Filter properties to include in the response */
44
44
  filter_properties?: string[];
45
45
  }
46
+ /**
47
+ * Options for listing a data source's templates.
48
+ */
49
+ export interface ListDataSourceTemplatesOptions extends PaginationParameters {
50
+ /** Filter templates by name (case-insensitive substring match) */
51
+ name?: string;
52
+ }
46
53
  /**
47
54
  * Filter condition for data source queries.
48
55
  * This is a simplified type - the actual Notion API supports many filter types.
@@ -165,9 +172,9 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
165
172
  id: import("zod").ZodString;
166
173
  name: import("zod").ZodString;
167
174
  color: import("zod").ZodEnum<{
175
+ default: "default";
168
176
  blue: "blue";
169
177
  brown: "brown";
170
- default: "default";
171
178
  gray: "gray";
172
179
  green: "green";
173
180
  orange: "orange";
@@ -309,9 +316,9 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
309
316
  id: import("zod").ZodString;
310
317
  name: import("zod").ZodString;
311
318
  color: import("zod").ZodEnum<{
319
+ default: "default";
312
320
  blue: "blue";
313
321
  brown: "brown";
314
- default: "default";
315
322
  gray: "gray";
316
323
  green: "green";
317
324
  orange: "orange";
@@ -332,9 +339,9 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
332
339
  id: import("zod").ZodString;
333
340
  name: import("zod").ZodString;
334
341
  color: import("zod").ZodEnum<{
342
+ default: "default";
335
343
  blue: "blue";
336
344
  brown: "brown";
337
- default: "default";
338
345
  gray: "gray";
339
346
  green: "green";
340
347
  orange: "orange";
@@ -348,9 +355,9 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
348
355
  id: import("zod").ZodString;
349
356
  name: import("zod").ZodString;
350
357
  color: import("zod").ZodEnum<{
358
+ default: "default";
351
359
  blue: "blue";
352
360
  brown: "brown";
353
- default: "default";
354
361
  gray: "gray";
355
362
  green: "green";
356
363
  orange: "orange";
@@ -399,6 +406,9 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
399
406
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
400
407
  type: import("zod").ZodLiteral<"block_id">;
401
408
  block_id: import("zod").ZodUUID;
409
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
410
+ type: import("zod").ZodLiteral<"agent_id">;
411
+ agent_id: import("zod").ZodUUID;
402
412
  }, import("zod/v4/core").$strip>], "type">;
403
413
  database_parent: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
404
414
  type: import("zod").ZodLiteral<"database_id">;
@@ -416,6 +426,9 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
416
426
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
417
427
  type: import("zod").ZodLiteral<"block_id">;
418
428
  block_id: import("zod").ZodUUID;
429
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
430
+ type: import("zod").ZodLiteral<"agent_id">;
431
+ agent_id: import("zod").ZodUUID;
419
432
  }, import("zod/v4/core").$strip>], "type">;
420
433
  created_time: import("zod").ZodUnion<readonly [import("zod").ZodISODateTime, import("zod").ZodISODate]>;
421
434
  created_by: import("zod").ZodUnion<readonly [import("zod").ZodObject<{
@@ -426,6 +439,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
426
439
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
427
440
  person: import("zod").ZodObject<{
428
441
  email: import("zod").ZodEmail;
442
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
429
443
  }, import("zod/v4/core").$strip>;
430
444
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
431
445
  object: import("zod").ZodLiteral<"user">;
@@ -459,6 +473,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
459
473
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
460
474
  person: import("zod").ZodObject<{
461
475
  email: import("zod").ZodEmail;
476
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
462
477
  }, import("zod/v4/core").$strip>;
463
478
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
464
479
  object: import("zod").ZodLiteral<"user">;
@@ -498,11 +513,11 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
498
513
  underline: import("zod").ZodBoolean;
499
514
  code: import("zod").ZodBoolean;
500
515
  color: import("zod").ZodEnum<{
516
+ default: "default";
501
517
  blue: "blue";
502
518
  blue_background: "blue_background";
503
519
  brown: "brown";
504
520
  brown_background: "brown_background";
505
- default: "default";
506
521
  gray: "gray";
507
522
  gray_background: "gray_background";
508
523
  green: "green";
@@ -567,6 +582,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
567
582
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
568
583
  person: import("zod").ZodObject<{
569
584
  email: import("zod").ZodEmail;
585
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
570
586
  }, import("zod/v4/core").$strip>;
571
587
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
572
588
  object: import("zod").ZodLiteral<"user">;
@@ -599,11 +615,11 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
599
615
  underline: import("zod").ZodBoolean;
600
616
  code: import("zod").ZodBoolean;
601
617
  color: import("zod").ZodEnum<{
618
+ default: "default";
602
619
  blue: "blue";
603
620
  blue_background: "blue_background";
604
621
  brown: "brown";
605
622
  brown_background: "brown_background";
606
- default: "default";
607
623
  gray: "gray";
608
624
  gray_background: "gray_background";
609
625
  green: "green";
@@ -634,11 +650,11 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
634
650
  underline: import("zod").ZodBoolean;
635
651
  code: import("zod").ZodBoolean;
636
652
  color: import("zod").ZodEnum<{
653
+ default: "default";
637
654
  blue: "blue";
638
655
  blue_background: "blue_background";
639
656
  brown: "brown";
640
657
  brown_background: "brown_background";
641
- default: "default";
642
658
  gray: "gray";
643
659
  gray_background: "gray_background";
644
660
  green: "green";
@@ -673,11 +689,11 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
673
689
  underline: import("zod").ZodBoolean;
674
690
  code: import("zod").ZodBoolean;
675
691
  color: import("zod").ZodEnum<{
692
+ default: "default";
676
693
  blue: "blue";
677
694
  blue_background: "blue_background";
678
695
  brown: "brown";
679
696
  brown_background: "brown_background";
680
- default: "default";
681
697
  gray: "gray";
682
698
  gray_background: "gray_background";
683
699
  green: "green";
@@ -742,6 +758,7 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
742
758
  avatar_url: import("zod").ZodOptional<import("zod").ZodUnion<readonly [import("zod").ZodURL, import("zod").ZodNull]>>;
743
759
  person: import("zod").ZodObject<{
744
760
  email: import("zod").ZodEmail;
761
+ email_verified: import("zod").ZodOptional<import("zod").ZodBoolean>;
745
762
  }, import("zod/v4/core").$strip>;
746
763
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
747
764
  object: import("zod").ZodLiteral<"user">;
@@ -774,11 +791,11 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
774
791
  underline: import("zod").ZodBoolean;
775
792
  code: import("zod").ZodBoolean;
776
793
  color: import("zod").ZodEnum<{
794
+ default: "default";
777
795
  blue: "blue";
778
796
  blue_background: "blue_background";
779
797
  brown: "brown";
780
798
  brown_background: "brown_background";
781
- default: "default";
782
799
  gray: "gray";
783
800
  gray_background: "gray_background";
784
801
  green: "green";
@@ -809,11 +826,11 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
809
826
  underline: import("zod").ZodBoolean;
810
827
  code: import("zod").ZodBoolean;
811
828
  color: import("zod").ZodEnum<{
829
+ default: "default";
812
830
  blue: "blue";
813
831
  blue_background: "blue_background";
814
832
  brown: "brown";
815
833
  brown_background: "brown_background";
816
- default: "default";
817
834
  gray: "gray";
818
835
  gray_background: "gray_background";
819
836
  green: "green";
@@ -852,6 +869,30 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
852
869
  }, import("zod/v4/core").$strip>], "type">, import("zod").ZodObject<{
853
870
  type: import("zod").ZodLiteral<"emoji">;
854
871
  emoji: import("zod").ZodString;
872
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
873
+ type: import("zod").ZodLiteral<"icon">;
874
+ icon: import("zod").ZodObject<{
875
+ name: import("zod").ZodString;
876
+ color: import("zod").ZodOptional<import("zod").ZodEnum<{
877
+ blue: "blue";
878
+ brown: "brown";
879
+ gray: "gray";
880
+ green: "green";
881
+ orange: "orange";
882
+ pink: "pink";
883
+ purple: "purple";
884
+ red: "red";
885
+ yellow: "yellow";
886
+ lightgray: "lightgray";
887
+ }>>;
888
+ }, import("zod/v4/core").$strip>;
889
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
890
+ type: import("zod").ZodLiteral<"custom_emoji">;
891
+ custom_emoji: import("zod").ZodObject<{
892
+ id: import("zod").ZodUUID;
893
+ name: import("zod").ZodOptional<import("zod").ZodString>;
894
+ url: import("zod").ZodOptional<import("zod").ZodURL>;
895
+ }, import("zod/v4/core").$strip>;
855
896
  }, import("zod/v4/core").$strip>]>>;
856
897
  cover: import("zod").ZodNullable<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
857
898
  type: import("zod").ZodLiteral<"file">;
@@ -889,6 +930,16 @@ export declare class DataSourcesAPI extends BaseAPI<NotionDataSource, DataSource
889
930
  * @see https://developers.notion.com/reference/retrieve-a-data-source
890
931
  */
891
932
  retrieve(dataSourceId: string, options?: RetrieveDataSourceOptions): Promise<DataSource>;
933
+ /**
934
+ * List the templates available for a data source.
935
+ *
936
+ * @param dataSourceId - The ID of the data source
937
+ * @param options - Options for filtering by name and paginating results
938
+ * @returns The list of templates, along with pagination metadata
939
+ *
940
+ * @see https://developers.notion.com/reference/list-data-source-templates
941
+ */
942
+ listTemplates(dataSourceId: string, options?: ListDataSourceTemplatesOptions): Promise<DataSourceTemplateList>;
892
943
  /**
893
944
  * Query a data source with optional filters and sorts.
894
945
  * Returns pages that match the query.
@@ -36,6 +36,27 @@ class DataSourcesAPI extends base_api_1.BaseAPI {
36
36
  };
37
37
  return this.retrieveResource(`/data_sources/${dataSourceId}`, query);
38
38
  }
39
+ /**
40
+ * List the templates available for a data source.
41
+ *
42
+ * @param dataSourceId - The ID of the data source
43
+ * @param options - Options for filtering by name and paginating results
44
+ * @returns The list of templates, along with pagination metadata
45
+ *
46
+ * @see https://developers.notion.com/reference/list-data-source-templates
47
+ */
48
+ async listTemplates(dataSourceId, options) {
49
+ const query = {
50
+ ...(options?.name ? { name: options.name } : {}),
51
+ ...this.buildPaginationQuery(options),
52
+ };
53
+ const response = await this.client.request({
54
+ method: 'GET',
55
+ path: `/data_sources/${dataSourceId}/templates`,
56
+ query: Object.keys(query).length > 0 ? query : undefined,
57
+ });
58
+ return schemas_1.dataSourceTemplateListSchema.parse(response);
59
+ }
39
60
  /**
40
61
  * Query a data source with optional filters and sorts.
41
62
  * Returns pages that match the query.
@@ -86,6 +107,7 @@ class DataSourcesAPI extends base_api_1.BaseAPI {
86
107
  next_cursor: parsed.next_cursor,
87
108
  has_more: parsed.has_more,
88
109
  type: 'page',
110
+ request_status: parsed.request_status,
89
111
  };
90
112
  }
91
113
  /**