types

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Object    ObjectType `json:"object"`
	Status    int        `json:"status"`
	Code      string     `json:"code"`
	Message   string     `json:"message"`
	RequestID string     `json:"request_id,omitempty"`
}

APIError is the standard Notion API error response.

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface for APIError.

type Annotations

type Annotations struct {
	Bold          bool  `json:"bold"`
	Italic        bool  `json:"italic"`
	Strikethrough bool  `json:"strikethrough"`
	Underline     bool  `json:"underline"`
	Code          bool  `json:"code"`
	Color         Color `json:"color"`
}

Annotations describes formatting applied to a rich text object.

type Block

type Block struct {
	Object         string    `json:"object"`
	ID             string    `json:"id"`
	Type           BlockType `json:"type"`
	CreatedTime    time.Time `json:"created_time"`
	LastEditedTime time.Time `json:"last_edited_time"`
	CreatedBy      UserRef   `json:"created_by"`
	LastEditedBy   UserRef   `json:"last_edited_by"`
	Parent         Parent    `json:"parent"`
	HasChildren    bool      `json:"has_children"`
	Archived       bool      `json:"archived"`
	InTrash        bool      `json:"in_trash"`

	Paragraph        *ParagraphBlock       `json:"paragraph,omitempty"`
	Heading1         *HeadingBlock         `json:"heading_1,omitempty"`
	Heading2         *HeadingBlock         `json:"heading_2,omitempty"`
	Heading3         *HeadingBlock         `json:"heading_3,omitempty"`
	BulletedListItem *TextBlock            `json:"bulleted_list_item,omitempty"`
	NumberedListItem *TextBlock            `json:"numbered_list_item,omitempty"`
	ToDo             *ToDoBlock            `json:"to_do,omitempty"`
	Toggle           *TextBlock            `json:"toggle,omitempty"`
	Code             *CodeBlock            `json:"code,omitempty"`
	ChildPage        *ChildPageBlock       `json:"child_page,omitempty"`
	ChildDatabase    *ChildDatabaseBlock   `json:"child_database,omitempty"`
	Embed            *EmbedBlock           `json:"embed,omitempty"`
	Image            *MediaBlock           `json:"image,omitempty"`
	Video            *MediaBlock           `json:"video,omitempty"`
	File             *MediaBlock           `json:"file,omitempty"`
	PDF              *MediaBlock           `json:"pdf,omitempty"`
	Audio            *MediaBlock           `json:"audio,omitempty"`
	Bookmark         *BookmarkBlock        `json:"bookmark,omitempty"`
	Callout          *CalloutBlock         `json:"callout,omitempty"`
	Quote            *TextBlock            `json:"quote,omitempty"`
	Divider          *EmptyBlock           `json:"divider,omitempty"`
	TableOfContents  *TableOfContentsBlock `json:"table_of_contents,omitempty"`
	Breadcrumb       *EmptyBlock           `json:"breadcrumb,omitempty"`
	Column           *EmptyBlock           `json:"column,omitempty"`
	ColumnList       *EmptyBlock           `json:"column_list,omitempty"`
	LinkPreview      *LinkPreviewBlock     `json:"link_preview,omitempty"`
	SyncedBlock      *SyncedBlockData      `json:"synced_block,omitempty"`
	Template         *TemplateBlock        `json:"template,omitempty"`
	LinkToPage       *LinkToPageBlock      `json:"link_to_page,omitempty"`
	Table            *TableBlock           `json:"table,omitempty"`
	TableRow         *TableRowBlock        `json:"table_row,omitempty"`
	Equation         *EquationBlock        `json:"equation,omitempty"`
}

Block represents a Notion block object.

type BlockList

type BlockList struct {
	Object     ObjectType `json:"object"`
	Results    []Block    `json:"results"`
	HasMore    bool       `json:"has_more"`
	NextCursor *string    `json:"next_cursor,omitempty"`
}

BlockList is a typed paginated response for blocks.

type BlockType

type BlockType string

BlockType enumerates Notion block types.

