default: {
buildRichTextObj: (
input: string | Object,
options?: {
annotations?: {
bold?: boolean;
italic?: boolean;
strikethrough?: boolean;
underline?: boolean;
code?: boolean;
color?: string;
};
url?: string;
type?: string;
},
...args?: any[],
) => Object[];
mentionUser: (
userId: string,
options?: { annotations?: Object; url?: string },
) => Object[];
mentionDate: (
date: string | Object,
options?: { annotations?: Object; url?: string },
) => Object[];
mentionDatabase: (
databaseId: string,
options?: { annotations?: Object; url?: string },
) => Object[];
mentionPage: (
pageId: string,
options?: { annotations?: Object; url?: string },
) => Object[];
makeParagraphBlocks: (strings: string[]) => Object[];
block: {
audio: any;
bookmark: any;
breadcrumb: any;
bulleted_list_item: any;
callout: any;
code: any;
column_list: any;
column: any;
divider: any;
embed: any;
file: any;
heading_1: any;
heading_2: any;
heading_3: any;
image: any;
numbered_list_item: any;
paragraph: any;
pdf: any;
quote: any;
table: any;
table_row: any;
table_of_contents: any;
to_do: any;
toggle: any;
video: any;
};
request: { pages: any; blocks: any };
setIcon: (value: string) => Object;
createPage: (
options: {
data: {
parent: Object;
properties?: Object;
icon?: Object;
cover?: Object;
children?: Object[];
};
client?: Object;
apiCall?: Function;
getPage?: Function;
getResults?: Function;
templateWaitMs?: number;
onTemplatePageCreated?: Function;
skipAutoAppendOnTemplate?: boolean;
},
) => Promise<Object>;
appendBlocks: (
options: {
block_id: string;
children: Object[];
client?: Object;
apiCall?: Function;
getResults?: Function;
},
) => Promise<Object>;
page_meta: {
parent: any;
page: any;
block: any;
property: any;
icon: any;
cover: any;
template: any;
};
page_props: {
title: any;
rich_text: any;
checkbox: any;
date: any;
email: any;
files: any;
multi_select: any;
number: any;
people: any;
phone_number: any;
relation: any;
select: any;
status: any;
url: any;
};
quickPages: (options: Object) => Object[];
createNotionBuilder: (
options?: {
strict?: boolean;
limitNesting?: boolean;
limitChildren?: boolean;
allowBlankParagraphs?: boolean;
handleTemplatePageChildren?: boolean;
},
) => Object;
createNotion: (
options: {
strict?: boolean;
limitNesting?: number;
limitChildren?: boolean;
allowBlankParagraphs?: boolean;
},
) => Object;
parentDatabase: (database_id: string) => Object;
parentDb: (database_id: string) => Object;
parentDataSource: (data_source_id: string) => Object;
parentDs: (data_source_id: string) => Object;
parentPage: (page_id: string) => Object;
pageId: (page_id: string) => Object;
blockId: (block_id: string) => Object;
propertyId: (property_id: string) => Object;
cover: (url: string) => Object;
icon: (url: string) => Object;
title: (value: string | string[]) => Object;
richText: (value: string | string[]) => Object;
checkbox: (value: boolean) => Object;
date: (start: string, end?: string) => Object;
email: (value: string) => Object;
files: (files: any) => Object;
multiSelect: (values: string | string[]) => Object;
number: (value: string | number) => Object;
people: (people: string | string[]) => Object;
phoneNumber: (value: string) => Object;
relation: (values: string | string[]) => Object;
select: (value: string) => Object;
status: (value: string) => Object;
url: (value: string) => Object;
audio: (options: string | Object) => Object | null;
bookmark: (options: string | Object) => Object;
breadcrumb: () => Object;
bulletedListItem: (options: string | Object | string[]) => Object;
bullet: (options: string | Object | string[]) => Object;
callout: (options: string | Object | string[]) => Object;
code: (options: string | Object | string[]) => Object;
divider: () => Object;
embed: (options: string | Object) => Object;
file: (options: string | Object) => Object | null;
heading1: (options: string | Object | string[]) => Object;
heading2: (options: string | Object | string[]) => Object;
heading3: (options: string | Object | string[]) => Object;
image: (options: string | Object) => Object | null;
numberedListItem: (options: string | Object | string[]) => Object;
num: (options: string | Object | string[]) => Object;
paragraph: (options: string | Object | string[]) => Object;
pdf: (options: string | Object) => Object | null;
quote: (options: string | Object | string[]) => Object;
table: (options: Object) => Object;
tableRow: (cells: (string | Object[])[]) => Object;
tableOfContents: (options?: string | Object) => Object;
toDo: (options: string | Object | string[]) => Object;
toggle: (options: string | Object | string[]) => Object;
video: (options: string | Object) => Object | null;
getDepth: (arr: Object[], level?: number) => number;
getLongestArray: (arr: Object[], count?: number) => number;
getTotalCount: (arr: Object[]) => number;
getPayloadSize: (arr: Object[]) => number;
validateAndSplitBlock: (block: Object, limit?: number) => Object[];
extractNotionPageId: (url: string) => string | null;
isValidUUID: (string: string) => boolean;
} = ...
Type Declaration
buildRichTextObj: (
input: string | Object,
options?: {
annotations?: {
bold?: boolean;
italic?: boolean;
strikethrough?: boolean;
underline?: boolean;
code?: boolean;
color?: string;
};
url?: string;
type?: string;
},
...args?: any[],
) => Object[]
mentionUser: (userId: string, options?: { annotations?: Object; url?: string }) => Object[]
mentionDate: (
date: string | Object,
options?: { annotations?: Object; url?: string },
) => Object[]
mentionDatabase: (
databaseId: string,
options?: { annotations?: Object; url?: string },
) => Object[]
mentionPage: (pageId: string, options?: { annotations?: Object; url?: string }) => Object[]
makeParagraphBlocks: (strings: string[]) => Object[]
Namespaceblock: {
audio: any;
bookmark: any;
breadcrumb: any;
bulleted_list_item: any;
callout: any;
code: any;
column_list: any;
column: any;
divider: any;
embed: any;
file: any;
heading_1: any;
heading_2: any;
heading_3: any;
image: any;
numbered_list_item: any;
paragraph: any;
pdf: any;
quote: any;
table: any;
table_row: any;
table_of_contents: any;
to_do: any;
toggle: any;
video: any;
}
Namespacerequest: { pages: any; blocks: any }
setIcon: (value: string) => Object
createPage: (
options: {
data: {
parent: Object;
properties?: Object;
icon?: Object;
cover?: Object;
children?: Object[];
};
client?: Object;
apiCall?: Function;
getPage?: Function;
getResults?: Function;
templateWaitMs?: number;
onTemplatePageCreated?: Function;
skipAutoAppendOnTemplate?: boolean;
},
) => Promise<Object>
appendBlocks: (
options: {
block_id: string;
children: Object[];
client?: Object;
apiCall?: Function;
getResults?: Function;
},
) => Promise<Object>
Namespacepage_meta: {
parent: any;
page: any;
block: any;
property: any;
icon: any;
cover: any;
template: any;
}
Namespacepage_props: {
title: any;
rich_text: any;
checkbox: any;
date: any;
email: any;
files: any;
multi_select: any;
number: any;
people: any;
phone_number: any;
relation: any;
select: any;
status: any;
url: any;
}
quickPages: (options: Object) => Object[]
createNotionBuilder: (
options?: {
strict?: boolean;
limitNesting?: boolean;
limitChildren?: boolean;
allowBlankParagraphs?: boolean;
handleTemplatePageChildren?: boolean;
},
) => Object
createNotion: (
options: {
strict?: boolean;
limitNesting?: number;
limitChildren?: boolean;
allowBlankParagraphs?: boolean;
},
) => Object
parentDatabase: (database_id: string) => Object
parentDb: (database_id: string) => Object
parentDataSource: (data_source_id: string) => Object
parentDs: (data_source_id: string) => Object
parentPage: (page_id: string) => Object
pageId: (page_id: string) => Object
blockId: (block_id: string) => Object
propertyId: (property_id: string) => Object
cover: (url: string) => Object
icon: (url: string) => Object
title: (value: string | string[]) => Object
richText: (value: string | string[]) => Object
checkbox: (value: boolean) => Object
date: (start: string, end?: string) => Object
email: (value: string) => Object
files: (files: any) => Object
multiSelect: (values: string | string[]) => Object
number: (value: string | number) => Object
people: (people: string | string[]) => Object
phoneNumber: (value: string) => Object
relation: (values: string | string[]) => Object
select: (value: string) => Object
status: (value: string) => Object
url: (value: string) => Object
audio: (options: string | Object) => Object | null
bookmark: (options: string | Object) => Object
breadcrumb: () => Object
bulletedListItem: (options: string | Object | string[]) => Object
bullet: (options: string | Object | string[]) => Object
callout: (options: string | Object | string[]) => Object
code: (options: string | Object | string[]) => Object
divider: () => Object
embed: (options: string | Object) => Object
file: (options: string | Object) => Object | null
heading1: (options: string | Object | string[]) => Object
heading2: (options: string | Object | string[]) => Object
heading3: (options: string | Object | string[]) => Object
image: (options: string | Object) => Object | null
numberedListItem: (options: string | Object | string[]) => Object
num: (options: string | Object | string[]) => Object
paragraph: (options: string | Object | string[]) => Object
pdf: (options: string | Object) => Object | null
quote: (options: string | Object | string[]) => Object
table: (options: Object) => Object
tableRow: (cells: (string | Object[])[]) => Object
tableOfContents: (options?: string | Object) => Object
toDo: (options: string | Object | string[]) => Object
toggle: (options: string | Object | string[]) => Object
video: (options: string | Object) => Object | null
getDepth: (arr: Object[], level?: number) => number
getLongestArray: (arr: Object[], count?: number) => number
getTotalCount: (arr: Object[]) => number
getPayloadSize: (arr: Object[]) => number
validateAndSplitBlock: (block: Object, limit?: number) => Object[]
isValidUUID: (string: string) => boolean
Object with methods to construct the majority of block types supported by the Notion API.
Block types include audio, bookmark, breadcrumb, bulleted list item, callout, code, column_list, column, divider, embed, file, heading, image, numbered list item, paragraph, pdf, quote, table, table row, table of contents, to-do, toggle, and video. Some block types return null if they are provided with invalid data; you should filter these out your final children array.
Not supported: Link preview, synced block. Equation and Mention are supported within the buildRichTextObj() function, not here.