2022-08-17 08:50:24 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2021-05-20 14:31:23 -07:00
2022-08-17 08:50:24 -07:00
import { blocks } from './Blocks' ;
2021-05-20 14:31:23 -07:00
2022-07-04 02:12:08 -07:00
export const blockOperations : INodeProperties [ ] = [
2021-05-20 14:31:23 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2021-05-20 14:31:23 -07:00
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'block' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
options : [
{
2021-12-29 14:23:22 -08:00
name : 'Append After' ,
2021-05-20 14:31:23 -07:00
value : 'append' ,
description : 'Append a block' ,
2022-07-10 13:50:51 -07:00
action : 'Append a block' ,
2021-05-20 14:31:23 -07:00
} ,
{
2022-09-07 07:51:14 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-option-name-wrong-for-get-many
2021-12-29 14:23:22 -08:00
name : 'Get Child Blocks' ,
2021-05-20 14:31:23 -07:00
value : 'getAll' ,
2022-09-13 03:36:36 -07:00
description : 'Get many child blocks' ,
action : 'Get many child blocks' ,
2021-05-20 14:31:23 -07:00
} ,
] ,
default : 'append' ,
} ,
2022-07-04 02:12:08 -07:00
] ;
2021-05-20 14:31:23 -07:00
2021-12-29 14:23:22 -08:00
export const blockFields = [
2021-05-20 14:31:23 -07:00
/* -------------------------------------------------------------------------- */
/* block:append */
/* -------------------------------------------------------------------------- */
{
2021-12-29 14:23:22 -08:00
displayName : 'Block ID or Link' ,
2021-05-20 14:31:23 -07:00
name : 'blockId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'block' ] ,
operation : [ 'append' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
"The Block URL from Notion's 'copy link' functionality (or just the ID contained within the URL). Pages are also blocks, so you can use a page URL/ID here too." ,
2021-05-20 14:31:23 -07:00
} ,
. . . blocks ( 'block' , 'append' ) ,
/* -------------------------------------------------------------------------- */
/* block:getAll */
/* -------------------------------------------------------------------------- */
{
2021-12-29 14:23:22 -08:00
displayName : 'Block ID or Link' ,
2021-05-20 14:31:23 -07:00
name : 'blockId' ,
type : 'string' ,
default : '' ,
required : true ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'block' ] ,
operation : [ 'getAll' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
2022-08-17 08:50:24 -07:00
description :
"The Block URL from Notion's 'copy link' functionality (or just the ID contained within the URL). Pages are also blocks, so you can use a page URL/ID here too." ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'block' ] ,
operation : [ 'getAll' ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
2022-08-17 08:50:24 -07:00
resource : [ 'block' ] ,
operation : [ 'getAll' ] ,
returnAll : [ false ] ,
2021-05-20 14:31:23 -07:00
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2021-05-20 14:31:23 -07:00
} ,
2021-12-29 14:23:22 -08:00
] as INodeProperties [ ] ;