const (
	BlockTypeParagraph        BlockType = "paragraph"
	BlockTypeHeading1         BlockType = "heading_1"
	BlockTypeHeading2         BlockType = "heading_2"
	BlockTypeHeading3         BlockType = "heading_3"
	BlockTypeBulletedListItem BlockType = "bulleted_list_item"
	BlockTypeNumberedListItem BlockType = "numbered_list_item"
	BlockTypeToDo             BlockType = "to_do"
	BlockTypeToggle           BlockType = "toggle"
	BlockTypeCode             BlockType = "code"
	BlockTypeChildPage        BlockType = "child_page"
	BlockTypeChildDatabase    BlockType = "child_database"
	BlockTypeEmbed            BlockType = "embed"
	BlockTypeImage            BlockType = "image"
	BlockTypeVideo            BlockType = "video"
	BlockTypeFile             BlockType = "file"
	BlockTypePDF              BlockType = "pdf"
	BlockTypeBookmark         BlockType = "bookmark"
	BlockTypeCallout          BlockType = "callout"
	BlockTypeQuote            BlockType = "quote"
	BlockTypeDivider          BlockType = "divider"
	BlockTypeTableOfContents  BlockType = "table_of_contents"
	BlockTypeBreadcrumb       BlockType = "breadcrumb"
	BlockTypeColumn           BlockType = "column"
	BlockTypeColumnList       BlockType = "column_list"
	BlockTypeLinkPreview      BlockType = "link_preview"
	BlockTypeSyncedBlock      BlockType = "synced_block"
	BlockTypeTemplate         BlockType = "template"
	BlockTypeLinkToPage       BlockType = "link_to_page"
	BlockTypeTable            BlockType = "table"
	BlockTypeTableRow         BlockType = "table_row"
	BlockTypeAudio            BlockType = "audio"
	BlockTypeEquation         BlockType = "equation"
	BlockTypeUnsupported      BlockType = "unsupported"
)

type BookmarkBlock

type BookmarkBlock struct {
	URL     string        `json:"url"`
	Caption RichTextArray `json:"caption,omitempty"`
}

BookmarkBlock holds a bookmarked URL.

type Bot

type Bot struct {
	Owner         BotOwner `json:"owner"`
	WorkspaceID   string   `json:"workspace_id,omitempty"`
	WorkspaceName string   `json:"workspace_name,omitempty"`
}

Bot holds bot-specific user fields.

type BotOwner

type BotOwner struct {
	Type      string `json:"type"`
	Workspace bool   `json:"workspace,omitempty"`
	User      *User  `json:"user,omitempty"`
}

BotOwner identifies who owns a bot.

type CalloutBlock

type CalloutBlock struct {
	RichText RichTextArray `json:"rich_text"`
	Icon     *Icon         `json:"icon,omitempty"`
	Color    Color         `json:"color,omitempty"`
	Children []Block       `json:"children,omitempty"`
}

CalloutBlock holds callout content with an icon.

type CheckboxFilter

type CheckboxFilter struct {
	Equals       *bool `json:"equals,omitempty"`
	DoesNotEqual *bool `json:"does_not_equal,omitempty"`
}

CheckboxFilter conditions for checkbox properties.

type ChildDatabaseBlock

type ChildDatabaseBlock struct {
	Title string `json:"title"`
}

ChildDatabaseBlock references a child database.

type ChildPageBlock

type ChildPageBlock struct {
	Title string `json:"title"`
}

ChildPageBlock references a child page.

type CodeBlock

type CodeBlock struct {
	RichText RichTextArray `json:"rich_text"`
	Caption  RichTextArray `json:"caption,omitempty"`
	Language string        `json:"language"`
}

CodeBlock holds code block content.

type Color

type Color string

Color is a Notion color value.

const (
	ColorDefault          Color = "default"
	ColorGray             Color = "gray"
	ColorBrown            Color = "brown"
	ColorOrange           Color = "orange"
	ColorYellow           Color = "yellow"
	ColorGreen            Color = "green"
	ColorBlue             Color = "blue"
	ColorPurple           Color = "purple"
	ColorPink             Color = "pink"
	ColorRed              Color = "red"
	ColorGrayBackground   Color = "gray_background"
	ColorBrownBackground  Color = "brown_background"
	ColorOrangeBackground Color = "orange_background"
	ColorYellowBackground Color = "yellow_background"
	ColorGreenBackground  Color = "green_background"
	ColorBlueBackground   Color = "blue_background"
	ColorPurpleBackground Color = "purple_background"
	ColorPinkBackground   Color = "pink_background"
	ColorRedBackground    Color = "red_background"
)

type Comment

type Comment struct {
	Object       ObjectType    `json:"object"`
	ID           string        `json:"id"`
	Parent       Parent        `json:"parent"`
	DiscussionID string        `json:"discussion_id"`
	RichText     RichTextArray `json:"rich_text"`
	CreatedTime  time.Time     `json:"created_time"`
	CreatedBy    UserRef       `json:"created_by"`
}

Comment represents a Notion comment object.

type CommentList

type CommentList struct {
	Object     ObjectType `json:"object"`
	Results    []Comment  `json:"results"`
	HasMore    bool       `json:"has_more"`
	NextCursor *string    `json:"next_cursor,omitempty"`
}

CommentList is a typed paginated response for comments.

type Cover

