Comment
Defined in: src/models/comment.model.ts:17
Comment model class with helper methods.
Extends
Section titled “Extends”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Comment(
data):Comment
Defined in: src/models/comment.model.ts:18
Parameters
Section titled “Parameters”attachments?
Section titled “attachments?”object[] = ...
created_by
Section titled “created_by”{ avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; } = userSchema
created_time
Section titled “created_time”string = notionDateStringSchema
discussion_id
Section titled “discussion_id”string = ...
display_name?
Section titled “display_name?”{ resolved_name: string; type: "user"; } | { resolved_name: string; type: "custom"; } = ...
string = ...
last_edited_time
Section titled “last_edited_time”string = notionDateStringSchema
object
Section titled “object”"comment" = ...
parent
Section titled “parent”{ database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; } = parentSchema
rich_text
Section titled “rich_text”({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: …; workspace: …; } | { type: …; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: …; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[] = richTextSchema
Returns
Section titled “Returns”Comment
Overrides
Section titled “Overrides”BaseModel<NotionComment>.constructor
Accessors
Section titled “Accessors”attachments
Section titled “attachments”Get Signature
Section titled “Get Signature”get attachments():
object[] |undefined
Defined in: src/models/comment.model.ts:81
Returns the comment attachments (if any).
Returns
Section titled “Returns”object[] | undefined
createdBy
Section titled “createdBy”Get Signature
Section titled “Get Signature”get createdBy(): {
avatar_url?:string|null;id:string;name?:string;object:"user";person: {string;email_verified?:boolean; };type:"person"; } | {avatar_url?:string|null;bot: {owner: {type:"workspace";workspace:true; } | {type:"user"; };workspace_id?:string;workspace_limits?: {max_file_upload_size_in_bytes:number; };workspace_name?:string|null; };id:string;name?:string;object:"user";type:"bot"; } | {id:string;object:"user"; }
Defined in: src/models/comment.model.ts:60
Returns the user who created the comment.
Returns
Section titled “Returns”{ avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }
createdTime
Section titled “createdTime”Get Signature
Section titled “Get Signature”get createdTime():
Date
Defined in: src/models/comment.model.ts:53
Returns the created time as a Date object.
Returns
Section titled “Returns”Date
discussionId
Section titled “discussionId”Get Signature
Section titled “Get Signature”get discussionId():
string
Defined in: src/models/comment.model.ts:46
Returns the discussion thread ID.
Returns
Section titled “Returns”string
displayName
Section titled “displayName”Get Signature
Section titled “Get Signature”get displayName(): {
resolved_name:string;type:"user"; } | {resolved_name:string;type:"custom"; } |undefined
Defined in: src/models/comment.model.ts:88
Returns the comment display name (if set).
Returns
Section titled “Returns”{ resolved_name: string; type: "user"; } | { resolved_name: string; type: "custom"; } | undefined
Get Signature
Section titled “Get Signature”get id():
string
Defined in: src/models/comment.model.ts:32
Returns the comment ID.
Returns
Section titled “Returns”string
Overrides
Section titled “Overrides”lastEditedTime
Section titled “lastEditedTime”Get Signature
Section titled “Get Signature”get lastEditedTime():
Date
Defined in: src/models/comment.model.ts:67
Returns the last edited time as a Date object.
Returns
Section titled “Returns”Date
object
Section titled “object”Get Signature
Section titled “Get Signature”get object():
"comment"
Defined in: src/models/comment.model.ts:25
Returns “comment” - the object type.
Returns
Section titled “Returns”"comment"
Overrides
Section titled “Overrides”parent
Section titled “parent”Get Signature
Section titled “Get Signature”get parent(): {
database_id:string;type:"database_id"; } | {data_source_id:string;database_id:string;type:"data_source_id"; } | {page_id:string;type:"page_id"; } | {type:"workspace";workspace:true; } | {block_id:string;type:"block_id"; } | {agent_id:string;type:"agent_id"; }
Defined in: src/models/comment.model.ts:39
Returns the parent object (page, block, or database).
Returns
Section titled “Returns”{ database_id: string; type: "database_id"; } | { data_source_id: string; database_id: string; type: "data_source_id"; } | { page_id: string; type: "page_id"; } | { type: "workspace"; workspace: true; } | { block_id: string; type: "block_id"; } | { agent_id: string; type: "agent_id"; }
richText
Section titled “richText”Get Signature
Section titled “Get Signature”get richText(): ({
annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };href:string|null;plain_text:string;text: {content:string;link: {url:string; } |null; };type:"text"; } | {annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };href:string|null;mention: {database: {id:string; };type:"database"; } | {date: {end:string|null;start:string;time_zone?:string|null; };type:"date"; } | {link_preview: {url:string; };type:"link_preview"; } | {page: {id:string; };type:"page"; } | {template_mention: {template_mention_date:"today"|"now";type:"template_mention_date"; } | {template_mention_user:"me";type:"template_mention_user"; };type:"template_mention"; } | {type:"user";user: {avatar_url?:string|null;id:string;name?:string;object:"user";person: {string;email_verified?:boolean; };type:"person"; } | {avatar_url?:string|null;bot: {owner: {type:"workspace";workspace:true; } | {type:"user"; };workspace_id?:string;workspace_limits?: {max_file_upload_size_in_bytes:number; };workspace_name?:string|null; };id:string;name?:string;object:"user";type:"bot"; } | {id:string;object:"user"; }; };plain_text:string;type:"mention"; } | {annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };equation: {expression:string; };href:string|null;plain_text:string;type:"equation"; })[]
Defined in: src/models/comment.model.ts:74
Returns the comment content as rich text array.
Returns
Section titled “Returns”({ annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; plain_text: string; text: { content: string; link: { url: string; } | null; }; type: "text"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; href: string | null; mention: { database: { id: string; }; type: "database"; } | { date: { end: string | null; start: string; time_zone?: string | null; }; type: "date"; } | { link_preview: { url: string; }; type: "link_preview"; } | { page: { id: string; }; type: "page"; } | { template_mention: { template_mention_date: "today" | "now"; type: "template_mention_date"; } | { template_mention_user: "me"; type: "template_mention_user"; }; type: "template_mention"; } | { type: "user"; user: { avatar_url?: string | null; id: string; name?: string; object: "user"; person: { email: string; email_verified?: boolean; }; type: "person"; } | { avatar_url?: string | null; bot: { owner: { type: "workspace"; workspace: true; } | { type: "user"; }; workspace_id?: string; workspace_limits?: { max_file_upload_size_in_bytes: number; }; workspace_name?: string | null; }; id: string; name?: string; object: "user"; type: "bot"; } | { id: string; object: "user"; }; }; plain_text: string; type: "mention"; } | { annotations: { bold: boolean; code: boolean; color: "default" | "blue" | "blue_background" | "brown" | "brown_background" | "gray" | "gray_background" | "green" | "green_background" | "orange" | "orange_background" | "pink" | "pink_background" | "purple" | "purple_background" | "red" | "red_background" | "yellow" | "yellow_background"; italic: boolean; strikethrough: boolean; underline: boolean; }; equation: { expression: string; }; href: string | null; plain_text: string; type: "equation"; })[]
Methods
Section titled “Methods”getDisplayName()
Section titled “getDisplayName()”getDisplayName():
string|undefined
Defined in: src/models/comment.model.ts:116
Gets the resolved display name (if available).
Returns
Section titled “Returns”string | undefined
getPlainText()
Section titled “getPlainText()”getPlainText():
string
Defined in: src/models/comment.model.ts:95
Extracts the plain text content from the comment.
Returns
Section titled “Returns”string
hasAttachments()
Section titled “hasAttachments()”hasAttachments():
boolean
Defined in: src/models/comment.model.ts:102
Checks if the comment has attachments.
Returns
Section titled “Returns”boolean
hasBlockParent()
Section titled “hasBlockParent()”hasBlockParent():
boolean
Defined in: src/models/comment.model.ts:130
Checks if the parent is a block.
Returns
Section titled “Returns”boolean
hasCustomDisplayName()
Section titled “hasCustomDisplayName()”hasCustomDisplayName():
boolean
Defined in: src/models/comment.model.ts:109
Checks if the comment has a custom display name.
Returns
Section titled “Returns”boolean
hasPageParent()
Section titled “hasPageParent()”hasPageParent():
boolean
Defined in: src/models/comment.model.ts:123
Checks if the parent is a page.
Returns
Section titled “Returns”boolean
toJSON()
Section titled “toJSON()”toJSON():
object
Defined in: src/models/base.model.ts:20
Returns the raw validated data as a plain object.
Returns
Section titled “Returns”object
attachments?
Section titled “attachments?”
optionalattachments?:object[]
created_by
Section titled “created_by”created_by: {
avatar_url?:string|null;id:string;name?:string;object:"user";person: {string;email_verified?:boolean; };type:"person"; } | {avatar_url?:string|null;bot: {owner: {type:"workspace";workspace:true; } | {type:"user"; };workspace_id?:string;workspace_limits?: {max_file_upload_size_in_bytes:number; };workspace_name?:string|null; };id:string;name?:string;object:"user";type:"bot"; } | {id:string;object:"user"; } =userSchema
created_time
Section titled “created_time”created_time:
string=notionDateStringSchema
discussion_id
Section titled “discussion_id”discussion_id:
string
display_name?
Section titled “display_name?”
optionaldisplay_name?: {resolved_name:string;type:"user"; } | {resolved_name:string;type:"custom"; }
id:
string
last_edited_time
Section titled “last_edited_time”last_edited_time:
string=notionDateStringSchema
object
Section titled “object”object:
"comment"
parent
Section titled “parent”parent: {
database_id:string;type:"database_id"; } | {data_source_id:string;database_id:string;type:"data_source_id"; } | {page_id:string;type:"page_id"; } | {type:"workspace";workspace:true; } | {block_id:string;type:"block_id"; } | {agent_id:string;type:"agent_id"; } =parentSchema
rich_text
Section titled “rich_text”rich_text: ({
annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };href:string|null;plain_text:string;text: {content:string;link: {url:string; } |null; };type:"text"; } | {annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };href:string|null;mention: {database: {id:string; };type:"database"; } | {date: {end:string|null;start:string;time_zone?:string|null; };type:"date"; } | {link_preview: {url:string; };type:"link_preview"; } | {page: {id:string; };type:"page"; } | {template_mention: {template_mention_date:"today"|"now";type:"template_mention_date"; } | {template_mention_user:"me";type:"template_mention_user"; };type:"template_mention"; } | {type:"user";user: {avatar_url?:string|null;id:string;name?:string;object:"user";person: {string;email_verified?:boolean; };type:"person"; } | {avatar_url?:string|null;bot: {owner: {type: …;workspace: …; } | {type: …; };workspace_id?:string;workspace_limits?: {max_file_upload_size_in_bytes: …; };workspace_name?:string|null; };id:string;name?:string;object:"user";type:"bot"; } | {id:string;object:"user"; }; };plain_text:string;type:"mention"; } | {annotations: {bold:boolean;code:boolean;color:"default"|"blue"|"blue_background"|"brown"|"brown_background"|"gray"|"gray_background"|"green"|"green_background"|"orange"|"orange_background"|"pink"|"pink_background"|"purple"|"purple_background"|"red"|"red_background"|"yellow"|"yellow_background";italic:boolean;strikethrough:boolean;underline:boolean; };equation: {expression:string; };href:string|null;plain_text:string;type:"equation"; })[] =richTextSchema