2021-05-20 14:31:23 -07:00
import {
INodeProperties ,
} from 'n8n-workflow' ;
import {
blocks ,
} from './Blocks' ;
2021-12-29 14:23:22 -08:00
export const blockOperations = [
2021-05-20 14:31:23 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
displayOptions : {
show : {
resource : [
'block' ,
] ,
} ,
} ,
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' ,
} ,
{
2021-12-29 14:23:22 -08:00
name : 'Get Child Blocks' ,
2021-05-20 14:31:23 -07:00
value : 'getAll' ,
description : 'Get all children blocks' ,
} ,
] ,
default : 'append' ,
} ,
2021-12-29 14:23:22 -08:00
] as INodeProperties [ ] ;
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 : {
resource : [
'block' ,
] ,
operation : [
'append' ,
] ,
} ,
} ,
2021-12-29 14:23:22 -08: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 : {
resource : [
'block' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
2021-12-29 14:23:22 -08: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 : {
resource : [
'block' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
default : false ,
2021-12-29 14:23:22 -08:00
description : 'If all results should be returned or only up to a given limit' ,
2021-05-20 14:31:23 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
resource : [
'block' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 50 ,
2021-12-29 14:23:22 -08:00
description : 'How many results to return' ,
2021-05-20 14:31:23 -07:00
} ,
2021-12-29 14:23:22 -08:00
] as INodeProperties [ ] ;