type Cover struct {
	Type     string        `json:"type"`
	File     *InternalFile `json:"file,omitempty"`
	External *ExternalFile `json:"external,omitempty"`
}

Cover represents a page/database cover image.

type DataSource

type DataSource struct {
	Object         ObjectType                `json:"object"`
	ID             string                    `json:"id"`
	Parent         Parent                    `json:"parent"`
	Properties     map[string]PropertySchema `json:"properties"`
	Title          RichTextArray             `json:"title"`
	Description    RichTextArray             `json:"description"`
	Icon           *Icon                     `json:"icon,omitempty"`
	Archived       bool                      `json:"archived"`
	InTrash        bool                      `json:"in_trash"`
	CreatedTime    time.Time                 `json:"created_time"`
	LastEditedTime time.Time                 `json:"last_edited_time"`
	CreatedBy      UserRef                   `json:"created_by"`
	LastEditedBy   UserRef                   `json:"last_edited_by"`
}

DataSource represents a full Notion data source object (API 2025-09-03).

type DataSourceRef

type DataSourceRef struct {
	ID   string `json:"id"`
	Name string `json:"name,omitempty"`
}

DataSourceRef is a lightweight reference in the database's data_sources array.

type Database

type Database struct {
	Object         ObjectType      `json:"object"`
	ID             string          `json:"id"`
	Title          RichTextArray   `json:"title"`
	Description    RichTextArray   `json:"description"`
	CreatedTime    time.Time       `json:"created_time"`
	LastEditedTime time.Time       `json:"last_edited_time"`
	CreatedBy      UserRef         `json:"created_by"`
	LastEditedBy   UserRef         `json:"last_edited_by"`
	Parent         Parent          `json:"parent"`
	DataSources    []DataSourceRef `json:"data_sources,omitempty"`
	IsInline       bool            `json:"is_inline"`
	Archived       bool            `json:"archived"`
	InTrash        bool            `json:"in_trash"`
	IsLocked       bool            `json:"is_locked"`
	URL            string          `json:"url"`
	PublicURL      *string         `json:"public_url,omitempty"`
	Icon           *Icon           `json:"icon,omitempty"`
	Cover          *Cover          `json:"cover,omitempty"`
}

Database represents a Notion database object.

type DateFilter

type DateFilter struct {
	Equals     *string      `json:"equals,omitempty"`
	Before     *string      `json:"before,omitempty"`
	After      *string      `json:"after,omitempty"`
	OnOrBefore *string      `json:"on_or_before,omitempty"`
	OnOrAfter  *string      `json:"on_or_after,omitempty"`
	IsEmpty    *bool        `json:"is_empty,omitempty"`
	IsNotEmpty *bool        `json:"is_not_empty,omitempty"`
	PastWeek   *EmptyObject `json:"past_week,omitempty"`
	PastMonth  *EmptyObject `json:"past_month,omitempty"`
	PastYear   *EmptyObject `json:"past_year,omitempty"`
	NextWeek   *EmptyObject `json:"next_week,omitempty"`
	NextMonth  *EmptyObject `json:"next_month,omitempty"`
	NextYear   *EmptyObject `json:"next_year,omitempty"`
	ThisWeek   *EmptyObject `json:"this_week,omitempty"`
}

DateFilter conditions for date and timestamp properties.

type DateValue

type DateValue struct {
	Start    string  `json:"start"`
	End      *string `json:"end,omitempty"`
	TimeZone *string `json:"time_zone,omitempty"`
}

DateValue represents a Notion date property value.

type EmbedBlock

type EmbedBlock struct {
	URL string `json:"url"`
}

EmbedBlock holds an embed URL.

type EmptyBlock

type EmptyBlock struct{}

EmptyBlock is used for block types with no type-specific fields (divider, breadcrumb, column, column_list).

type EmptyObject

type EmptyObject struct{}

EmptyObject is used for date filter relative conditions (e.g. past_week: {}).

type Equation

type Equation struct {
	Expression string `json:"expression"`
}

Equation holds a LaTeX expression.

type EquationBlock

type EquationBlock struct {
	Expression string `json:"expression"`
}

EquationBlock holds a block-level equation.

type ExternalFile

type ExternalFile struct {
	URL string `json:"url"`
}

ExternalFile is an externally hosted file.

type FileReference

type FileReference struct {
	Name     string        `json:"name"`
	Type     FileType      `json:"type"`
	File     *InternalFile `json:"file,omitempty"`
	External *ExternalFile `json:"external,omitempty"`
}

FileReference represents a file in a files property.

type FileType

type FileType string

FileType enumerates file source types.

const (
	FileTypeFile       FileType = "file"
	FileTypeExternal   FileType = "external"
	FileTypeFileUpload FileType = "file_upload"
)

