mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
feat(Notion Node): Add option to update icon when updating a page (#5670)
This commit is contained in:
parent
4c854f4f23
commit
225e849960
|
@ -1000,6 +1000,48 @@ export const databasePageFields: INodeProperties[] = [
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'Options',
|
||||
name: 'options',
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['databasePage'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
placeholder: 'Add Option',
|
||||
options: [
|
||||
{
|
||||
displayName: 'Icon Type',
|
||||
name: 'iconType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Emoji',
|
||||
value: 'emoji',
|
||||
description: 'Use an Emoji for the icon',
|
||||
},
|
||||
{
|
||||
name: 'File',
|
||||
value: 'file',
|
||||
description: 'Use a file for the icon',
|
||||
},
|
||||
],
|
||||
default: 'emoji',
|
||||
description: 'The icon type for the database page, Either a URL or an Emoji',
|
||||
},
|
||||
{
|
||||
displayName: 'Icon',
|
||||
name: 'icon',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Emoji or File URL to use as the icon',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* databasePage:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
|
|
@ -600,6 +600,16 @@ export class NotionV2 implements INodeType {
|
|||
if (properties.length !== 0) {
|
||||
body.properties = mapProperties.call(this, properties, timezone, 2) as IDataObject;
|
||||
}
|
||||
|
||||
const options = this.getNodeParameter('options', i);
|
||||
if (options.icon) {
|
||||
if (options.iconType && options.iconType === 'file') {
|
||||
body.icon = { type: 'external', external: { url: options.icon } };
|
||||
} else {
|
||||
body.icon = { type: 'emoji', emoji: options.icon };
|
||||
}
|
||||
}
|
||||
|
||||
responseData = await notionApiRequest.call(this, 'PATCH', `/pages/${pageId}`, body);
|
||||
if (simple) {
|
||||
responseData = simplifyObjects(responseData, false);
|
||||
|
|
Loading…
Reference in a new issue