Skip to content

Commit a0c7dd0

Browse files
committed
Update page with template example
1 parent 3924bd4 commit a0c7dd0

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
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+
})();

0 commit comments

Comments
 (0)