type FilesFilter

type FilesFilter struct {
	IsEmpty    *bool `json:"is_empty,omitempty"`
	IsNotEmpty *bool `json:"is_not_empty,omitempty"`
}

FilesFilter conditions for files properties.

type Filter

type Filter struct {
	And      []Filter `json:"and,omitempty"`
	Or       []Filter `json:"or,omitempty"`
	Property string   `json:"property,omitempty"`

	RichText    *TextFilter     `json:"rich_text,omitempty"`
	Title       *TextFilter     `json:"title,omitempty"`
	Number      *NumberFilter   `json:"number,omitempty"`
	Checkbox    *CheckboxFilter `json:"checkbox,omitempty"`
	Select      *SelectFilter   `json:"select,omitempty"`
	MultiSelect *SelectFilter   `json:"multi_select,omitempty"`
	Status      *SelectFilter   `json:"status,omitempty"`
	Date        *DateFilter     `json:"date,omitempty"`
	People      *PeopleFilter   `json:"people,omitempty"`
	Files       *FilesFilter    `json:"files,omitempty"`
	Relation    *RelationFilter `json:"relation,omitempty"`
	Formula     *FormulaFilter  `json:"formula,omitempty"`
	Rollup      *RollupFilter   `json:"rollup,omitempty"`
	Timestamp   *DateFilter     `json:"timestamp,omitempty"`
	ID          *NumberFilter   `json:"id,omitempty"`
}

Filter is a compound or property filter for database/data source queries. Use And/Or for compound filters, or set Property + condition for a single filter.

type FormulaFilter

type FormulaFilter struct {
	String   *TextFilter     `json:"string,omitempty"`
	Number   *NumberFilter   `json:"number,omitempty"`
	Checkbox *CheckboxFilter `json:"checkbox,omitempty"`
	Date     *DateFilter     `json:"date,omitempty"`
}

FormulaFilter delegates to the appropriate condition type based on formula result.

type FormulaSchemaConfig

type FormulaSchemaConfig struct {
	Expression string `json:"expression"`
}

FormulaSchemaConfig holds the expression for a formula property.

type FormulaValue

type FormulaValue struct {
	Type    string     `json:"type"`
	String  *string    `json:"string,omitempty"`
	Number  *float64   `json:"number,omitempty"`
	Boolean *bool      `json:"boolean,omitempty"`
	Date    *DateValue `json:"date,omitempty"`
}

FormulaValue holds the result of a formula property.

type HeadingBlock

type HeadingBlock struct {
	RichText     RichTextArray `json:"rich_text"`
	Color        Color         `json:"color,omitempty"`
	IsToggleable bool          `json:"is_toggleable"`
	Children     []Block       `json:"children,omitempty"`
}

HeadingBlock holds heading content (heading_1, heading_2, heading_3).

type IDRef

type IDRef struct {
	ID string `json:"id"`
}

IDRef is a generic object reference by ID.

type Icon

type Icon struct {
	Type     string        `json:"type"`
	Emoji    *string       `json:"emoji,omitempty"`
	File     *InternalFile `json:"file,omitempty"`
	External *ExternalFile `json:"external,omitempty"`
}

Icon represents a page/database icon — either an emoji or a file.

type InternalFile

type InternalFile struct {
	URL        string     `json:"url"`
	ExpiryTime *time.Time `json:"expiry_time,omitempty"`
}

InternalFile is a Notion-hosted file with an expiring URL.

type Link struct {
	URL string `json:"url"`
}

Link represents a URL link within rich text.

type LinkPreview

type LinkPreview struct {
	URL string `json:"url"`
}

LinkPreview holds the URL for a link_preview mention.

type LinkPreviewBlock

type LinkPreviewBlock struct {
	URL string `json:"url"`
}

LinkPreviewBlock holds a link preview URL.

type LinkToPageBlock

type LinkToPageBlock struct {
	Type       string `json:"type"`
	PageID     string `json:"page_id,omitempty"`
	DatabaseID string `json:"database_id,omitempty"`
}

LinkToPageBlock references another page or database.

type MediaBlock

type MediaBlock struct {
	Type     FileType      `json:"type"`
	Caption  RichTextArray `json:"caption,omitempty"`
	File     *InternalFile `json:"file,omitempty"`
	External *ExternalFile `json:"external,omitempty"`
}

MediaBlock represents image, video, file, pdf, and audio blocks.

type Mention

type Mention struct {
	Type        MentionType  `json:"type"`
	User        *UserRef     `json:"user,omitempty"`
	Page        *IDRef       `json:"page,omitempty"`
	Database    *IDRef       `json:"database,omitempty"`
	Date        *DateValue   `json:"date,omitempty"`
	LinkPreview *LinkPreview `json:"link_preview,omitempty"`
}

