n8n-nodes-notion-advanced
Version:
Advanced n8n Notion nodes: Full-featured workflow node + AI Agent Tool for intelligent Notion automation with 25+ block types (BETA)
105 lines (104 loc) • 4.26 kB
TypeScript
import { IDataObject, IExecuteFunctions, IHttpRequestMethods, INodeExecutionData } from 'n8n-workflow';
import { Block, BlockInput, BlockWithId, RichTextObject, RichTextAnnotations, NotionColor, PageInput } from '../../types/NotionTypes';
/**
* Makes an authenticated request to the Notion API
*/
export declare function notionApiRequest(this: IExecuteFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject): Promise<any>;
/**
* Validates Notion API credentials by making a test request
*/
export declare function validateCredentials(this: IExecuteFunctions): Promise<boolean>;
/**
* Creates a rich text object from a string with optional formatting
*/
export declare function createRichText(text: string, annotations?: Partial<RichTextAnnotations>, link?: string): RichTextObject;
/**
* Parses rich text input from various formats
*/
export declare function parseRichTextInput(input: any): RichTextObject[];
/**
* Creates a paragraph block
*/
export declare function createParagraphBlock(text: string | RichTextObject[], color?: NotionColor, children?: Block[]): Block;
/**
* Creates a heading block
*/
export declare function createHeadingBlock(level: 1 | 2 | 3, text: string | RichTextObject[], color?: NotionColor, isToggleable?: boolean): Block;
/**
* Creates a list item block
*/
export declare function createListItemBlock(type: 'bulleted_list_item' | 'numbered_list_item', text: string | RichTextObject[], color?: NotionColor, children?: Block[]): Block;
/**
* Creates a to-do block
*/
export declare function createToDoBlock(text: string | RichTextObject[], checked?: boolean, color?: NotionColor, children?: Block[]): Block;
/**
* Creates a code block
*/
export declare function createCodeBlock(code: string, language?: string, caption?: RichTextObject[]): Block;
/**
* Creates a quote block
*/
export declare function createQuoteBlock(text: string | RichTextObject[], color?: NotionColor, children?: Block[]): Block;
/**
* Creates a callout block
*/
export declare function createCalloutBlock(text: string | RichTextObject[], icon?: string, color?: NotionColor, children?: Block[]): Block;
/**
* Creates a divider block
*/
export declare function createDividerBlock(): Block;
/**
* Creates an equation block
*/
export declare function createEquationBlock(expression: string): Block;
/**
* Creates an image block
*/
export declare function createImageBlock(url: string, caption?: RichTextObject[]): Block;
/**
* Creates a bookmark block
*/
export declare function createBookmarkBlock(url: string, caption?: RichTextObject[]): Block;
/**
* Creates an embed block
*/
export declare function createEmbedBlock(url: string, caption?: RichTextObject[]): Block;
/**
* Creates a toggle block
*/
export declare function createToggleBlock(text: string | RichTextObject[], color?: NotionColor, children?: Block[]): Block;
/**
* Creates a table block with rows
*/
export declare function createTableBlock(tableWidth: number, rows: RichTextObject[][][], hasColumnHeader?: boolean, hasRowHeader?: boolean): Block;
/**
* Converts BlockInput to actual Block objects
*/
export declare function convertBlockInput(blockInput: BlockInput): Block;
/**
* Resolves a page ID from various input formats (URL, ID, title search)
*/
export declare function resolvePageId(this: IExecuteFunctions, pageInput: string): Promise<string>;
/**
* Validates a block structure before sending to Notion API
*/
export declare function validateBlock(block: Block): void;
/**
* Paginated request helper for Notion API
*/
export declare function paginatedRequest(this: IExecuteFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject): Promise<any[]>;
/**
* Creates page input from parameters for validation
*/
export declare function createPageInput(title: string, parent: string, properties?: {
[key: string]: any;
}, children?: BlockInput[], icon?: string, cover?: string): PageInput;
/**
* Gets blocks with full metadata including IDs
*/
export declare function getBlocksWithIds(this: IExecuteFunctions, blockId: string): Promise<BlockWithId[]>;
/**
* Creates execution data from results
*/
export declare function createExecutionData(data: IDataObject[]): INodeExecutionData[];