feat(Notion Node): Add icon support for page and database page creation (#5468)
This commit is contained in:
committed by
GitHub
parent
a9f08fc5ba
commit
71cba06b7c
@@ -463,6 +463,16 @@ export class NotionV2 implements INodeType {
|
||||
const blockValues = this.getNodeParameter('blockUi.blockValues', i, []) as IDataObject[];
|
||||
extractDatabaseMentionRLC(blockValues);
|
||||
body.children = formatBlocks(blockValues);
|
||||
|
||||
const options = this.getNodeParameter('options', i);
|
||||
if (options.icon) {
|
||||
if (options.iconType && options.iconType === 'file') {
|
||||
body.icon = { external: { url: options.icon } };
|
||||
} else {
|
||||
body.icon = { emoji: options.icon };
|
||||
}
|
||||
}
|
||||
|
||||
responseData = await notionApiRequest.call(this, 'POST', '/pages', body);
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData);
|
||||
@@ -663,7 +673,6 @@ export class NotionV2 implements INodeType {
|
||||
if (operation === 'create') {
|
||||
for (let i = 0; i < length; i++) {
|
||||
const simple = this.getNodeParameter('simple', i) as boolean;
|
||||
|
||||
const body: { [key: string]: any } = {
|
||||
parent: {},
|
||||
properties: {},
|
||||
@@ -675,6 +684,16 @@ export class NotionV2 implements INodeType {
|
||||
const blockValues = this.getNodeParameter('blockUi.blockValues', i, []) as IDataObject[];
|
||||
extractDatabaseMentionRLC(blockValues);
|
||||
body.children = formatBlocks(blockValues);
|
||||
|
||||
const options = this.getNodeParameter('options', i);
|
||||
if (options.icon) {
|
||||
if (options.iconType && options.iconType === 'file') {
|
||||
body.icon = { external: { url: options.icon } };
|
||||
} else {
|
||||
body.icon = { emoji: options.icon };
|
||||
}
|
||||
}
|
||||
|
||||
responseData = await notionApiRequest.call(this, 'POST', '/pages', body);
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, download);
|
||||
|
||||
Reference in New Issue
Block a user