Mention represents a mention within rich text.

type MentionType

type MentionType string

MentionType enumerates mention types.

const (
	MentionTypeUser        MentionType = "user"
	MentionTypePage        MentionType = "page"
	MentionTypeDatabase    MentionType = "database"
	MentionTypeDate        MentionType = "date"
	MentionTypeLinkPreview MentionType = "link_preview"
)

type NumberFilter

type NumberFilter struct {
	Equals               *float64 `json:"equals,omitempty"`
	DoesNotEqual         *float64 `json:"does_not_equal,omitempty"`
	GreaterThan          *float64 `json:"greater_than,omitempty"`
	GreaterThanOrEqualTo *float64 `json:"greater_than_or_equal_to,omitempty"`
	LessThan             *float64 `json:"less_than,omitempty"`
	LessThanOrEqualTo    *float64 `json:"less_than_or_equal_to,omitempty"`
	IsEmpty              *bool    `json:"is_empty,omitempty"`
	IsNotEmpty           *bool    `json:"is_not_empty,omitempty"`
}

NumberFilter conditions for number and ID properties.

type NumberSchemaConfig

type NumberSchemaConfig struct {
	Format string `json:"format"`
}

NumberSchemaConfig holds the format for a number property.

type ObjectType

type ObjectType string

ObjectType enumerates Notion object types.

const (
	ObjectTypePage       ObjectType = "page"
	ObjectTypeDatabase   ObjectType = "database"
	ObjectTypeBlock      ObjectType = "block"
	ObjectTypeUser       ObjectType = "user"
	ObjectTypeComment    ObjectType = "comment"
	ObjectTypeDataSource ObjectType = "data_source"
	ObjectTypeList       ObjectType = "list"
	ObjectTypeError      ObjectType = "error"
)

type Page

type Page struct {
	Object         ObjectType               `json:"object"`
	ID             string                   `json:"id"`
	CreatedTime    time.Time                `json:"created_time"`
	LastEditedTime time.Time                `json:"last_edited_time"`
	CreatedBy      UserRef                  `json:"created_by"`
	LastEditedBy   UserRef                  `json:"last_edited_by"`
	Parent         Parent                   `json:"parent"`
	Archived       bool                     `json:"archived"`
	InTrash        bool                     `json:"in_trash"`
	IsLocked       bool                     `json:"is_locked"`
	URL            string                   `json:"url"`
	PublicURL      *string                  `json:"public_url,omitempty"`
	Icon           *Icon                    `json:"icon,omitempty"`
	Cover          *Cover                   `json:"cover,omitempty"`
	Properties     map[string]PropertyValue `json:"properties"`
}

Page represents a Notion page object.

type PageList

type PageList struct {
	Object     ObjectType `json:"object"`
	Results    []Page     `json:"results"`
	HasMore    bool       `json:"has_more"`
	NextCursor *string    `json:"next_cursor,omitempty"`
}

PageList is a typed paginated response for pages.

type PaginatedList

type PaginatedList struct {
	Object     ObjectType    `json:"object"`
	Results    []interface{} `json:"results"`
	HasMore    bool          `json:"has_more"`
	NextCursor *string       `json:"next_cursor,omitempty"`
	Type       string        `json:"type,omitempty"`
}

PaginatedList is the standard paginated response from list endpoints.

type ParagraphBlock

type ParagraphBlock struct {
	RichText RichTextArray `json:"rich_text"`
	Color    Color         `json:"color,omitempty"`
	Children []Block       `json:"children,omitempty"`
}

ParagraphBlock holds paragraph content.

type Parent

type Parent struct {
	Type         string `json:"type"`
	PageID       string `json:"page_id,omitempty"`
	DatabaseID   string `json:"database_id,omitempty"`
	DataSourceID string `json:"data_source_id,omitempty"`
	BlockID      string `json:"block_id,omitempty"`
	Workspace    bool   `json:"workspace,omitempty"`
}

Parent identifies the parent of a page, block, or comment.

type PeopleFilter

type PeopleFilter struct {
	Contains       *string `json:"contains,omitempty"`
	DoesNotContain *string `json:"does_not_contain,omitempty"`
	IsEmpty        *bool   `json:"is_empty,omitempty"`
	IsNotEmpty     *bool   `json:"is_not_empty,omitempty"`
}

PeopleFilter conditions for people properties.

type Person

type Person struct {
	Email string `json:"email"`
}

Person holds person-specific user fields.

type PropertySchema

