Skip to content

Commit d4b1406

Browse files
authored
Merge pull request #10 from typeoneerror/update-with-template
Update with template
2 parents fe7ebc8 + a0c7dd0 commit d4b1406

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

examples/templates/create-from.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const argv = yargs.default({ dataSourceId, template }).argv;
1010
// template[type]=none (default behavior) doesn't use a template
1111
// template[type]=default uses the default template
1212
// template[type]=template_id; template[template_id]=... uses the provided template id
13-
1413
const template = !['none', 'default'].includes(argv.template)
1514
? { type: 'template_id', template_id: argv.template }
1615
: { type: argv.template };

examples/templates/update-with.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const { notion, yargs } = require('../shared');
2+
const { log } = require('../shared/utils');
3+
4+
const pageId = '28e1c1cce3f3801fb861f1cf847a861a';
5+
const template = 'default';
6+
const argv = yargs.boolean('eraseContent').default({ pageId, template, eraseContent: false }).argv;
7+
8+
(async () => {
9+
// template[type]=default uses the default template
10+
// template[type]=template_id; template[template_id]=... uses the provided template id
11+
const template =
12+
argv.template != 'default'
13+
? { type: 'template_id', template_id: argv.template }
14+
: { type: argv.template };
15+
16+
const params = {
17+
page_id: argv.pageId,
18+
template,
19+
erase_content: argv.eraseContent,
20+
};
21+
22+
const page = await notion.pages.update(params);
23+
24+
log(page);
25+
})();

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "Benjamin Borowski <[email protected]>",
77
"license": "MIT",
88
"dependencies": {
9-
"@notionhq/client": "^5.2.0",
9+
"@notionhq/client": "^5.3.0",
1010
"@notionhq/notion-mcp-server": "^1.9.0",
1111
"async-sema": "^3.1.1",
1212
"axios": "^1.4.0",

0 commit comments

Comments
 (0)