type PropertySchema struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Type        PropertyType `json:"type"`
	Description string       `json:"description,omitempty"`

	Number      *NumberSchemaConfig   `json:"number,omitempty"`
	Select      *SelectSchemaConfig   `json:"select,omitempty"`
	MultiSelect *SelectSchemaConfig   `json:"multi_select,omitempty"`
	Status      *StatusSchemaConfig   `json:"status,omitempty"`
	Formula     *FormulaSchemaConfig  `json:"formula,omitempty"`
	Relation    *RelationSchemaConfig `json:"relation,omitempty"`
	Rollup      *RollupSchemaConfig   `json:"rollup,omitempty"`
}

PropertySchema defines a property in a database/data source schema.

type PropertyType

type PropertyType string

PropertyType enumerates Notion property types.

const (
	PropertyTypeTitle          PropertyType = "title"
	PropertyTypeRichText       PropertyType = "rich_text"
	PropertyTypeNumber         PropertyType = "number"
	PropertyTypeSelect         PropertyType = "select"
	PropertyTypeMultiSelect    PropertyType = "multi_select"
	PropertyTypeStatus         PropertyType = "status"
	PropertyTypeDate           PropertyType = "date"
	PropertyTypePeople         PropertyType = "people"
	PropertyTypeFiles          PropertyType = "files"
	PropertyTypeCheckbox       PropertyType = "checkbox"
	PropertyTypeURL            PropertyType = "url"
	PropertyTypeEmail          PropertyType = "email"
	PropertyTypePhoneNumber    PropertyType = "phone_number"
	PropertyTypeFormula        PropertyType = "formula"
	PropertyTypeRelation       PropertyType = "relation"
	PropertyTypeRollup         PropertyType = "rollup"
	PropertyTypeCreatedTime    PropertyType = "created_time"
	PropertyTypeCreatedBy      PropertyType = "created_by"
	PropertyTypeLastEditedTime PropertyType = "last_edited_time"
	PropertyTypeLastEditedBy   PropertyType = "last_edited_by"
	PropertyTypeUniqueID       PropertyType = "unique_id"
)

type PropertyValue

type PropertyValue struct {
	ID   string       `json:"id"`
	Type PropertyType `json:"type"`

	Title          RichTextArray   `json:"title,omitempty"`
	RichText       RichTextArray   `json:"rich_text,omitempty"`
	Number         *float64        `json:"number,omitempty"`
	Select         *SelectOption   `json:"select,omitempty"`
	MultiSelect    []SelectOption  `json:"multi_select,omitempty"`
	Status         *SelectOption   `json:"status,omitempty"`
	Date           *DateValue      `json:"date,omitempty"`
	People         []User          `json:"people,omitempty"`
	Files          []FileReference `json:"files,omitempty"`
	Checkbox       *bool           `json:"checkbox,omitempty"`
	URL            *string         `json:"url,omitempty"`
	Email          *string         `json:"email,omitempty"`
	PhoneNumber    *string         `json:"phone_number,omitempty"`
	Formula        *FormulaValue   `json:"formula,omitempty"`
	Relation       []RelationItem  `json:"relation,omitempty"`
	Rollup         *RollupValue    `json:"rollup,omitempty"`
	CreatedTime    *time.Time      `json:"created_time,omitempty"`
	CreatedBy      *User           `json:"created_by,omitempty"`
	LastEditedTime *time.Time      `json:"last_edited_time,omitempty"`
	LastEditedBy   *User           `json:"last_edited_by,omitempty"`
	UniqueID       *UniqueIDValue  `json:"unique_id,omitempty"`
	HasMore        bool            `json:"has_more,omitempty"`
}

PropertyValue is a property value as returned by the Notion API on page objects. Only the field matching Type is populated.

type QueryRequest

type QueryRequest struct {
	Filter           *Filter  `json:"filter,omitempty"`
	Sorts            []Sort   `json:"sorts,omitempty"`
	StartCursor      string   `json:"start_cursor,omitempty"`
	PageSize         int      `json:"page_size,omitempty"`
	Archived         *bool    `json:"archived,omitempty"`
	InTrash          *bool    `json:"in_trash,omitempty"`
	ResultType       string   `json:"result_type,omitempty"`
	FilterProperties []string `json:"filter_properties,omitempty"`
}

QueryRequest is the request body for POST /v1/data_sources/{id}/query.

type RelationFilter

type RelationFilter struct {
	Contains       *string `json:"contains,omitempty"`
	DoesNotContain *string `json:"does_not_contain,omitempty"`
	IsEmpty        *bool   `json:"is_empty,omitempty"`
	IsNotEmpty     *bool   `json:"is_not_empty,omitempty"`
}

RelationFilter conditions for relation properties.

type RelationItem

type RelationItem struct {
	ID string `json:"id"`
}

RelationItem is a reference to a related page.

type RelationSchemaConfig

type RelationSchemaConfig struct {
	DatabaseID         string `json:"database_id"`
	Type               string `json:"type"`
	SyncedPropertyName string `json:"synced_property_name,omitempty"`
	SyncedPropertyID   string `json:"synced_property_id,omitempty"`
}

RelationSchemaConfig configures a relation property.

type RichText

type RichText struct {
	Type        RichTextType `json:"type"`
	PlainText   string       `json:"plain_text"`
	Href        *string      `json:"href,omitempty"`
	Annotations *Annotations `json:"annotations,omitempty"`
	Text        *TextContent `json:"text,omitempty"`
	Mention     *Mention     `json:"mention,omitempty"`
	Equation    *Equation    `json:"equation,omitempty"`
}

RichText represents a rich text object in the Notion API.

type RichTextArray

type RichTextArray []RichText

RichTextArray is a slice of RichText objects used throughout the Notion API.

func (RichTextArray) PlainText

func (rta RichTextArray) PlainText() string

PlainText extracts concatenated plain text from a RichTextArray.

type RichTextType

type RichTextType string

RichTextType enumerates rich text object types.

const (
	RichTextTypeText     RichTextType = "text"
	RichTextTypeMention  RichTextType = "mention"
	RichTextTypeEquation RichTextType = "equation"
)

type RollupFilter

type RollupFilter struct {
	Any    *Filter       `json:"any,omitempty"`
	Every  *Filter       `json:"every,omitempty"`
	None   *Filter       `json:"none,omitempty"`
	String *TextFilter   `json:"string,omitempty"`
	Number *NumberFilter `json:"number,omitempty"`
	Date   *DateFilter   `json:"date,omitempty"`
}

RollupFilter delegates to the appropriate condition type or aggregation.

type RollupSchemaConfig

type RollupSchemaConfig struct {
	RelationPropertyName string `json:"relation_property_name"`
	RelationPropertyID   string `json:"relation_property_id"`
	RollupPropertyName   string `json:"rollup_property_name"`
	RollupPropertyID     string `json:"rollup_property_id"`
	Function             string `json:"function"`
}

RollupSchemaConfig configures a rollup property.

type RollupValue

type RollupValue struct {
	Type     string          `json:"type"`
	Function string          `json:"function"`
	String   *string         `json:"string,omitempty"`
	Number   *float64        `json:"number,omitempty"`
	Date     *DateValue      `json:"date,omitempty"`
	Array    []PropertyValue `json:"array,omitempty"`
}

RollupValue holds the result of a rollup property.

type SearchFilter

type SearchFilter struct {
	Property string `json:"property"`
	Value    string `json:"value"`
}

SearchFilter narrows search results to pages or data sources.

type SearchRequest

type SearchRequest struct {
	Query       string        `json:"query,omitempty"`
	Filter      *SearchFilter `json:"filter,omitempty"`
	Sort        *SearchSort   `json:"sort,omitempty"`
	StartCursor string        `json:"start_cursor,omitempty"`
	PageSize    int           `json:"page_size,omitempty"`
}

SearchRequest is the request body for POST /v1/search.

type SearchResult

type SearchResult struct {
	Object     ObjectType    `json:"object"`
	Results    []interface{} `json:"results"`
	HasMore    bool          `json:"has_more"`
	NextCursor *string       `json:"next_cursor,omitempty"`
}

SearchResult wraps a search API response. Results can be pages or data sources.

type SearchSort

type SearchSort struct {
	Timestamp string `json:"timestamp"`
	Direction string `json:"direction"`
}

SearchSort specifies sort for search results.

type SelectFilter

type SelectFilter struct {
	Equals         *string `json:"equals,omitempty"`
	DoesNotEqual   *string `json:"does_not_equal,omitempty"`
	Contains       *string `json:"contains,omitempty"`
	DoesNotContain *string `json:"does_not_contain,omitempty"`
	IsEmpty        *bool   `json:"is_empty,omitempty"`
	IsNotEmpty     *bool   `json:"is_not_empty,omitempty"`
}

SelectFilter conditions for select, multi_select, and status properties.

type SelectOption

type SelectOption struct {
	ID    string `json:"id,omitempty"`
	Name  string `json:"name"`
	Color Color  `json:"color,omitempty"`
}

SelectOption represents a select or multi_select option.

type SelectSchemaConfig

type SelectSchemaConfig struct {
	Options []SelectOption `json:"options"`
}

SelectSchemaConfig holds options for select/multi_select properties.

type Sort

type Sort struct {
	Property  string        `json:"property,omitempty"`
	Timestamp SortTimestamp `json:"timestamp,omitempty"`
	Direction SortDirection `json:"direction"`
}

Sort specifies a sort order for database/data source queries.

type SortDirection

type SortDirection string

SortDirection specifies ascending or descending order.

const (
	SortDirectionAscending  SortDirection = "ascending"
	SortDirectionDescending SortDirection = "descending"
)

type SortTimestamp

type SortTimestamp string

SortTimestamp identifies the timestamp field to sort by.

const (
	SortTimestampCreatedTime    SortTimestamp = "created_time"
	SortTimestampLastEditedTime SortTimestamp = "last_edited_time"
)

type StatusGroup

type StatusGroup struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	Color     Color    `json:"color"`
	OptionIDs []string `json:"option_ids"`
}

StatusGroup groups status options together.

type StatusSchemaConfig

type StatusSchemaConfig struct {
	Options []SelectOption `json:"options"`
	Groups  []StatusGroup  `json:"groups"`
}

StatusSchemaConfig holds options and groups for status properties.

type SyncedBlockData

type SyncedBlockData struct {
	SyncedFrom *SyncedFrom `json:"synced_from"`
	Children   []Block     `json:"children,omitempty"`
}

SyncedBlockData holds synced block data.

type SyncedFrom

type SyncedFrom struct {
	BlockID string `json:"block_id"`
}

SyncedFrom references the original synced block.

type TableBlock

type TableBlock struct {
	TableWidth      int     `json:"table_width"`
	HasColumnHeader bool    `json:"has_column_header"`
	HasRowHeader    bool    `json:"has_row_header"`
	Children        []Block `json:"children,omitempty"`
}

TableBlock holds table configuration.

type TableOfContentsBlock

type TableOfContentsBlock struct {
	Color Color `json:"color,omitempty"`
}

TableOfContentsBlock holds table of contents styling.

type TableRowBlock

type TableRowBlock struct {
	Cells []RichTextArray `json:"cells"`
}

TableRowBlock holds cells for a table row.

type TemplateBlock

type TemplateBlock struct {
	RichText RichTextArray `json:"rich_text"`
	Children []Block       `json:"children,omitempty"`
}

TemplateBlock holds template block content (deprecated).

type TextBlock

type TextBlock struct {
	RichText RichTextArray `json:"rich_text"`
	Color    Color         `json:"color,omitempty"`
	Children []Block       `json:"children,omitempty"`
}

TextBlock is used for block types with rich_text, color, and optional children (bulleted_list_item, numbered_list_item, toggle, quote).

type TextContent

type TextContent struct {
	Content string `json:"content"`
	Link    *Link  `json:"link,omitempty"`
}

TextContent holds the content of a text-type rich text object.

type TextFilter

type TextFilter struct {
	Equals         *string `json:"equals,omitempty"`
	DoesNotEqual   *string `json:"does_not_equal,omitempty"`
	Contains       *string `json:"contains,omitempty"`
	DoesNotContain *string `json:"does_not_contain,omitempty"`
	StartsWith     *string `json:"starts_with,omitempty"`
	EndsWith       *string `json:"ends_with,omitempty"`
	IsEmpty        *bool   `json:"is_empty,omitempty"`
	IsNotEmpty     *bool   `json:"is_not_empty,omitempty"`
}

TextFilter conditions for rich_text and title properties.

type ToDoBlock

type ToDoBlock struct {
	RichText RichTextArray `json:"rich_text"`
	Checked  bool          `json:"checked"`
	Color    Color         `json:"color,omitempty"`
	Children []Block       `json:"children,omitempty"`
}

ToDoBlock holds to-do content.

type UniqueIDValue

type UniqueIDValue struct {
	Prefix *string `json:"prefix,omitempty"`
	Number int     `json:"number"`
}

UniqueIDValue holds the auto-generated unique ID for a page.

type User

type User struct {
	Object    ObjectType `json:"object"`
	ID        string     `json:"id"`
	Type      string     `json:"type,omitempty"`
	Name      string     `json:"name,omitempty"`
	AvatarURL *string    `json:"avatar_url,omitempty"`
	Person    *Person    `json:"person,omitempty"`
	Bot       *Bot       `json:"bot,omitempty"`
}

User represents a Notion user object.

type UserList

type UserList struct {
	Object     ObjectType `json:"object"`
	Results    []User     `json:"results"`
	HasMore    bool       `json:"has_more"`
	NextCursor *string    `json:"next_cursor,omitempty"`
}

UserList is a typed paginated response for users.

type UserRef

type UserRef struct {
	Object string `json:"object"`
	ID     string `json:"id"`
}

UserRef is a lightweight user reference (id only).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL