notion

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2025 License: BSD-2-Clause Imports: 13 Imported by: 0

README

Notion SDK for Go

A simple and feature-rich Go client for the Notion API


👋 This project is a hard fork of jomei/notionapi, focusing on introducing new features, breaking changes, and enhanced API coverage.

GitHub tag (latest) Go Reference Test

Supported APIs

It supports all APIs of the Notion API version 2022-06-28.

Installation

go get github.com/amberpixels/notion-sdk-go

Usage

First, please follow the Getting Started Guide to obtain an integration token.

Initialization

Import this library and initialize the API client using the obtained integration token.

import "github.com/amberpixels/notion-sdk-go"

client := notion.NewClient("your_integration_token")

Calling the API

You can use the methods of the initialized client to call the Notion API. Here is an example of how to retrieve a page:

page, err := client.Page.Get(context.Background(), "your_page_id")
if err != nil {
    // Handle the error
}

Documentation

Overview

Package notion provides a simple and feature-rich Go client for the Notion API.

Index

Constants

View Source
const EmojiTypeEmoji = "emoji"

EmojiTypeEmoji is hardcoded const type for any Emoji

View Source
const EmptyCursor = ""

EmptyCursor is a constant for empty cursor.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError added in v0.0.3

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

APIError is a type for Notion API errors.

func (*APIError) Error added in v0.0.3

func (e *APIError) Error() string

Error implements the error interface.

type AndCompoundFilter

type AndCompoundFilter []Filter

AndCompoundFilter is a type for `and` compound filters.

func (AndCompoundFilter) MarshalJSON

func (f AndCompoundFilter) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshalling for AndCompoundFilter and OrCompoundFilter

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 is a set of annotations for RichText

type Appearance added in v0.0.3

type Appearance interface {
	// GetIcon returns the Icon of the Appearance.
	GetIcon() *Icon

	// GetCover returns the Cover of the Appearance.
	GetCover() *File
}

Appearance is an interface for Blocks that can have an icon and/or a cover.

type AppendBlockChildrenRequest

type AppendBlockChildrenRequest struct {
	// Append new children after a specific block. If empty, new children with be appended to the bottom of the parent block.
	After BlockID `json:"after,omitempty"`
	// Child content to append to a container block as an array of block objects.
	Children Blocks `json:"children"`
}

AppendBlockChildrenRequest is a type for append block children request.

type AppendBlockChildrenResponse

type AppendBlockChildrenResponse struct {
	Object  ObjectType `json:"object"`
	Results []Block    `json:"results"`
}

AppendBlockChildrenResponse is a type for append block children response.

func (*AppendBlockChildrenResponse) UnmarshalJSON

func (r *AppendBlockChildrenResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON does custom unmarshalling for AppendBlockChildrenResponse

type AtomAppearance added in v0.0.3

type AtomAppearance struct {
	Icon  *Icon `json:"icon,omitempty"`
	Cover *File `json:"cover,omitempty"`
}

AtomAppearance is a container for the shared fields of the base Notion objects.

func (AtomAppearance) GetCover added in v0.0.3

func (a AtomAppearance) GetCover() *File

GetCover returns the Cover of the AtomAppearance.

func (AtomAppearance) GetIcon added in v0.0.3

func (a AtomAppearance) GetIcon() *Icon

GetIcon returns the Icon of the AtomAppearance.

type AtomArchived added in v0.0.3

type AtomArchived struct {
	Archived bool `json:"archived"`
	InTrash  bool `json:"in_trash"`
}

AtomArchived stands for Archived + InTrash

func (AtomArchived) GetArchived added in v0.0.3

func (a AtomArchived) GetArchived() bool

GetArchived returns the Archived bool of the AtomArchived.

func (AtomArchived) GetInTrash added in v0.0.3

func (a AtomArchived) GetInTrash() bool

GetInTrash returns the InTrash bool of the AtomArchived.

type AtomChildren added in v0.0.3

type AtomChildren struct {
	Children Blocks `json:"children"`
}

AtomChildren stands for atom that holds children.

func (*AtomChildren) AppendChildren added in v0.0.3

func (a *AtomChildren) AppendChildren(c ...Block)

AppendChildren appends the children of the AtomChildren.

func (AtomChildren) ChildCount added in v0.0.3

func (a AtomChildren) ChildCount() int

ChildCount returns the number

func (AtomChildren) GetChildren added in v0.0.3

func (a AtomChildren) GetChildren() Blocks

GetChildren returns the children of the AtomChildren.

func (*AtomChildren) SetChildren added in v0.0.3

func (a *AtomChildren) SetChildren(c Blocks)

SetChildren sets the children of the AtomChildren.

type AtomCreated added in v0.0.3

type AtomCreated struct {
	CreatedTime *time.Time `json:"created_time,omitempty"`
	CreatedBy   *User      `json:"created_by,omitempty"`
}

AtomCreated stands for CreatedTime + CreatedBy fields

func (AtomCreated) GetCreatedBy added in v0.0.3

func (a AtomCreated) GetCreatedBy() *User

GetCreatedBy returns the CreatedBy of the AtomCreated.

func (AtomCreated) GetCreatedTime added in v0.0.3

func (a AtomCreated) GetCreatedTime() *time.Time

GetCreatedTime returns the CreatedTime of the AtomCreated.

type AtomID added in v0.0.3

type AtomID struct {
	ID ObjectID `json:"id,omitempty"`
}

AtomID stands for ID + Parent reference

func (AtomID) GetID added in v0.0.3

func (a AtomID) GetID() ObjectID

GetID returns the ID of the AtomID.

type AtomLastEdited added in v0.0.3

type AtomLastEdited struct {
	LastEditedTime *time.Time `json:"last_edited_time"`
	LastEditedBy   *User      `json:"last_edited_by"`
}

AtomLastEdited stands for atom that holds Notion's last edited time and by.

func (AtomLastEdited) GetLastEditedBy added in v0.0.3

func (a AtomLastEdited) GetLastEditedBy() *User

GetLastEditedBy returns the LastEditedBy of the AtomLastEdited.

func (AtomLastEdited) GetLastEditedTime added in v0.0.3

func (a AtomLastEdited) GetLastEditedTime() *time.Time

GetLastEditedTime returns the LastEditedTime of the AtomLastEdited.

type AtomNoChildren added in v0.0.3

type AtomNoChildren struct{}

AtomNoChildren should be embedded in all blocks that do not have children.

func (AtomNoChildren) AppendChildren added in v0.0.3

func (AtomNoChildren) AppendChildren(...Block)

AppendChildren panics for the AtomNoChildren.

func (AtomNoChildren) ChildCount added in v0.0.3

func (AtomNoChildren) ChildCount() int

ChildCount returns 0 for the AtomNoChildren.

func (AtomNoChildren) GetChildren added in v0.0.3

func (AtomNoChildren) GetChildren() Blocks

GetChildren returns nil for the AtomNoChildren.

func (AtomNoChildren) SetChildren added in v0.0.3

func (AtomNoChildren) SetChildren(Blocks)

SetChildren panics for the AtomNoChildren.

type AtomObject added in v0.0.3

type AtomObject struct {
	Object ObjectType `json:"object"`
}

AtomObject stands for atom that holds object (ObjctType).

func (AtomObject) GetObject added in v0.0.3

func (b AtomObject) GetObject() ObjectType

GetObject returns the object (ObjectType) of the AtomObject.

type AtomPaginatedResponse added in v0.0.3

type AtomPaginatedResponse struct {
	Object     ObjectType `json:"object"`
	NextCursor Cursor     `json:"next_cursor"`
	HasMore    bool       `json:"has_more"`
}

AtomPaginatedResponse is embedded in all paginated responses.

type AtomParent added in v0.0.3

type AtomParent struct {
	Parent Parent `json:"parent"`
}

AtomParent stands for atom that holds Notion's parent object.

func (AtomParent) GetParent added in v0.0.3

func (a AtomParent) GetParent() Parent

GetParent returns the parent of the AtomParent.

type AtomProperties added in v0.0.3

type AtomProperties struct {
	Properties Properties `json:"properties"`
}

AtomProperties stands for atom that holds Notion's properties.

func (AtomProperties) GetProperties added in v0.0.3

func (a AtomProperties) GetProperties() Properties

GetProperties returns the properties of the AtomProperties.

type AtomURLs added in v0.0.3

type AtomURLs struct {
	URL       string `json:"url"`
	PublicURL string `json:"public_url"`
}

AtomURLs stands for atom that holds Notion's URLs.

func (AtomURLs) GetPublicURL added in v0.0.3

func (a AtomURLs) GetPublicURL() string

GetPublicURL returns the PublicURL of the AtomURLs.

func (AtomURLs) GetURL added in v0.0.3

func (a AtomURLs) GetURL() string

GetURL returns the URL of the AtomURLs.

type AudioBlock

type AudioBlock struct {
	BasicBlock
	Audio File `json:"audio"`
}

AudioBlock is a Notion block for audio files

func NewAudioBlock

func NewAudioBlock(audio File) *AudioBlock

NewAudioBlock creates a new AudioBlock

func (*AudioBlock) GetExpiryTime added in v0.0.3

func (b *AudioBlock) GetExpiryTime() *time.Time

GetExpiryTime implements Media interface for AudioBlock

func (*AudioBlock) GetURL added in v0.0.3

func (b *AudioBlock) GetURL() string

GetURL implements Media interface for AudioBlock

func (*AudioBlock) SetBasicBlock added in v0.0.3

func (b *AudioBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type AuthenticationService

type AuthenticationService struct {
	// contains filtered or unexported fields
}

AuthenticationService is a service for Notion Authentication API.

func (*AuthenticationService) CreateToken

CreateToken creates an access token that a third-party service can use to authenticate with Notion.

See https://developers.notion.com/reference/create-a-token

type BasicBlock

type BasicBlock struct {
	AtomID
	AtomParent
	AtomObject
	AtomCreated
	AtomLastEdited
	AtomArchived
	AtomAppearance

	// blocks by default have NO children unless it's specified on the custom block implementation
	AtomNoChildren

	Type        BlockType `json:"type"`
	HasChildren bool      `json:"has_children,omitempty"`
}

BasicBlock defines the common fields of all Notion block types. See https://developers.notion.com/reference/block for the list. BasicBlock implements the Block interface.

func NewBasicBlock

func NewBasicBlock(blockType BlockType, hasChildrenArg ...bool) BasicBlock

NewBasicBlock returns a new BasicBlock with the ObjectTypeBlock and given block type. It's used as a basic block for all other blocks.

func (BasicBlock) GetBasicBlock added in v0.0.3

func (b BasicBlock) GetBasicBlock() BasicBlock

GetBasicBlock returns the BasicBlock (itself).

func (BasicBlock) GetHasChildren

func (b BasicBlock) GetHasChildren() bool

GetHasChildren returns the HasChildren of the BasicBlock.

func (BasicBlock) GetObject

func (b BasicBlock) GetObject() ObjectType

GetObject returns the ObjectType of the BasicBlock. Always returns ObjectTypeBlock.

func (BasicBlock) GetType

func (b BasicBlock) GetType() BlockType

GetType returns the Type of the BasicBlock.

type BasicBlockHolder added in v0.0.3

type BasicBlockHolder interface {
	GetBasicBlock() BasicBlock
	SetBasicBlock(BasicBlock) Block
}

BasicBlockHolder is a block that can handle its GetBasicBlock It's not supposed to be widely used, but it's useful for testing, and other tasks where you need reflect-type Block access

type Block

type Block interface {
	Object // Every block is an Object by default

	GetID() BlockID
	GetParent() Parent
	GetType() BlockType

	GetCreatedTime() *time.Time
	GetCreatedBy() *User

	GetLastEditedTime() *time.Time
	GetLastEditedBy() *User

	GetArchived() bool
	GetInTrash() bool

	GetHasChildren() bool
}

Block is a general interface for ALL types of notion Blocks.

func NewHeadingBlock

func NewHeadingBlock(heading Heading, level int) Block

NewHeadingBlock returns a new Heading[1-3]Block (hidden below Block interface) corresponding to the given heading level. It defaults to Heading 3 if the given level is not supported.

type BlockID

type BlockID = ObjectID

BlockID stands for ID of Block object. As Block is an Object, then BlockID is just an alias for Object

type BlockType

type BlockType string

BlockType is a type of a Notion block.

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"
	BlockTypeChildPage     BlockType = "child_page"
	BlockTypeChildDatabase BlockType = "child_database"

	BlockTypeEmbed           BlockType = "embed"
	BlockTypeImage           BlockType = "image"
	BlockTypeAudio           BlockType = "audio"
	BlockTypeVideo           BlockType = "video"
	BlockTypeFile            BlockType = "file"
	BlockTypePdf             BlockType = "pdf"
	BlockTypeBookmark        BlockType = "bookmark"
	BlockTypeCode            BlockType = "code"
	BlockTypeDivider         BlockType = "divider"
	BlockTypeCallout         BlockType = "callout"
	BlockTypeQuote           BlockType = "quote"
	BlockTypeTableOfContents BlockType = "table_of_contents"
	BlockTypeEquation        BlockType = "equation"
	BlockTypeBreadcrumb      BlockType = "breadcrumb"
	BlockTypeColumn          BlockType = "column"
	BlockTypeColumnList      BlockType = "column_list"
	BlockTypeLinkPreview     BlockType = "link_preview"
	BlockTypeLinkToPage      BlockType = "link_to_page"
	BlockTypeSyncedBlock     BlockType = "synced_block"
	BlockTypeTable           BlockType = "table"
	BlockTypeTableRow        BlockType = "table_row"
	BlockTypeUnsupported     BlockType = "unsupported"
)

See https://developers.notion.com/reference/block nolint:revive

const (
	// BlockTypeTemplate is a block type for template blocks.
	// Deprecated
	// See https://developers.notion.com/reference/block#template
	BlockTypeTemplate BlockType = "template"
)

func (BlockType) String

func (bt BlockType) String() string

type BlockUpdateRequest

type BlockUpdateRequest struct {
	Paragraph        *Paragraph `json:"paragraph,omitempty"`
	Heading1         *Heading   `json:"heading_1,omitempty"`
	Heading2         *Heading   `json:"heading_2,omitempty"`
	Heading3         *Heading   `json:"heading_3,omitempty"`
	BulletedListItem *ListItem  `json:"bulleted_list_item,omitempty"`
	NumberedListItem *ListItem  `json:"numbered_list_item,omitempty"`
	Code             *Code      `json:"code,omitempty"`
	ToDo             *ToDo      `json:"to_do,omitempty"`
	Toggle           *Toggle    `json:"toggle,omitempty"`
	Embed            *Embed     `json:"embed,omitempty"`
	Image            *File      `json:"image,omitempty"`
	Video            *File      `json:"video,omitempty"`
	File             *File      `json:"file,omitempty"`
	Pdf              *File      `json:"pdf,omitempty"`
	Bookmark         *Bookmark  `json:"bookmark,omitempty"`
	Template         *Template  `json:"template,omitempty"`
	Callout          *Callout   `json:"callout,omitempty"`
	Equation         *Equation  `json:"equation,omitempty"`
	Quote            *Quote     `json:"quote,omitempty"`
	TableRow         *TableRow  `json:"table_row,omitempty"`
}

BlockUpdateRequest is a type for block update request.

type Blocks

type Blocks []Block

Blocks is a slice of (generic) Block objects.

func (*Blocks) UnmarshalJSON

func (b *Blocks) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for Blocks It's required because each type of Block will have its own type-based field. see decodeBlock() for more details

type BlocksService added in v0.0.3

type BlocksService struct {
	// contains filtered or unexported fields
}

BlocksService is a service for the Blocks Notion API.

func (*BlocksService) AppendChildren added in v0.0.3

AppendChildren creates and appends new children blocks to the parent block_id specified. Blocks can be parented by other blocks, pages, or databases.

Returns a paginated list of newly created first level children block objects.

Existing blocks cannot be moved using this endpoint. Blocks are appended to the bottom of the parent block. Once a block is appended as a child, it can't be moved elsewhere via the API.

For blocks that allow children, we allow up to two levels of nesting in a single request.

See https://developers.notion.com/reference/patch-block-children

func (*BlocksService) Delete added in v0.0.3

func (s *BlocksService) Delete(ctx context.Context, id BlockID) (Block, error)

Delete sets a Block object, including page blocks, to archived: true using the ID specified. Note: in the Notion UI application, this moves the block to the "Trash" where it can still be accessed and restored.

To restore the block with the API, use the Update a block or Update page respectively.

See https://developers.notion.com/reference/delete-a-block

func (*BlocksService) Get added in v0.0.3

func (s *BlocksService) Get(ctx context.Context, id BlockID) (Block, error)

Get retrieves a Block object using the ID specified.

Get https://developers.notion.com/reference/retrieve-a-block

func (*BlocksService) GetChildren added in v0.0.3

func (s *BlocksService) GetChildren(ctx context.Context, id BlockID, pagination *Pagination) (*GetChildrenResponse, error)

GetChildren returns a paginated array of child block objects contained in the block using the ID specified. In order to receive a complete representation of a block, you may need to recursively retrieve the block children of child blocks.

See https://developers.notion.com/reference/get-block-children

func (*BlocksService) Update added in v0.0.3

func (s *BlocksService) Update(ctx context.Context, id BlockID, requestBody *BlockUpdateRequest) (Block, error)

Update updates the content for the specified block_id based on the block type. Supported fields based on the block object type (see Block object for available fields and the expected input for each field).

Note: The update replaces the entire value for a given field. If a field is omitted (ex: omitting checked when updating a to_do block), the value will not be changed.

See https://developers.notion.com/reference/update-a-block

type Bookmark

type Bookmark struct {
	Caption RichTexts `json:"caption,omitempty"`
	URL     string    `json:"url"`
}

Bookmark is a block that represents a bookmark (URL + Caption).

type BookmarkBlock

type BookmarkBlock struct {
	BasicBlock
	Bookmark Bookmark `json:"bookmark"`
}

BookmarkBlock is a Notion block for a bookmark.

func NewBookmarkBlock

func NewBookmarkBlock(b Bookmark) *BookmarkBlock

NewBookmarkBlock creates a new BookmarkBlock.

func (*BookmarkBlock) SetBasicBlock added in v0.0.3

func (b *BookmarkBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type Bot

type Bot struct {
	Owner         Owner  `json:"owner"`
	WorkspaceName string `json:"workspace_name"`
}

Bot represents a Bot.

type Breadcrumb struct{}

Breadcrumb is a block that represents a breadcrumb. Contains nothing.

type BreadcrumbBlock struct {
	BasicBlock
	Breadcrumb Breadcrumb `json:"breadcrumb"`
}

BreadcrumbBlock is a Notion block for a breadcrumb.

func NewBreadcrumbBlock

func NewBreadcrumbBlock() *BreadcrumbBlock

NewBreadcrumbBlock creates a new BreadcrumbBlock.

func (b *BreadcrumbBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type BulletedListItemBlock

type BulletedListItemBlock struct {
	BasicBlock
	BulletedListItem ListItem `json:"bulleted_list_item"`
}

BulletedListItemBlock is a Notion block for bulleted list items

func NewBulletedListItemBlock

func NewBulletedListItemBlock(li ListItem) *BulletedListItemBlock

NewBulletedListItemBlock creates a new BulletedListItemBlock

func (*BulletedListItemBlock) AppendChildren added in v0.0.3

func (b *BulletedListItemBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*BulletedListItemBlock) SetBasicBlock added in v0.0.3

func (b *BulletedListItemBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*BulletedListItemBlock) SetChildren

func (b *BulletedListItemBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type Button

type Button struct{}

Button is a type for button.

type ButtonProperty

type ButtonProperty struct {
	ID     ObjectID     `json:"id,omitempty"`
	Type   PropertyType `json:"type,omitempty"`
	Button Button       `json:"button"`
}

ButtonProperty is a type for button property.

func (ButtonProperty) GetID

func (p ButtonProperty) GetID() string

GetID returns the ID of the ButtonProperty.

func (ButtonProperty) GetType

func (p ButtonProperty) GetType() PropertyType

GetType returns the Type of the ButtonProperty.

type ButtonPropertyConfig

type ButtonPropertyConfig struct {
	ID     PropertyID         `json:"id"`
	Type   PropertyConfigType `json:"type"`
	Button any                `json:"button"`
}

ButtonPropertyConfig is a type for button property configs.

func (ButtonPropertyConfig) GetID

func (p ButtonPropertyConfig) GetID() PropertyID

GetID returns the ID of the ButtonPropertyConfig.

func (ButtonPropertyConfig) GetType

GetType returns the Type of the ButtonPropertyConfig.

type Callout

type Callout struct {
	AtomChildren

	RichText RichTexts `json:"rich_text"`
	Icon     *Icon     `json:"icon,omitempty"`
	Color    Color     `json:"color,omitempty"`
}

Callout is a block that represents a callout (icon + color + rich text).

type CalloutBlock

type CalloutBlock struct {
	BasicBlock
	Callout Callout `json:"callout"`
}

CalloutBlock is a Notion block for a callout.

func NewCalloutBlock

func NewCalloutBlock(c Callout) *CalloutBlock

NewCalloutBlock creates a new CalloutBlock.

func (*CalloutBlock) AppendChildren added in v0.0.3

func (b *CalloutBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*CalloutBlock) SetBasicBlock added in v0.0.3

func (b *CalloutBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*CalloutBlock) SetChildren

func (b *CalloutBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type CheckboxFilterCondition

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

CheckboxFilterCondition is a type for checkbox filter conditions.

type CheckboxProperty

type CheckboxProperty struct {
	ID       ObjectID     `json:"id,omitempty"`
	Type     PropertyType `json:"type,omitempty"`
	Checkbox bool         `json:"checkbox"`
}

CheckboxProperty is a type for checkbox property.

func (CheckboxProperty) GetID

func (p CheckboxProperty) GetID() string

GetID returns the ID of the CheckboxProperty.

func (CheckboxProperty) GetType

func (p CheckboxProperty) GetType() PropertyType

GetType returns the Type of the CheckboxProperty.

type CheckboxPropertyConfig

type CheckboxPropertyConfig struct {
	ID       PropertyID         `json:"id,omitempty"`
	Type     PropertyConfigType `json:"type"`
	Checkbox any                `json:"checkbox"`
}

CheckboxPropertyConfig is a type for checkbox property configs.

func (CheckboxPropertyConfig) GetID

GetID returns the ID of the CheckboxPropertyConfig.

func (CheckboxPropertyConfig) GetType

GetType returns the Type of the CheckboxPropertyConfig.

type ChildDataBasicBlock added in v0.0.3

type ChildDataBasicBlock struct {
	BasicBlock
	ChildDatabase ChildDatabase `json:"child_database"`
}

ChildDataBasicBlock is a Notion block for ChildDatabase

func NewChildDataBasicBlock added in v0.0.3

func NewChildDataBasicBlock(title string) *ChildDataBasicBlock

NewChildDataBasicBlock returns a new ChildDataBasicBlock with the given title

func (*ChildDataBasicBlock) SetBasicBlock added in v0.0.3

func (b *ChildDataBasicBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type ChildDatabase added in v0.0.3

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

ChildDatabase stores the title of the child database

type ChildPage added in v0.0.3

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

ChildPage stores the title of the child page

type ChildPageBlock

type ChildPageBlock struct {
	BasicBlock
	ChildPage ChildPage `json:"child_database"`
}

ChildPageBlock is a Notion block for ChildPage

func NewChildPageBlock

func NewChildPageBlock(title string) *ChildPageBlock

NewChildPageBlock returns a new ChildPageBlock with the given title

func (*ChildPageBlock) SetBasicBlock added in v0.0.3

func (b *ChildPageBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type Client

type Client struct {
	Auth      *AuthenticationService
	Blocks    *BlocksService
	Pages     *PagesService
	Databases *DatabasesService
	Users     *UsersService
	Comments  *CommentsService
	Search    *SearchService
	// contains filtered or unexported fields
}

Client is a Notion SDK client.

func New added in v0.0.3

func New(token Token, opts ...ClientOpt) *Client

New creates a new Client with the given token and options.

type ClientOpt added in v0.0.3

type ClientOpt func(*Client)

ClientOpt to configure API client

func WithOAuthAppCredentials

func WithOAuthAppCredentials(id, secret string) ClientOpt

WithOAuthAppCredentials sets the OAuth app ID and secret to use when fetching a token from Notion.

func WithRetry

func WithRetry(retries int) ClientOpt

WithRetry overrides the default number of max retry attempts on 429 errors

func WithTransport added in v0.0.3

func WithTransport(transport http.RoundTripper) ClientOpt

WithTransport overrides the default http.Client

func WithVersion

func WithVersion(version string) ClientOpt

WithVersion overrides the Notion API version

type Code

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

Code stores the code, caption, and language of the code block

type CodeBlock

type CodeBlock struct {
	BasicBlock
	Code Code `json:"code"`
}

CodeBlock is a Notion block for Code

func NewCodeBlock

func NewCodeBlock(code Code) *CodeBlock

NewCodeBlock returns a new CodeBlock with the given code

func (*CodeBlock) SetBasicBlock added in v0.0.3

func (b *CodeBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type Color

type Color string

Color is a type for Notion colors.

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"
	ColorDefaultBackground Color = "default_background"
	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"
)

nolint:revive

func (Color) MarshalText

func (c Color) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (Color) String

func (c Color) String() string

String returns the string representation of the Color.

type Column

type Column struct {
	AtomChildren
}

Column stores the children of the column block

type ColumnBlock

type ColumnBlock struct {
	BasicBlock
	Column Column `json:"column"`
}

ColumnBlock is a Notion block for Column

func NewColumnBlock

func NewColumnBlock(col Column) *ColumnBlock

NewColumnBlock returns a new ColumnBlock with the given column

func (*ColumnBlock) AppendChildren added in v0.0.3

func (b *ColumnBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*ColumnBlock) SetBasicBlock added in v0.0.3

func (b *ColumnBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*ColumnBlock) SetChildren

func (b *ColumnBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type ColumnList

type ColumnList struct {
	// Children can only contain column blocks
	// Children should have at least 2 blocks when appending.
	// TODO^ validate this
	AtomChildren
}

ColumnList stores the children of the column list block

type ColumnListBlock

type ColumnListBlock struct {
	BasicBlock
	ColumnList ColumnList `json:"column_list"`
}

ColumnListBlock is a Notion block for ColumnList

func NewColumnListBlock

func NewColumnListBlock(col ColumnList) *ColumnListBlock

NewColumnListBlock returns a new ColumnListBlock with the given column list

func (*ColumnListBlock) AppendChildren added in v0.0.3

func (b *ColumnListBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*ColumnListBlock) SetBasicBlock added in v0.0.3

func (b *ColumnListBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*ColumnListBlock) SetChildren

func (b *ColumnListBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type Comment

type Comment struct {
	AtomObject
	AtomID
	AtomParent
	AtomCreated

	// LastEditedTime is declared manually, outside of AtomLastEdited,
	// because we do not have LastEditedBy field here.
	LastEditedTime *time.Time `json:"last_edited_time,omitempty"`

	DiscussionID DiscussionID `json:"discussion_id"`
	RichText     RichTexts    `json:"rich_text"`
}

Comment is a Notion object that represents a comment.

type CommentCreateRequest

type CommentCreateRequest struct {
	Parent       Parent       `json:"parent,omitempty"`
	DiscussionID DiscussionID `json:"discussion_id,omitempty"`
	RichText     RichTexts    `json:"rich_text"`
}

CommentCreateRequest represents the request body for CommentClient.Create.

type CommentID

type CommentID = ObjectID

CommentID stands for ID of Comment object. As Comment is an Object, then CommentID is just an alias for Object

type CommentQueryResponse

type CommentQueryResponse struct {
	AtomPaginatedResponse
	Results Comments `json:"results"`
}

CommentQueryResponse is a type for comment query response.

type Comments added in v0.0.3

type Comments []*Comment

Comments is a slice of Comment objects.

type CommentsService added in v0.0.3

type CommentsService struct {
	// contains filtered or unexported fields
}

CommentsService is a service for the Comments Notion API.

func (*CommentsService) Create added in v0.0.3

func (s *CommentsService) Create(ctx context.Context, requestBody *CommentCreateRequest) (*Comment, error)

Create creates a comment in a page or existing discussion thread.

There are two locations you can add a new comment to: 1. A page 2. An existing discussion thread

If the intention is to add a new comment to a page, a parent object must be provided in the body params. Alternatively, if a new comment is being added to an existing discussion thread, the discussion_id string must be provided in the body params. Exactly one of these parameters must be provided.

See https://developers.notion.com/reference/create-a-comment

func (*CommentsService) Get added in v0.0.3

func (s *CommentsService) Get(ctx context.Context, id ObjectID, pagination *Pagination) (*CommentQueryResponse, error)

Get retrieves a list of un-resolved Comment objects from a page or block.

See https://developers.notion.com/reference/retrieve-a-comment

type CompoundFilter

type CompoundFilter map[FilterOperator][]PropertyFilter

CompoundFilter is a type for compound filters.

type Condition

type Condition string

Condition is a type for filter conditions.

const (
	ConditionEquals         Condition = "equals"
	ConditionDoesNotEqual   Condition = "does_not_equal"
	ConditionContains       Condition = "contains"
	ConditionDoesNotContain Condition = "does_not_contain"
	ConditionDoesStartsWith Condition = "starts_with"
	ConditionDoesEndsWith   Condition = "ends_with"
	ConditionDoesIsEmpty    Condition = "is_empty"
	ConditionGreaterThan    Condition = "greater_than"
	ConditionLessThan       Condition = "less_than"

	ConditionGreaterThanOrEqualTo Condition = "greater_than_or_equal_to"
	ConditionLessThanOrEqualTo    Condition = "greater_than_or_equal_to"

	ConditionBefore     Condition = "before"
	ConditionAfter      Condition = "after"
	ConditionOnOrBefore Condition = "on_or_before"
	ConditionOnOrAfter  Condition = "on_or_after"
	ConditionPastWeek   Condition = "past_week"
	ConditionPastMonth  Condition = "past_month"
	ConditionPastYear   Condition = "past_year"
	ConditionNextWeek   Condition = "next_week"
	ConditionNextMonth  Condition = "next_month"
	ConditionNextYear   Condition = "next_year"

	ConditionText     Condition = "text"
	ConditionCheckbox Condition = "checkbox"
	ConditionNumber   Condition = "number"
	ConditionDate     Condition = "date"
)

nolint:revive

type CreatedByProperty

type CreatedByProperty struct {
	ID        ObjectID     `json:"id,omitempty"`
	Type      PropertyType `json:"type,omitempty"`
	CreatedBy User         `json:"created_by"`
}

CreatedByProperty is a type for created by property.

func (CreatedByProperty) GetID

func (p CreatedByProperty) GetID() string

GetID returns the ID of the CreatedByProperty.

func (CreatedByProperty) GetType

func (p CreatedByProperty) GetType() PropertyType

GetType returns the Type of the CreatedByProperty.

type CreatedByPropertyConfig

type CreatedByPropertyConfig struct {
	ID        PropertyID         `json:"id"`
	Type      PropertyConfigType `json:"type"`
	CreatedBy any                `json:"created_by"`
}

CreatedByPropertyConfig is a type for created by property configs.

func (CreatedByPropertyConfig) GetID

GetID returns the ID of the CreatedByPropertyConfig.

func (CreatedByPropertyConfig) GetType

GetType returns the Type of the CreatedByPropertyConfig.

type CreatedTimeProperty

type CreatedTimeProperty struct {
	ID          ObjectID     `json:"id,omitempty"`
	Type        PropertyType `json:"type,omitempty"`
	CreatedTime time.Time    `json:"created_time"`
}

CreatedTimeProperty is a type for created time property.

func (CreatedTimeProperty) GetID

func (p CreatedTimeProperty) GetID() string

GetID returns the ID of the CreatedTimeProperty.

func (CreatedTimeProperty) GetType

func (p CreatedTimeProperty) GetType() PropertyType

GetType returns the Type of the CreatedTimeProperty.

type CreatedTimePropertyConfig

type CreatedTimePropertyConfig struct {
	ID          PropertyID         `json:"id,omitempty"`
	Type        PropertyConfigType `json:"type"`
	CreatedTime any                `json:"created_time"`
}

CreatedTimePropertyConfig is a type for created time property configs.

func (CreatedTimePropertyConfig) GetID

GetID returns the ID of the CreatedTimePropertyConfig.

func (CreatedTimePropertyConfig) GetType

GetType returns the Type of the CreatedTimePropertyConfig.

type Cursor

type Cursor string

Cursor is the Notion's cursor value from the pagination.

func (Cursor) String

func (c Cursor) String() string

String returns the string representation of the Cursor.

type Database

type Database struct {
	AtomObject
	AtomID
	AtomParent
	AtomCreated
	AtomLastEdited
	AtomArchived
	AtomAppearance
	AtomURLs

	// Title of the page is represented via RichTexts(type==text)
	Title RichTexts `json:"title"`
	// Description of the page is represented via RichTexts(type==text)
	Description RichTexts `json:"description"`

	IsInline bool `json:"is_inline"`

	// Properties is a map of property configurations that defines what Page.Properties each page of the database can use
	Properties PropertyConfigs `json:"properties"`
}

Database is a Notion object that represents a database.

func (*Database) GetObject

func (db *Database) GetObject() ObjectType

GetObject always returns ObjectTypeDatabase

type DatabaseCreateRequest

type DatabaseCreateRequest struct {
	// A page parent.
	Parent Parent `json:"parent"`
	// Title of database as it appears in Notion. An array of rich text objects.
	Title RichTexts `json:"title"`
	// Property schema of database. The keys are the names of properties as they
	// appear in Notion and the values are property schema objects.
	Properties PropertyConfigs `json:"properties"`
	IsInline   bool            `json:"is_inline"`
}

DatabaseCreateRequest represents the request body for DatabaseClient.Create.

type DatabaseID

type DatabaseID = ObjectID

DatabaseID stands for ID of Database object. As Database is an Object, then DatabaseID is just an alias for Object

type DatabaseMention

type DatabaseMention struct {
	ID ObjectID `json:"id"`
}

DatabaseMention is a database mention object

type DatabaseQueryRequest

type DatabaseQueryRequest struct {
	// When supplied, limits which pages are returned based on the filter
	// conditions.
	Filter Filter
	// When supplied, orders the results based on the provided sort criteria.
	Sorts []SortObject `json:"sorts,omitempty"`
	// When supplied, returns a page of results starting after the cursor provided.
	// If not supplied, this endpoint will return the first page of results.
	StartCursor Cursor `json:"start_cursor,omitempty"`
	// The number of items from the full list desired in the response. Maximum: 100
	PageSize int `json:"page_size,omitempty"`
}

DatabaseQueryRequest represents the request body for DatabaseClient.Query.

func (*DatabaseQueryRequest) MarshalJSON

func (qr *DatabaseQueryRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements custom Query marshalling

type DatabaseQueryResponse

type DatabaseQueryResponse struct {
	AtomPaginatedResponse
	Results Pages `json:"results"`
}

DatabaseQueryResponse is a response for DatabaseQueryRequest.

type DatabaseUpdateRequest

type DatabaseUpdateRequest struct {
	// An array of rich text objects that represents the title of the database
	// that is displayed in the Notion UI. If omitted, then the database title
	// remains unchanged.
	Title RichTexts `json:"title,omitempty"`
	// The properties of a database to be changed in the request, in the form of
	// a JSON object. If updating an existing property, then the keys are the
	// names or IDs of the properties as they appear in Notion, and the values are
	// property schema objects. If adding a new property, then the key is the name
	// of the new database property and the value is a property schema object.
	Properties PropertyConfigs `json:"properties,omitempty"`
}

DatabaseUpdateRequest represents the request body for DatabaseClient.Update.

type DatabasesService added in v0.0.3

type DatabasesService struct {
	// contains filtered or unexported fields
}

DatabasesService is a service for Notion Databases API.

func (*DatabasesService) Create added in v0.0.3

func (s *DatabasesService) Create(ctx context.Context, requestBody *DatabaseCreateRequest) (*Database, error)

Create creates a database as a subpage in the specified parent page, with the specified properties schema. Currently, the parent of a new database must be a Notion page.

See https://developers.notion.com/reference/create-a-database

func (*DatabasesService) Get added in v0.0.3

Get gets a database by ID.

See https://developers.notion.com/reference/get-database

func (*DatabasesService) Query added in v0.0.3

Query gets a list of Pages contained in the database, filtered and ordered according to the filter conditions and sort criteria provided in the request. The response may contain fewer than page_size of results. If the response includes a next_cursor value, refer to the pagination reference for details about how to use a cursor to iterate through the list.

Filters are similar to the filters provided in the Notion UI where the set of filters and filter groups chained by "And" in the UI is equivalent to having each filter in the array of the compound "and" filter. Similar a set of filters chained by "Or" in the UI would be represented as filters in the array of the "or" compound filter.

Filters operate on database properties and can be combined. If no filter is provided, all the pages in the database will be returned with pagination.

See https://developers.notion.com/reference/post-database-query

func (*DatabasesService) Update added in v0.0.3

func (s *DatabasesService) Update(ctx context.Context, id DatabaseID, requestBody *DatabaseUpdateRequest) (*Database, error)

Update updates a Database by id

https://developers.notion.com/reference/update-a-database

type Date

type Date time.Time

Date is a type for Notion dates.

func (Date) MarshalText

func (d Date) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Date) String

func (d *Date) String() string

String returns the string representation of the Date.

func (*Date) UnmarshalText

func (d *Date) UnmarshalText(data []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

type DateFilterCondition

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

DateFilterCondition is a type for date

type DateObject

type DateObject struct {
	Start *Date `json:"start"`
	End   *Date `json:"end"`
}

DateObject is a type for date object.

type DateProperty

type DateProperty struct {
	ID   ObjectID     `json:"id,omitempty"`
	Type PropertyType `json:"type,omitempty"`
	Date *DateObject  `json:"date"`
}

DateProperty is a type for date property.

func (DateProperty) GetID

func (p DateProperty) GetID() string

GetID returns the ID of the DateProperty.

func (DateProperty) GetType

func (p DateProperty) GetType() PropertyType

GetType returns the Type of the DateProperty.

type DatePropertyConfig

type DatePropertyConfig struct {
	ID   PropertyID         `json:"id,omitempty"`
	Type PropertyConfigType `json:"type"`
	Date any                `json:"date"`
}

DatePropertyConfig is a type for date property configs.

func (DatePropertyConfig) GetID

func (p DatePropertyConfig) GetID() PropertyID

GetID returns the ID of the DatePropertyConfig.

func (DatePropertyConfig) GetType

GetType returns the Type of the DatePropertyConfig.

type DiscussionID

type DiscussionID string

DiscussionID stands for ID of the Discussion.

func (DiscussionID) String

func (dID DiscussionID) String() string

String returns the string representation of the DiscussionID.

type Divider

type Divider struct{}

Divider stands for a divider

type DividerBlock

type DividerBlock struct {
	BasicBlock
	Divider Divider `json:"divider"`
}

DividerBlock is a Notion block for Divider

func NewDividerBlock

func NewDividerBlock() *DividerBlock

NewDividerBlock returns a new DividerBlock

func (*DividerBlock) SetBasicBlock added in v0.0.3

func (b *DividerBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type DualProperty

type DualProperty struct{}

DualProperty is a type for dual properties.

type EmailProperty

type EmailProperty struct {
	ID    PropertyID   `json:"id,omitempty"`
	Type  PropertyType `json:"type,omitempty"`
	Email string       `json:"email"`
}

EmailProperty is a type for email property.

func (EmailProperty) GetID

func (p EmailProperty) GetID() string

GetID returns the ID of the EmailProperty.

func (EmailProperty) GetType

func (p EmailProperty) GetType() PropertyType

GetType returns the Type of the EmailProperty.

type EmailPropertyConfig

type EmailPropertyConfig struct {
	ID    PropertyID         `json:"id,omitempty"`
	Type  PropertyConfigType `json:"type"`
	Email any                `json:"email"`
}

EmailPropertyConfig is a type for email property configs.

func (EmailPropertyConfig) GetID

func (p EmailPropertyConfig) GetID() PropertyID

GetID returns the ID of the EmailPropertyConfig.

func (EmailPropertyConfig) GetType

GetType returns the Type of the EmailPropertyConfig.

type Embed

type Embed struct {
	Caption RichTexts `json:"caption,omitempty"`
	URL     string    `json:"url"`
}

Embed stores the caption and URL of the embed block

type EmbedBlock

type EmbedBlock struct {
	BasicBlock
	Embed Embed `json:"embed"`
}

EmbedBlock is a Notion block for Embed

func NewEmbedBlock

func NewEmbedBlock(embed Embed) *EmbedBlock

NewEmbedBlock returns a new EmbedBlock with the given embed

func (*EmbedBlock) SetBasicBlock added in v0.0.3

func (b *EmbedBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type Emoji

type Emoji string

Emoji is a type for emoji.

type Equation

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

Equation holds the equation expression It's used both for inline equations and standalone equations.

type EquationBlock

type EquationBlock struct {
	BasicBlock
	Equation Equation `json:"equation"`
}

EquationBlock is a Notion block for Standalone equation blocks It differs from inline Equation: Inline equations are always part of paragraph (or other parent block) Standalone equations are always standalone blocks

func (*EquationBlock) SetBasicBlock added in v0.0.3

func (b *EquationBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type ErrorCode

type ErrorCode string

ErrorCode is a type for Notion API error codes.

type ExternalAccount

type ExternalAccount struct {
	Key  string `json:"key"`
	Name string `json:"name"`
}

ExternalAccount is a type for external account.

type File

type File struct {
	Caption RichTexts `json:"caption,omitempty"`

	Type FileType `json:"type"`

	File     *FileData `json:"file,omitempty"`
	External *FileData `json:"external,omitempty"`
}

File is a file object.

func (File) GetExpiryTime added in v0.0.3

func (f File) GetExpiryTime() *time.Time

GetExpiryTime returns the ExpiryTime of the File.

func (File) GetURL added in v0.0.3

func (f File) GetURL() string

GetURL returns the URL of the File.

type FileBlock

type FileBlock struct {
	BasicBlock
	File File `json:"file"`
}

FileBlock is a Notion block for files

func NewFileBlock

func NewFileBlock(file File) *FileBlock

NewFileBlock creates a new FileBlock

func (*FileBlock) GetExpiryTime

func (b *FileBlock) GetExpiryTime() *time.Time

GetExpiryTime implements Media interface for FileBlock

func (*FileBlock) GetURL

func (b *FileBlock) GetURL() string

GetURL implements Media interface for FileBlock

func (*FileBlock) SetBasicBlock added in v0.0.3

func (b *FileBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type FileData added in v0.0.3

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

FileData is a file Data object

type FileType

type FileType string

FileType is a type of a Notion file. See https://developers.notion.com/reference/file-object

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

nolint:revive

type Files added in v0.0.3

type Files []File

Files is a slice of File objects.

type FilesFilterCondition

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

FilesFilterCondition is a type for files filter conditions.

type FilesProperty

type FilesProperty struct {
	ID    ObjectID     `json:"id,omitempty"`
	Type  PropertyType `json:"type,omitempty"`
	Files Files        `json:"files"`
}

FilesProperty is a type for files property.

func (FilesProperty) GetID

func (p FilesProperty) GetID() string

GetID returns the ID of the FilesProperty.

func (FilesProperty) GetType

func (p FilesProperty) GetType() PropertyType

GetType returns the Type of the FilesProperty.

type FilesPropertyConfig

type FilesPropertyConfig struct {
	ID    PropertyID         `json:"id,omitempty"`
	Type  PropertyConfigType `json:"type"`
	Files any                `json:"files"`
}

FilesPropertyConfig is a type for files property configs.

func (FilesPropertyConfig) GetID

func (p FilesPropertyConfig) GetID() PropertyID

GetID returns the ID of the FilesPropertyConfig.

func (FilesPropertyConfig) GetType

GetType returns the Type of the FilesPropertyConfig.

type Filter

type Filter interface {
	// contains filtered or unexported methods
}

Filter is an interface for filter types. TODO: refactor probably

type FilterOperator

type FilterOperator string

FilterOperator is a type for filter operators.

const (
	FilterOperatorAND FilterOperator = "and"
	FilterOperatorOR  FilterOperator = "or"
)

nolint:revive

type FormatType

type FormatType string

FormatType is a type for format types.

const (
	FormatNumber           FormatType = "number"
	FormatNumberWithCommas FormatType = "number_with_commas"
	FormatPercent          FormatType = "percent"
	FormatDollar           FormatType = "dollar"
	FormatCanadianDollar   FormatType = "canadian_dollar"
	FormatEuro             FormatType = "euro"
	FormatPound            FormatType = "pound"
	FormatYen              FormatType = "yen"
	FormatRuble            FormatType = "ruble"
	FormatRupee            FormatType = "rupee"
	FormatWon              FormatType = "won"
	FormatYuan             FormatType = "yuan"
	FormatReal             FormatType = "real"
	FormatLira             FormatType = "lira"
	FormatRupiah           FormatType = "rupiah"
	FormatFranc            FormatType = "franc"
	FormatHongKongDollar   FormatType = "hong_kong_dollar"
	FormatNewZealandDollar FormatType = "hong_kong_dollar"
	FormatKrona            FormatType = "krona"
	FormatNorwegianKrone   FormatType = "norwegian_krone"
	FormatMexicanPeso      FormatType = "mexican_peso"
	FormatRand             FormatType = "rand"
	FormatNewTaiwanDollar  FormatType = "new_taiwan_dollar"
	FormatDanishKrone      FormatType = "danish_krone"
	FormatZloty            FormatType = "zloty"
	FormatBath             FormatType = "baht"
	FormatForint           FormatType = "forint"
	FormatKoruna           FormatType = "koruna"
	FormatShekel           FormatType = "shekel"
	FormatChileanPeso      FormatType = "chilean_peso"
	FormatPhilippinePeso   FormatType = "philippine_peso"
	FormatDirham           FormatType = "dirham"
	FormatColombianPeso    FormatType = "colombian_peso"
	FormatRiyal            FormatType = "riyal"
	FormatRinggit          FormatType = "ringgit"
	FormatLeu              FormatType = "leu"
	FormatArgentinePeso    FormatType = "argentine_peso"
	FormatUruguayanPeso    FormatType = "uruguayan_peso"
	FormatSingaporeDollar  FormatType = "singapore_dollar"
)

nolint:revive

func (FormatType) String

func (ft FormatType) String() string

String returns the string representation of the FormatType.

type Formula

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

Formula is a type for formula.

type FormulaConfig

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

FormulaConfig is a type for formula configs.

type FormulaFilterCondition

type FormulaFilterCondition struct {
	// DEPRECATED use `String` instead
	Text     *TextFilterCondition     `json:"text,omitempty"`
	String   *TextFilterCondition     `json:"string,omitempty"`
	Checkbox *CheckboxFilterCondition `json:"checkbox,omitempty"`
	Number   *NumberFilterCondition   `json:"number,omitempty"`
	Date     *DateFilterCondition     `json:"date,omitempty"`
}

FormulaFilterCondition is a type for formula filter conditions.

type FormulaProperty

type FormulaProperty struct {
	ID      ObjectID     `json:"id,omitempty"`
	Type    PropertyType `json:"type,omitempty"`
	Formula Formula      `json:"formula"`
}

FormulaProperty is a type for formula property.

func (FormulaProperty) GetID

func (p FormulaProperty) GetID() string

GetID returns the ID of the FormulaProperty.

func (FormulaProperty) GetType

func (p FormulaProperty) GetType() PropertyType

GetType returns the Type of the FormulaProperty.

type FormulaPropertyConfig

type FormulaPropertyConfig struct {
	ID      PropertyID         `json:"id,omitempty"`
	Type    PropertyConfigType `json:"type"`
	Formula FormulaConfig      `json:"formula"`
}

FormulaPropertyConfig is a type for formula property configs.

func (FormulaPropertyConfig) GetID

GetID returns the ID of the FormulaPropertyConfig.

func (FormulaPropertyConfig) GetType

GetType returns the Type of the FormulaPropertyConfig.

type FormulaType

type FormulaType string

FormulaType is a type for formula types.

const (
	FormulaTypeString  FormulaType = "string"
	FormulaTypeNumber  FormulaType = "number"
	FormulaTypeBoolean FormulaType = "boolean"
	FormulaTypeDate    FormulaType = "date"
)

nolint:revive

type FunctionType

type FunctionType string

FunctionType is a type for function types.

const (
	FunctionCountAll          FunctionType = "count_all"
	FunctionCountValues       FunctionType = "count_values"
	FunctionCountUniqueValues FunctionType = "count_unique_values"
	FunctionCountEmpty        FunctionType = "count_empty"
	FunctionCountNotEmpty     FunctionType = "count_not_empty"
	FunctionPercentEmpty      FunctionType = "percent_empty"
	FunctionPercentNotEmpty   FunctionType = "percent_not_empty"
	FunctionSum               FunctionType = "sum"
	FunctionAverage           FunctionType = "average"
	FunctionMedian            FunctionType = "median"
	FunctionMin               FunctionType = "min"
	FunctionMax               FunctionType = "max"
	FunctionRange             FunctionType = "range"
)

nolint:revive

func (FunctionType) String

func (ft FunctionType) String() string

String returns the string representation of the FunctionType.

type GetChildrenResponse

type GetChildrenResponse struct {
	AtomPaginatedResponse
	Results Blocks `json:"results"`
}

GetChildrenResponse is a type for get children response.

type GroupConfig

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

GroupConfig is a type for group configs.

type Heading

type Heading struct {
	AtomChildren

	RichText     RichTexts `json:"rich_text"`
	Color        Color     `json:"color,omitempty"`
	IsToggleable bool      `json:"is_toggleable,omitempty"`
}

Heading stores the heading data.

type Heading1Block

type Heading1Block struct {
	BasicBlock
	Heading1 Heading `json:"heading_1"`
}

Heading1Block is a Notion block for Heading1

func NewHeading1Block

func NewHeading1Block(h Heading) *Heading1Block

NewHeading1Block returns a new Heading1Block with the given heading

func (*Heading1Block) AppendChildren added in v0.0.3

func (b *Heading1Block) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*Heading1Block) SetBasicBlock added in v0.0.3

func (b *Heading1Block) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*Heading1Block) SetChildren

func (b *Heading1Block) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type Heading2Block

type Heading2Block struct {
	BasicBlock
	Heading2 Heading `json:"heading_2"`
}

Heading2Block is a Notion block for Heading2

func NewHeading2Block

func NewHeading2Block(h Heading) *Heading2Block

NewHeading2Block returns a new Heading2Block with the given heading

func (*Heading2Block) AppendChildren added in v0.0.3

func (b *Heading2Block) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*Heading2Block) SetBasicBlock added in v0.0.3

func (b *Heading2Block) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*Heading2Block) SetChildren

func (b *Heading2Block) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type Heading3Block

type Heading3Block struct {
	BasicBlock
	Heading3 Heading `json:"heading_3"`
}

Heading3Block is a Notion block for Heading3

func NewHeading3Block

func NewHeading3Block(h Heading) *Heading3Block

NewHeading3Block returns a new Heading3Block with the given heading

func (*Heading3Block) AppendChildren added in v0.0.3

func (b *Heading3Block) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*Heading3Block) SetBasicBlock added in v0.0.3

func (b *Heading3Block) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*Heading3Block) SetChildren

func (b *Heading3Block) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type HierarchicalBlock added in v0.0.3

type HierarchicalBlock interface {
	GetChildren() Blocks
	SetChildren(Blocks)
	AppendChildren(...Block)
	ChildCount() int
}

HierarchicalBlock is a block that can handle its GetChildren Even childfree blocks should implement it (see AtomChildfree)

type Icon

type Icon struct {
	Type     FileType `json:"type"` // external or emoji
	External *File    `json:"external,omitempty"`

	Emoji Emoji `json:"emoji,omitempty"`
}

Icon is an type union of FileObject(type==external) and Emoji Icon must be filled in 2 possible ways: 1. Type==external, External is not nil (Emoji is nil) 2. Type==emoji, Emoji is not nil (External is nil)

func NewEmojiIcon added in v0.0.3

func NewEmojiIcon(emoji Emoji) *Icon

NewEmojiIcon returns a new Icon with a given Emoji.

func NewExternalIcon added in v0.0.3

func NewExternalIcon(url string) Icon

NewExternalIcon returns a new Icon with a given external File URL.

type ImageBlock

type ImageBlock struct {
	BasicBlock
	Image File `json:"image"`
}

ImageBlock is a Notion block for images

func NewImageBlock

func NewImageBlock(data File) *ImageBlock

NewImageBlock creates a new ImageBlock

func (*ImageBlock) GetExpiryTime

func (b *ImageBlock) GetExpiryTime() *time.Time

GetExpiryTime implements Media interface for ImageBlock

func (*ImageBlock) GetURL

func (b *ImageBlock) GetURL() string

GetURL implements Media interface for ImageBlock

func (*ImageBlock) SetBasicBlock added in v0.0.3

func (b *ImageBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type LastEditedByProperty

type LastEditedByProperty struct {
	ID           ObjectID     `json:"id,omitempty"`
	Type         PropertyType `json:"type,omitempty"`
	LastEditedBy User         `json:"last_edited_by"`
}

LastEditedByProperty is a type for last edited by property.

func (LastEditedByProperty) GetID

func (p LastEditedByProperty) GetID() string

GetID returns the ID of the LastEditedByProperty.

func (LastEditedByProperty) GetType

func (p LastEditedByProperty) GetType() PropertyType

GetType returns the Type of the LastEditedBy

type LastEditedByPropertyConfig

type LastEditedByPropertyConfig struct {
	ID           PropertyID         `json:"id"`
	Type         PropertyConfigType `json:"type"`
	LastEditedBy any                `json:"last_edited_by"`
}

LastEditedByPropertyConfig is a type for last edited by property configs.

func (LastEditedByPropertyConfig) GetID

GetID returns the ID of the LastEditedByPropertyConfig.

func (LastEditedByPropertyConfig) GetType

GetType returns the Type of the LastEditedByPropertyConfig.

type LastEditedTimeProperty

type LastEditedTimeProperty struct {
	ID             ObjectID     `json:"id,omitempty"`
	Type           PropertyType `json:"type,omitempty"`
	LastEditedTime time.Time    `json:"last_edited_time"`
}

LastEditedTimeProperty is a type for last edited time property.

func (LastEditedTimeProperty) GetID

func (p LastEditedTimeProperty) GetID() string

GetID returns the ID of the LastEditedTimeProperty.

func (LastEditedTimeProperty) GetType

GetType returns the Type of the LastEditedTimeProperty.

type LastEditedTimePropertyConfig

type LastEditedTimePropertyConfig struct {
	ID             PropertyID         `json:"id"`
	Type           PropertyConfigType `json:"type"`
	LastEditedTime any                `json:"last_edited_time"`
}

LastEditedTimePropertyConfig is a type for last edited time property configs.

func (LastEditedTimePropertyConfig) GetID

GetID returns the ID of the LastEditedTimePropertyConfig.

func (LastEditedTimePropertyConfig) GetType

GetType returns the Type of the LastEditedTimePropertyConfig.

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

Link is a link object to be used in RichText.Text.Link

type LinkPreview

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

LinkPreview is a type for link preview.

type LinkPreviewBlock

type LinkPreviewBlock struct {
	BasicBlock
	LinkPreview LinkPreview `json:"link_preview"`
}

LinkPreviewBlock is a Notion block for link preview blocks NOTE: will only be returned by the API. Cannot be created by the API.

func NewLinkPreviewBlock

func NewLinkPreviewBlock(lp LinkPreview) *LinkPreviewBlock

NewLinkPreviewBlock creates a new LinkPreviewBlock. Deprecated: as now publishing new LinkPreview blocks to Notion is allowed

func (*LinkPreviewBlock) SetBasicBlock added in v0.0.3

func (b *LinkPreviewBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type LinkToPage

type LinkToPage struct {
	Type       LinkToPageType `json:"type"`
	PageID     PageID         `json:"page_id,omitempty"`
	DatabaseID DatabaseID     `json:"database_id,omitempty"`
}

LinkToPage holds a link to a page or database

type LinkToPageBlock

type LinkToPageBlock struct {
	BasicBlock
	LinkToPage LinkToPage `json:"link_to_page"`
}

LinkToPageBlock is a Notion block for LinkToPage

func NewLinkToDatabaseBlock added in v0.0.3

func NewLinkToDatabaseBlock(dbID DatabaseID) *LinkToPageBlock

NewLinkToDatabaseBlock creates a new LinkToPageBlock (type==database)

func NewLinkToPageBlock

func NewLinkToPageBlock(pageID PageID) *LinkToPageBlock

NewLinkToPageBlock creates a new LinkToPageBlock (type==page)

func (*LinkToPageBlock) SetBasicBlock added in v0.0.3

func (b *LinkToPageBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type LinkToPageType added in v0.0.3

type LinkToPageType string

LinkToPageType is a type for LinkToPage.Type

const (
	// LinkToPageTypePage is a type for LinkToPage.Type
	LinkToPageTypePage LinkToPageType = "page"
	// LinkToPageTypeDatabase is a type for LinkToPage.Type
	LinkToPageTypeDatabase LinkToPageType = "database"
)

type ListItem

type ListItem struct {
	AtomChildren
	RichText RichTexts `json:"rich_text"`
	Color    string    `json:"color,omitempty"`
}

ListItem is a type for bulleted and numbered list items

type Media added in v0.0.3

type Media interface {
	GetURL() string
	GetExpiryTime() *time.Time
}

Media is an interface for blocks that can be downloaded such as Pdf, FileBlock, and Image

type Mention

type Mention struct {
	Type            MentionType      `json:"type,omitempty"`
	Database        *DatabaseMention `json:"database,omitempty"`
	Page            *PageMention     `json:"page,omitempty"`
	User            *UserMention     `json:"user,omitempty"`
	Date            *DateObject      `json:"date,omitempty"`
	TemplateMention *TemplateMention `json:"template_mention,omitempty"`
}

Mention is an Object that holds mention to something (database, page, etc)

type MentionType

type MentionType string

MentionType is a type of a mention

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

nolint:revive

func (MentionType) String

func (v MentionType) String() string

String returns the string representation of the MentionType

type MultiSelectFilterCondition

type MultiSelectFilterCondition 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"`
}

MultiSelectFilterCondition is a type for multi-select filter conditions.

type MultiSelectProperty

type MultiSelectProperty struct {
	ID          ObjectID     `json:"id,omitempty"`
	Type        PropertyType `json:"type,omitempty"`
	MultiSelect []Option     `json:"multi_select"`
}

MultiSelectProperty is a type for multi-select property.

func (MultiSelectProperty) GetID

func (p MultiSelectProperty) GetID() string

GetID returns the ID of the MultiSelectProperty.

func (MultiSelectProperty) GetType

func (p MultiSelectProperty) GetType() PropertyType

GetType returns the Type of the MultiSelectProperty.

type MultiSelectPropertyConfig

type MultiSelectPropertyConfig struct {
	ID          PropertyID         `json:"id,omitempty"`
	Type        PropertyConfigType `json:"type"`
	MultiSelect Select             `json:"multi_select"`
}

MultiSelectPropertyConfig is a type for multi-select property configs.

func (MultiSelectPropertyConfig) GetID

GetID returns the ID of the MultiSelectPropertyConfig.

func (MultiSelectPropertyConfig) GetType

GetType returns the Type of the MultiSelectPropertyConfig.

type NumberFilterCondition

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

NumberFilterCondition is a type for number filter conditions.

type NumberFormat

type NumberFormat struct {
	Format FormatType `json:"format"`
}

NumberFormat is a type for number formats.

type NumberProperty

type NumberProperty struct {
	ID     PropertyID   `json:"id,omitempty"`
	Type   PropertyType `json:"type,omitempty"`
	Number float64      `json:"number"`
}

NumberProperty is a type for number property.

func (NumberProperty) GetID

func (p NumberProperty) GetID() string

GetID returns the ID of the NumberProperty.

func (NumberProperty) GetType

func (p NumberProperty) GetType() PropertyType

GetType returns the Type of the NumberProperty.

type NumberPropertyConfig

type NumberPropertyConfig struct {
	ID     PropertyID         `json:"id,omitempty"`
	Type   PropertyConfigType `json:"type"`
	Number NumberFormat       `json:"number"`
}

NumberPropertyConfig is a type for number property configs.

func (NumberPropertyConfig) GetID

func (p NumberPropertyConfig) GetID() PropertyID

GetID returns the ID of the NumberPropertyConfig.

func (NumberPropertyConfig) GetType

GetType returns the Type of the NumberPropertyConfig.

type NumberedListItemBlock

type NumberedListItemBlock struct {
	BasicBlock
	NumberedListItem ListItem `json:"numbered_list_item"`
}

NumberedListItemBlock is a Notion block for numbered list items

func NewNumberedListItemBlock

func NewNumberedListItemBlock(li ListItem) *NumberedListItemBlock

NewNumberedListItemBlock creates a new NumberedListItemBlock

func (*NumberedListItemBlock) AppendChildren added in v0.0.3

func (b *NumberedListItemBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*NumberedListItemBlock) SetBasicBlock added in v0.0.3

func (b *NumberedListItemBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*NumberedListItemBlock) SetChildren

func (b *NumberedListItemBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type Object

type Object interface {
	GetObject() ObjectType
}

Object is an interface for all Notion objects. ObjectType ("object") field is the only shared field between all objects.

type ObjectID

type ObjectID string

ObjectID is a unique identifier for a Notion object. It is set on the Notion side only (immutable and read-only). It will be ignored if you manually set its value for the new objects.

func (ObjectID) String

func (oID ObjectID) String() string

String returns the string representation of the ObjectID.

type ObjectType

type ObjectType string

ObjectType is a type of a Notion object.

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

nolint:revive

func (ObjectType) String

func (ot ObjectType) String() string

String returns the string representation of the ObjectType.

type Objects added in v0.0.3

type Objects []Object

Objects is a slice of Object.

type Option

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

Option is a type for option.

type Options added in v0.0.3

type Options []Option

Options is a slice of Option.

type OrCompoundFilter

type OrCompoundFilter []Filter

OrCompoundFilter is a type for `or` compound filters.

func (OrCompoundFilter) MarshalJSON

func (f OrCompoundFilter) MarshalJSON() ([]byte, error)

MarshalJSON implements custom marshalling for OrCompoundFilter

type Owner

type Owner struct {
	Type      string `json:"type"`
	Workspace bool   `json:"workspace"`
}

Owner represents a Bot's Owner.

type Page

The Page object contains the page property values of a single Notion page.

See https://developers.notion.com/reference/page

func (*Page) GetObject

func (p *Page) GetObject() ObjectType

GetObject always returns ObjectTypePage

type PageCreateRequest

type PageCreateRequest struct {
	// The parent page or database where the new page is inserted, represented as
	// a JSON object with a page_id or database_id key, and the corresponding ID.
	// Required field.
	Parent Parent `json:"parent"`
	// The values of the page’s properties. If the parent is a database, then the
	// schema must match the parent database’s properties. If the parent is a page,
	// then the only valid object key is title.
	// Required field.
	Properties Properties `json:"properties"`
	// The content to be rendered on the new page, represented as an array of
	// block objects.
	Children Blocks `json:"children,omitempty"`
	// The icon of the new page. Either an emoji object or an external file object.
	Icon *Icon `json:"icon,omitempty"`
	// The cover image of the new page, represented as a file object.
	Cover *File `json:"cover,omitempty"`
}

PageCreateRequest represents the request body for PagesClient.Create.

type PageID

type PageID = ObjectID

PageID stands for ID of Page object. As Page is an Object, then PageID is just an alias for Object

type PageMention

type PageMention struct {
	ID ObjectID `json:"id"`
}

PageMention is a page mention object

type PageUpdateRequest

type PageUpdateRequest struct {
	// The property values to update for the page. The keys are the names or IDs
	// of the property and the values are property values. If a page property ID
	// is not included, then it is not changed.
	Properties Properties `json:"properties,omitempty"`
	// Whether the page is archived (deleted). Set to true to archive a page. Set
	// to false to un-archive (restore) a page.
	Archived bool `json:"archived"`
	// A page icon for the page. Supported types are external file object or emoji
	// object.
	Icon *Icon `json:"icon,omitempty"`
	// A cover image for the page. Only external file objects are supported.
	Cover *File `json:"cover,omitempty"`
}

PageUpdateRequest represents the request body for PagesClient.Update.

type Pages added in v0.0.3

type Pages []*Page

Pages is a slice of Page objects.

type PagesService added in v0.0.3

type PagesService struct {
	// contains filtered or unexported fields
}

PagesService is a service for the Pages Notion API.

func (*PagesService) Create added in v0.0.3

func (s *PagesService) Create(ctx context.Context, requestBody *PageCreateRequest) (*Page, error)

Create creates a new page that is a child of an existing page or database.

If the new page is a child of an existing page,title is the only valid property in the properties body param.

If the new page is a child of an existing database, the keys of the properties object body param must match the parent database's properties.

This endpoint can be used to create a new page with or without content using the children option. To add content to a page after creating it, use the Append block children endpoint.

Returns a new page object.

See https://developers.notion.com/reference/post-page

func (*PagesService) Get added in v0.0.3

func (s *PagesService) Get(ctx context.Context, id PageID) (*Page, error)

Get retrieves a Page object using the ID specified.

Responses contains page properties, not page content. To fetch page content, use the Retrieve block children endpoint.

Page properties are limited to up to 25 references per page property. To retrieve data related to properties that have more than 25 references, use the Retrieve a page property endpoint.

See https://developers.notion.com/reference/get-page

func (*PagesService) Update added in v0.0.3

func (s *PagesService) Update(ctx context.Context, id PageID, request *PageUpdateRequest) (*Page, error)

Update updates the properties of a page in a database. The properties body param of this endpoint can only be used to update the properties of a page that is a child of a database. The page’s properties schema must match the parent database’s properties.

This endpoint can be used to update any page icon or cover, and can be used to archive or restore any page.

To add page content instead of page properties, use the append block children endpoint. The page_id can be passed as the block_id when adding block children to the page.

Returns the updated page object.

See https://developers.notion.com/reference/patch-page

type Pagination

type Pagination struct {
	StartCursor Cursor
	PageSize    int
}

Pagination is a type for Notion pagination.

func (*Pagination) ToQuery

func (p *Pagination) ToQuery() map[string]string

ToQuery returns a map of query parameters for the pagination.

type Paragraph

type Paragraph struct {
	AtomChildren
	RichText RichTexts `json:"rich_text"`
	Color    Color     `json:"color,omitempty"`
}

Paragraph is a type for paragraph blocks

type ParagraphBlock

type ParagraphBlock struct {
	BasicBlock
	Paragraph Paragraph `json:"paragraph"`
}

ParagraphBlock is a Notion block for paragraph blocks

func NewParagraphBlock

func NewParagraphBlock(p Paragraph) *ParagraphBlock

NewParagraphBlock creates a new ParagraphBlock

func (*ParagraphBlock) AppendChildren added in v0.0.3

func (b *ParagraphBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*ParagraphBlock) SetBasicBlock added in v0.0.3

func (b *ParagraphBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*ParagraphBlock) SetChildren

func (b *ParagraphBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type Parent

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

Parent is a type for Notion's Parent object: Pages, databases, and blocks are either located inside other pages, databases, and blocks, or are located at the top level of a workspace. This location is known as the "parent". Parent information is represented by a consistent parent object throughout the API.

func NewBlockParent added in v0.0.3

func NewBlockParent(blockID BlockID) Parent

NewBlockParent returns a Block parent.

func NewDatabaseParent added in v0.0.3

func NewDatabaseParent(databaseID DatabaseID) Parent

NewDatabaseParent returns a Database parent.

func NewPageParent added in v0.0.3

func NewPageParent(pageID PageID) Parent

NewPageParent returns a Page Parent.

func NewWorkspaceParent added in v0.0.3

func NewWorkspaceParent() Parent

NewWorkspaceParent returns a Workspace parent.

func (Parent) IsZero added in v0.0.3

func (p Parent) IsZero() bool

IsZero returns true if the Parent is empty. We intentionally do not use pointerish *Parent to keep it nil-safe.

type ParentType

type ParentType string

ParentType is a type of a Notion parent. See https://developers.notion.com/reference/parent-object

const (
	ParentTypeDatabaseID ParentType = "database_id"
	ParentTypePageID     ParentType = "page_id"
	ParentTypeBlockID    ParentType = "block_id"
	ParentTypeWorkspace  ParentType = "workspace"
)

nolint:revive

type PdfBlock

type PdfBlock struct {
	BasicBlock
	Pdf File `json:"pdf"`
}

PdfBlock is a Notion block for PDF files

func NewPdfBlock

func NewPdfBlock(pdf File) *PdfBlock

NewPdfBlock creates a new PdfBlock

func (*PdfBlock) GetExpiryTime

func (b *PdfBlock) GetExpiryTime() *time.Time

GetExpiryTime implements Media interface for PdfBlock

func (*PdfBlock) GetURL

func (b *PdfBlock) GetURL() string

GetURL implements Media interface for PdfBlock

func (*PdfBlock) SetBasicBlock added in v0.0.3

func (b *PdfBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type PeopleFilterCondition

type PeopleFilterCondition 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"`
}

PeopleFilterCondition is a type for people filter conditions.

type PeopleProperty

type PeopleProperty struct {
	ID     ObjectID     `json:"id,omitempty"`
	Type   PropertyType `json:"type,omitempty"`
	People Users        `json:"people"`
}

PeopleProperty is a type for people property.

func (PeopleProperty) GetID

func (p PeopleProperty) GetID() string

GetID returns the ID of the PeopleProperty.

func (PeopleProperty) GetType

func (p PeopleProperty) GetType() PropertyType

GetType returns the Type of the PeopleProperty.

type PeoplePropertyConfig

type PeoplePropertyConfig struct {
	ID     PropertyID         `json:"id,omitempty"`
	Type   PropertyConfigType `json:"type"`
	People any                `json:"people"`
}

PeoplePropertyConfig is a type for people property configs.

func (PeoplePropertyConfig) GetID

func (p PeoplePropertyConfig) GetID() PropertyID

GetID returns the ID of the PeoplePropertyConfig.

func (PeoplePropertyConfig) GetType

GetType returns the Type of the PeoplePropertyConfig.

type Person

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

Person represents a Person.

type PhoneNumberProperty

type PhoneNumberProperty struct {
	ID          ObjectID     `json:"id,omitempty"`
	Type        PropertyType `json:"type,omitempty"`
	PhoneNumber string       `json:"phone_number"`
}

PhoneNumberProperty is a type for phone number property.

func (PhoneNumberProperty) GetID

func (p PhoneNumberProperty) GetID() string

GetID returns the ID of the PhoneNumberProperty.

func (PhoneNumberProperty) GetType

func (p PhoneNumberProperty) GetType() PropertyType

GetType returns the Type of the PhoneNumberProperty.

type PhoneNumberPropertyConfig

type PhoneNumberPropertyConfig struct {
	ID          PropertyID         `json:"id,omitempty"`
	Type        PropertyConfigType `json:"type"`
	PhoneNumber any                `json:"phone_number"`
}

PhoneNumberPropertyConfig is a type for phone number property configs.

func (PhoneNumberPropertyConfig) GetID

GetID returns the ID of the PhoneNumberPropertyConfig.

func (PhoneNumberPropertyConfig) GetType

GetType returns the Type of the PhoneNumberPropertyConfig.s

type Properties

type Properties map[string]Property

Properties is a map of property.

func (*Properties) UnmarshalJSON

func (p *Properties) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for Properties

type Property

type Property interface {
	GetID() string
	GetType() PropertyType
}

Property is an interface for Notion properties.

type PropertyArray

type PropertyArray []Property

PropertyArray is a slice of Notion properties.

func (*PropertyArray) UnmarshalJSON

func (arr *PropertyArray) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for PropertyArray

type PropertyConfig

type PropertyConfig interface {
	GetType() PropertyConfigType
	GetID() PropertyID
}

PropertyConfig is an interface for property configs.

type PropertyConfigType

type PropertyConfigType string

PropertyConfigType is a type for property config types.

const (
	PropertyConfigTypeTitle       PropertyConfigType = "title"
	PropertyConfigTypeRichText    PropertyConfigType = "rich_text"
	PropertyConfigTypeNumber      PropertyConfigType = "number"
	PropertyConfigTypeSelect      PropertyConfigType = "select"
	PropertyConfigTypeMultiSelect PropertyConfigType = "multi_select"
	PropertyConfigTypeDate        PropertyConfigType = "date"
	PropertyConfigTypePeople      PropertyConfigType = "people"
	PropertyConfigTypeFiles       PropertyConfigType = "files"
	PropertyConfigTypeCheckbox    PropertyConfigType = "checkbox"
	PropertyConfigTypeURL         PropertyConfigType = "url"
	PropertyConfigTypeEmail       PropertyConfigType = "email"
	PropertyConfigTypePhoneNumber PropertyConfigType = "phone_number"
	PropertyConfigTypeFormula     PropertyConfigType = "formula"
	PropertyConfigTypeRelation    PropertyConfigType = "relation"
	PropertyConfigTypeRollup      PropertyConfigType = "rollup"
	PropertyConfigCreatedTime     PropertyConfigType = "created_time"
	PropertyConfigCreatedBy       PropertyConfigType = "created_by"
	PropertyConfigLastEditedTime  PropertyConfigType = "last_edited_time"
	PropertyConfigLastEditedBy    PropertyConfigType = "last_edited_by"
	PropertyConfigStatus          PropertyConfigType = "status"
	PropertyConfigUniqueID        PropertyConfigType = "unique_id"
	PropertyConfigVerification    PropertyConfigType = "verification"
	PropertyConfigButton          PropertyConfigType = "button"
)

nolint:revive

type PropertyConfigs

type PropertyConfigs map[string]PropertyConfig

PropertyConfigs is a map of property configs.

func (*PropertyConfigs) UnmarshalJSON

func (p *PropertyConfigs) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for PropertyConfigs

type PropertyFilter

type PropertyFilter struct {
	Property    string                      `json:"property"`
	RichText    *TextFilterCondition        `json:"rich_text,omitempty"`
	Number      *NumberFilterCondition      `json:"number,omitempty"`
	Checkbox    *CheckboxFilterCondition    `json:"checkbox,omitempty"`
	Select      *SelectFilterCondition      `json:"select,omitempty"`
	MultiSelect *MultiSelectFilterCondition `json:"multi_select,omitempty"`
	Date        *DateFilterCondition        `json:"date,omitempty"`
	People      *PeopleFilterCondition      `json:"people,omitempty"`
	Files       *FilesFilterCondition       `json:"files,omitempty"`
	Relation    *RelationFilterCondition    `json:"relation,omitempty"`
	Formula     *FormulaFilterCondition     `json:"formula,omitempty"`
	Rollup      *RollupFilterCondition      `json:"rollup,omitempty"`
	Status      *StatusFilterCondition      `json:"status,omitempty"`
	UniqueID    *UniqueIDFilterCondition    `json:"unique_id,omitempty"`
}

PropertyFilter is a type for property filters.

type PropertyID

type PropertyID string

PropertyID is a type for property IDs.

func (PropertyID) String

func (pID PropertyID) String() string

String returns the string representation of the PropertyID.

type PropertyType

type PropertyType string

PropertyType is a type for Notion property types.

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

nolint:revive

type Quote

type Quote struct {
	AtomChildren

	RichText RichTexts `json:"rich_text"`
	Color    string    `json:"color,omitempty"`
}

Quote is a type for quote blocks

type QuoteBlock

type QuoteBlock struct {
	BasicBlock
	Quote Quote `json:"quote"`
}

QuoteBlock is a Notion block for quote blocks

func NewQuoteBlock

func NewQuoteBlock(q Quote) *QuoteBlock

NewQuoteBlock creates a new QuoteBlock

func (*QuoteBlock) AppendChildren added in v0.0.3

func (b *QuoteBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*QuoteBlock) SetBasicBlock added in v0.0.3

func (b *QuoteBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*QuoteBlock) SetChildren

func (b *QuoteBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type RateLimitedError

type RateLimitedError struct {
	Message string
}

RateLimitedError is a type for rate-limited errors.

func (*RateLimitedError) Error

func (e *RateLimitedError) Error() string

Error implements the error interface.

type Relation

type Relation struct {
	ID PageID `json:"id"`
}

Relation is a type for relation.

type RelationConfig

type RelationConfig struct {
	DatabaseID         DatabaseID         `json:"database_id"`
	SyncedPropertyID   PropertyID         `json:"synced_property_id,omitempty"`
	SyncedPropertyName string             `json:"synced_property_name,omitempty"`
	Type               RelationConfigType `json:"type,omitempty"`
	SingleProperty     *SingleProperty    `json:"single_property,omitempty"`
	DualProperty       *DualProperty      `json:"dual_property,omitempty"`
}

RelationConfig is a type for relation configs.

type RelationConfigType

type RelationConfigType string

RelationConfigType is a type for relation config types.

const (
	RelationSingleProperty RelationConfigType = "single_property"
	RelationDualProperty   RelationConfigType = "dual_property"
)

nolint:revive

func (RelationConfigType) String

func (rp RelationConfigType) String() string

String returns the string representation of the RelationConfigType.

type RelationFilterCondition

type RelationFilterCondition 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"`
}

RelationFilterCondition is a type for relation filter conditions.

type RelationObject

type RelationObject struct {
	Database           DatabaseID `json:"database"`
	SyncedPropertyName string     `json:"synced_property_name"`
}

RelationObject TODO: should be part of PropertyConfigs, right?

type RelationProperty

type RelationProperty struct {
	ID       ObjectID     `json:"id,omitempty"`
	Type     PropertyType `json:"type,omitempty"`
	Relation []Relation   `json:"relation"`
}

RelationProperty is a type for relation property.

func (RelationProperty) GetID

func (p RelationProperty) GetID() string

GetID returns the ID of the RelationProperty.

func (RelationProperty) GetType

func (p RelationProperty) GetType() PropertyType

GetType returns the Type of the RelationProperty.

type RelationPropertyConfig

type RelationPropertyConfig struct {
	Type     PropertyConfigType `json:"type"`
	Relation RelationConfig     `json:"relation"`
}

RelationPropertyConfig is a type for relation property configs.

func (RelationPropertyConfig) GetID

GetID returns the ID of the RelationPropertyConfig.

func (RelationPropertyConfig) GetType

GetType returns the Type of the RelationPropertyConfig.

type RichText

type RichText struct {
	Type RichTextType `json:"type,omitempty"`

	Text     *Text     `json:"text,omitempty"`
	Mention  *Mention  `json:"mention,omitempty"`
	Equation *Equation `json:"equation,omitempty"`

	Annotations *Annotations `json:"annotations,omitempty"`

	// PlainText is the Text.Content or Mention.{*Name*} or Equation.Expression
	PlainText string `json:"plain_text,omitempty"`
	// Href is the Text.Link.Url or Mention.{*Href*}
	Href string `json:"href,omitempty"`
}

RichText is a rich text object

func NewDatabaseMentionRichText added in v0.0.3

func NewDatabaseMentionRichText(databaseID ObjectID) *RichText

NewDatabaseMentionRichText creates a new RichText with mention to the given database ID

func NewEquationBlock

func NewEquationBlock(expression string) *RichText

NewEquationBlock creates a new Equation block with the given equation expression

func NewEquationRichText added in v0.0.3

func NewEquationRichText(expression string) *RichText

NewEquationRichText creates a new RichText with the given equation expression

func NewLinkRichText

func NewLinkRichText(content, link string) RichText

NewLinkRichText creates a new RichText with the given content and link It fully builds the RichText object with all fields populated.

func NewPageMentionRichText added in v0.0.3

func NewPageMentionRichText(pageID ObjectID) *RichText

NewPageMentionRichText creates a new RichText with mention to the given page ID

func NewTextRichText

func NewTextRichText(text string) RichText

NewTextRichText creates a new RichText with the given text It fully builds the RichText object with all fields populated.

func NewUserMentionRichText added in v0.0.3

func NewUserMentionRichText(userID ObjectID) *RichText

NewUserMentionRichText creates a new RichText with mention to the given user ID

func (RichText) WithBold added in v0.0.3

func (rt RichText) WithBold() RichText

WithBold makes a new RichText annotated as bold text

func (RichText) WithCode added in v0.0.3

func (rt RichText) WithCode() RichText

WithCode makes a new RichText annotated as code text

func (RichText) WithColor added in v0.0.3

func (rt RichText) WithColor(color Color) RichText

WithColor makes a new RichText annotated as colored text

func (RichText) WithItalic added in v0.0.3

func (rt RichText) WithItalic() RichText

WithItalic makes a new RichText annotated as italic text

func (rt RichText) WithLink(destination string) RichText

WithLink makes a new RichText with a link to the given destination

func (RichText) WithStrikethrough added in v0.0.3

func (rt RichText) WithStrikethrough() RichText

WithStrikethrough makes a new RichText annotated as strikethrough text

func (RichText) WithUnderline added in v0.0.3

func (rt RichText) WithUnderline() RichText

WithUnderline makes a new RichText annotated as underline text

type RichTextProperty

type RichTextProperty struct {
	ID       PropertyID   `json:"id,omitempty"`
	Type     PropertyType `json:"type,omitempty"`
	RichText RichTexts    `json:"rich_text"`
}

RichTextProperty is a type for rich text property.

func (RichTextProperty) GetID

func (p RichTextProperty) GetID() string

GetID returns the ID of the RichTextProperty.

func (RichTextProperty) GetType

func (p RichTextProperty) GetType() PropertyType

GetType returns the Type of the RichTextProperty.

type RichTextPropertyConfig

type RichTextPropertyConfig struct {
	ID       PropertyID         `json:"id,omitempty"`
	Type     PropertyConfigType `json:"type"`
	RichText any                `json:"rich_text"`
}

RichTextPropertyConfig is a type for rich text property configs.

func (RichTextPropertyConfig) GetID

GetID returns the ID of the RichTextPropertyConfig.

func (RichTextPropertyConfig) GetType

GetType returns the Type of the RichTextPropertyConfig.

type RichTextType

type RichTextType string

RichTextType is a type of a RichText

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

nolint:revive

func (RichTextType) String

func (t RichTextType) String() string

String returns the string representation of the RichTextType

type RichTexts added in v0.0.3

type RichTexts []RichText

RichTexts is a slice of RichText

type Rollup

type Rollup struct {
	Type   RollupType    `json:"type,omitempty"`
	Number float64       `json:"number,omitempty"`
	Date   *DateObject   `json:"date,omitempty"`
	Array  PropertyArray `json:"array,omitempty"`
}

Rollup is a type for rollup.

type RollupConfig

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

RollupConfig is a type for rollup configs.

type RollupFilterCondition

type RollupFilterCondition struct {
	Any    *RollupSubfilterCondition `json:"any,omitempty"`
	None   *RollupSubfilterCondition `json:"none,omitempty"`
	Every  *RollupSubfilterCondition `json:"every,omitempty"`
	Date   *DateFilterCondition      `json:"date,omitempty"`
	Number *NumberFilterCondition    `json:"number,omitempty"`
}

RollupFilterCondition is a type for rollup filter conditions.

type RollupProperty

type RollupProperty struct {
	ID     ObjectID     `json:"id,omitempty"`
	Type   PropertyType `json:"type,omitempty"`
	Rollup Rollup       `json:"rollup"`
}

RollupProperty is a type for rollup property.

func (RollupProperty) GetID

func (p RollupProperty) GetID() string

GetID returns the ID of the RollupProperty.

func (RollupProperty) GetType

func (p RollupProperty) GetType() PropertyType

GetType returns the Type of the RollupProperty.

type RollupPropertyConfig

type RollupPropertyConfig struct {
	ID     PropertyID         `json:"id,omitempty"`
	Type   PropertyConfigType `json:"type"`
	Rollup RollupConfig       `json:"rollup"`
}

RollupPropertyConfig is a type for rollup property configs.

func (RollupPropertyConfig) GetID

func (p RollupPropertyConfig) GetID() PropertyID

GetID returns the ID of the RollupPropertyConfig.

func (RollupPropertyConfig) GetType

GetType returns the Type of the RollupPropertyConfig.

type RollupSubfilterCondition

type RollupSubfilterCondition struct {
	RichText    *TextFilterCondition        `json:"rich_text,omitempty"`
	Number      *NumberFilterCondition      `json:"number,omitempty"`
	Checkbox    *CheckboxFilterCondition    `json:"checkbox,omitempty"`
	Select      *SelectFilterCondition      `json:"select,omitempty"`
	MultiSelect *MultiSelectFilterCondition `json:"multiSelect,omitempty"`
	Relation    *RelationFilterCondition    `json:"relation,omitempty"`
	Date        *DateFilterCondition        `json:"date,omitempty"`
	People      *PeopleFilterCondition      `json:"people,omitempty"`
	Files       *FilesFilterCondition       `json:"files,omitempty"`
}

RollupSubfilterCondition is a type for rollup subfilter conditions.

type RollupType

type RollupType string

RollupType is a type for rollup types.

const (
	RollupTypeNumber RollupType = "number"
	RollupTypeDate   RollupType = "date"
	RollupTypeArray  RollupType = "array"
)

nolint:revive

type SearchFilter

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

SearchFilter is a type for search filters.

type SearchRequest

type SearchRequest struct {
	// The text that the API compares page and database titles against.
	Query string `json:"query,omitempty"`
	// A set of criteria, direction and timestamp keys, that orders the results.
	// The only supported timestamp value is "last_edited_time". Supported
	// direction values are "ascending" and "descending". If sort is not provided,
	// then the most recently edited results are returned first.
	Sort *SortObject `json:"sort,omitempty"`
	// A set of criteria, value and property keys, that limits the results to
	// either only pages or only databases. Possible value values are "page" or
	// "database". The only supported property value is "object".
	Filter SearchFilter `json:"filter,omitempty"`
	// A cursor value returned in a previous response that If supplied, limits the
	// response to results starting after the cursor. If not supplied, then the
	// first page of results is returned. Refer to pagination for more details.
	StartCursor Cursor `json:"start_cursor,omitempty"`
	// The number of items from the full list to include in the response. Maximum: 100.
	PageSize int `json:"page_size,omitempty"`
}

SearchRequest represents the request body for SearchClient.Do.

type SearchResponse

type SearchResponse struct {
	AtomPaginatedResponse
	Results Objects `json:"results"`
}

SearchResponse is a type for search response.

func (*SearchResponse) UnmarshalJSON

func (sr *SearchResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshalling for SearchResponse

type SearchService

type SearchService struct {
	// contains filtered or unexported fields
}

SearchService is a service for the Search Notion API.

func (*SearchService) Do

Do searches all parent or child pages and databases that have been shared with an integration.

Returns all pages or databases, excluding duplicated linked databases, that have titles that include the query param. If no query param is provided, then the response contains all pages or databases that have been shared with the integration. The results adhere to any limitations related to an integration’s capabilities.

To limit the request to search only pages or to search only databases, use the filter param.

See https://developers.notion.com/reference/post-search

type Select

type Select struct {
	Options Options `json:"options"`
}

Select is a type for select configs.

type SelectFilterCondition

type SelectFilterCondition struct {
	Equals       string `json:"equals,omitempty"`
	DoesNotEqual string `json:"does_not_equal,omitempty"`
	IsEmpty      bool   `json:"is_empty,omitempty"`
	IsNotEmpty   bool   `json:"is_not_empty,omitempty"`
}

SelectFilterCondition is a type for select filter conditions.

type SelectProperty

type SelectProperty struct {
	ID     ObjectID     `json:"id,omitempty"`
	Type   PropertyType `json:"type,omitempty"`
	Select Option       `json:"select"`
}

SelectProperty is a type for select property.

func (SelectProperty) GetID

func (p SelectProperty) GetID() string

GetID returns the ID of the SelectProperty.

func (SelectProperty) GetType

func (p SelectProperty) GetType() PropertyType

GetType returns the Type of the SelectProperty.

type SelectPropertyConfig

type SelectPropertyConfig struct {
	ID     PropertyID         `json:"id,omitempty"`
	Type   PropertyConfigType `json:"type"`
	Select Select             `json:"select"`
}

SelectPropertyConfig is a type for select property configs.

func (SelectPropertyConfig) GetID

func (p SelectPropertyConfig) GetID() PropertyID

GetID returns the ID of the SelectPropertyConfig.

func (SelectPropertyConfig) GetType

GetType returns the Type of the SelectPropertyConfig.

type SingleProperty

type SingleProperty struct{}

SingleProperty is a type for single properties.

type SortObject

type SortObject struct {
	Property  string        `json:"property,omitempty"`
	Timestamp TimestampType `json:"timestamp,omitempty"`
	Direction SortOrder     `json:"direction,omitempty"`
}

SortObject is a type for sort object.

type SortOrder

type SortOrder string

SortOrder is a type for sort order.

const (
	SortOrderASC  SortOrder = "ascending"
	SortOrderDESC SortOrder = "descending"
)

nolint:revive

type Status

type Status = Option

Status is a type for status.

type StatusConfig

type StatusConfig struct {
	Options Options       `json:"options"`
	Groups  []GroupConfig `json:"groups"`
}

StatusConfig is a type for status configs.

type StatusFilterCondition

type StatusFilterCondition struct {
	Equals       string `json:"equals,omitempty"`
	DoesNotEqual string `json:"does_not_equal,omitempty"`
	IsEmpty      bool   `json:"is_empty,omitempty"`
	IsNotEmpty   bool   `json:"is_not_empty,omitempty"`
}

StatusFilterCondition is a type for status filter conditions.

type StatusProperty

type StatusProperty struct {
	ID     ObjectID     `json:"id,omitempty"`
	Type   PropertyType `json:"type,omitempty"`
	Status Status       `json:"status"`
}

StatusProperty is a type for status property.

func (StatusProperty) GetID

func (p StatusProperty) GetID() string

GetID returns the ID of the StatusProperty.

func (StatusProperty) GetType

func (p StatusProperty) GetType() PropertyType

GetType returns the Type of the StatusProperty.

type StatusPropertyConfig

type StatusPropertyConfig struct {
	ID     PropertyID         `json:"id"`
	Type   PropertyConfigType `json:"type"`
	Status StatusConfig       `json:"status"`
}

StatusPropertyConfig is a type for status property configs.

func (StatusPropertyConfig) GetID

func (p StatusPropertyConfig) GetID() PropertyID

GetID returns the ID of the StatusPropertyConfig.

func (StatusPropertyConfig) GetType

GetType returns the Type of the StatusPropertyConfig.

type Synced

type Synced struct {
	AtomChildren

	// SyncedFrom is nil for the original block.
	SyncedFrom *SyncedFrom `json:"synced_from"`
}

Synced is a type for synced blocks

type SyncedBlock

type SyncedBlock struct {
	BasicBlock
	Synced Synced `json:"synced_block"`
}

SyncedBlock is a Notion block for synced blocks

func NewSyncedBlock

func NewSyncedBlock(s Synced) *SyncedBlock

NewSyncedBlock creates a new SyncedBlock

func (*SyncedBlock) AppendChildren added in v0.0.3

func (b *SyncedBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*SyncedBlock) SetBasicBlock added in v0.0.3

func (b *SyncedBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*SyncedBlock) SetChildren

func (b *SyncedBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type SyncedFrom

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

SyncedFrom holds the ID of the original block

type Table

type Table struct {
	AtomChildren

	TableWidth      int  `json:"table_width"`
	HasColumnHeader bool `json:"has_column_header"`
	HasRowHeader    bool `json:"has_row_header"`
}

Table is a type for table blocks

type TableBlock

type TableBlock struct {
	BasicBlock
	Table Table `json:"table"`
}

TableBlock is a Notion block for table blocks

func NewTableBlock

func NewTableBlock(table Table) *TableBlock

NewTableBlock creates a new TableBlock

func (*TableBlock) AppendChildren added in v0.0.3

func (b *TableBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*TableBlock) SetBasicBlock added in v0.0.3

func (b *TableBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*TableBlock) SetChildren

func (b *TableBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type TableOfContents

type TableOfContents struct {
	// empty
	Color string `json:"color,omitempty"`
}

TableOfContents is a type for table of contents blocks

type TableOfContentsBlock

type TableOfContentsBlock struct {
	BasicBlock
	TableOfContents TableOfContents `json:"table_of_contents"`
}

TableOfContentsBlock is a Notion block for table of contents blocks

func NewTableOfContentsBlock

func NewTableOfContentsBlock(toc TableOfContents) *TableOfContentsBlock

NewTableOfContentsBlock creates a new TableOfContentsBlock

func (*TableOfContentsBlock) SetBasicBlock added in v0.0.3

func (b *TableOfContentsBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type TableRow

type TableRow struct {
	Cells []RichTexts `json:"cells"`
}

TableRow is a type for table row blocks

type TableRowBlock

type TableRowBlock struct {
	BasicBlock
	TableRow TableRow `json:"table_row"`
}

TableRowBlock is a Notion block for table row blocks

func NewTableRowBlock

func NewTableRowBlock(tr TableRow) *TableRowBlock

NewTableRowBlock creates a new TableRowBlock

func (*TableRowBlock) SetBasicBlock added in v0.0.3

func (b *TableRowBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type Template

type Template struct {
	AtomChildren
	RichText RichTexts `json:"rich_text"`
}

Template is a type for template blocks

type TemplateBlock

type TemplateBlock struct {
	BasicBlock
	Template Template `json:"template"`
}

TemplateBlock is a Notion block for template blocks Deprecated

func NewTemplateBlock

func NewTemplateBlock(t Template) *TemplateBlock

NewTemplateBlock creates a new TemplateBlock Deprecated

func (*TemplateBlock) AppendChildren added in v0.0.3

func (b *TemplateBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*TemplateBlock) SetBasicBlock added in v0.0.3

func (b *TemplateBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*TemplateBlock) SetChildren

func (b *TemplateBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type TemplateMention

type TemplateMention struct {
	Type                TemplateMentionType `json:"type"`
	TemplateMentionUser string              `json:"template_mention_user,omitempty"`
	TemplateMentionDate string              `json:"template_mention_date,omitempty"`
}

TemplateMention is a template Mention object.

type TemplateMentionType

type TemplateMentionType string

TemplateMentionType is a type of a template mention

const (
	TemplateMentionTypeUser TemplateMentionType = "template_mention_user"
	TemplateMentionTypeDate TemplateMentionType = "template_mention_date"
)

nolint:revive

func (TemplateMentionType) String

func (t TemplateMentionType) String() string

String returns the string representation of the TemplateMentionType

type Text

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

Text is a text object for RichText.{Type==RichTextTypeText}

type TextFilterCondition

type TextFilterCondition 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"`
}

TextFilterCondition is a type for text filter conditions.

type TextProperty

type TextProperty struct {
	ID   PropertyID   `json:"id,omitempty"`
	Type PropertyType `json:"type,omitempty"`
	Text RichTexts    `json:"text"`
}

TextProperty is a type for text property.

func (TextProperty) GetID

func (p TextProperty) GetID() string

GetID returns the ID of the TextProperty.

func (TextProperty) GetType

func (p TextProperty) GetType() PropertyType

GetType returns the Type of the TextProperty.

type TimestampFilter

type TimestampFilter struct {
	Timestamp      TimestampType        `json:"timestamp"`
	CreatedTime    *DateFilterCondition `json:"created_time,omitempty"`
	LastEditedTime *DateFilterCondition `json:"last_edited_time,omitempty"`
}

TimestampFilter is a type for timestamp filters.

type TimestampType

type TimestampType string

TimestampType is a type for timestamp type.

const (
	TimestampCreated    TimestampType = "created_time"
	TimestampLastEdited TimestampType = "last_edited_time"
)

nolint:revive

type TitleProperty

type TitleProperty struct {
	ID    PropertyID   `json:"id,omitempty"`
	Type  PropertyType `json:"type,omitempty"`
	Title RichTexts    `json:"title"`
}

TitleProperty is a type for title property.

func (TitleProperty) GetID

func (p TitleProperty) GetID() string

GetID returns the ID of the TitleProperty.

func (TitleProperty) GetType

func (p TitleProperty) GetType() PropertyType

GetType returns the Type of the TitleProperty.

type TitlePropertyConfig

type TitlePropertyConfig struct {
	ID    PropertyID         `json:"id,omitempty"`
	Type  PropertyConfigType `json:"type"`
	Title any                `json:"title"`
}

TitlePropertyConfig is a type for title property configs.

func (TitlePropertyConfig) GetID

func (p TitlePropertyConfig) GetID() PropertyID

GetID returns the ID of the TitlePropertyConfig.

func (TitlePropertyConfig) GetType

GetType returns the Type of the TitlePropertyConfig.

type ToDo

type ToDo struct {
	AtomChildren
	RichText RichTexts `json:"rich_text"`
	Checked  bool      `json:"checked"`
	Color    string    `json:"color,omitempty"`
}

ToDo is a type for to-do blocks

type ToDoBlock

type ToDoBlock struct {
	BasicBlock
	ToDo ToDo `json:"to_do"`
}

ToDoBlock is a Notion block for to-do blocks

func NewToDoBlock

func NewToDoBlock(t ToDo) *ToDoBlock

NewToDoBlock creates a new ToDoBlock

func (*ToDoBlock) AppendChildren added in v0.0.3

func (b *ToDoBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*ToDoBlock) SetBasicBlock added in v0.0.3

func (b *ToDoBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*ToDoBlock) SetChildren

func (b *ToDoBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type Toggle

type Toggle struct {
	AtomChildren
	RichText RichTexts `json:"rich_text"`
	Color    string    `json:"color,omitempty"`
}

Toggle is a type for toggle blocks

type ToggleBlock

type ToggleBlock struct {
	BasicBlock
	Toggle Toggle `json:"toggle"`
}

ToggleBlock is a Notion block for toggle blocks

func NewToggleBlock

func NewToggleBlock(t Toggle) *ToggleBlock

NewToggleBlock creates a new ToggleBlock

func (*ToggleBlock) AppendChildren added in v0.0.3

func (b *ToggleBlock) AppendChildren(children ...Block)

AppendChildren calls inner .AppendChildren + updates the HasChildren field

func (*ToggleBlock) SetBasicBlock added in v0.0.3

func (b *ToggleBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

func (*ToggleBlock) SetChildren

func (b *ToggleBlock) SetChildren(children Blocks)

SetChildren calls inner .SetChildren + updates the HasChildren field

type Token

type Token string

Token is a type for Notion API tokens.

func (Token) String

func (t Token) String() string

String returns the string representation of the Token.

type TokenCreateError

type TokenCreateError struct {
	Code    ErrorCode `json:"error"`
	Message string    `json:"error_description"`
}

TokenCreateError is a type for token creation errors.

func (*TokenCreateError) Error

func (e *TokenCreateError) Error() string

Error implements the error interface.

type TokenCreateRequest

type TokenCreateRequest struct {
	// A unique random code that Notion generates to authenticate with your service,
	// generated when a user initiates the OAuth flow.
	Code string `json:"code"`
	// A constant string: "authorization_code".
	GrantType string `json:"grant_type"`
	// The "redirect_uri" that was provided in the OAuth Domain & URI section of
	// the integration's Authorization settings. Do not include this field if a
	// "redirect_uri" query param was not included in the Authorization URL
	// provided to users. In most cases, this field is required.
	RedirectURI string `json:"redirect_uri,omitempty"`
	// Required if and only when building Link Preview integrations (otherwise
	// ignored). An object with key and name properties. key should be a unique
	// identifier for the account. Notion uses the key to determine whether or not
	// the user is re-connecting the same account. name should be some way for the
	// user to know which account they used to authenticate with your service. If
	// a user has authenticated Notion with your integration before and key is the
	// same but name is different, then Notion updates the name associated with
	// your integration.
	ExternalAccount ExternalAccount `json:"external_account,omitempty"`
}

TokenCreateRequest represents the request body for AuthenticationClient.CreateToken.

type TokenCreateResponse

type TokenCreateResponse struct {
	AccessToken          string `json:"access_token"`
	BotID                string `json:"bot_id"`
	DuplicatedTemplateID string `json:"duplicated_template_id,omitempty"`

	// Owner can be { "workspace": true } OR a User object.
	// Ref: https://developers.notion.com/docs/authorization#step-4-notion-responds-with-an-access_token-and-some-additional-information
	Owner         any    `json:"owner,omitempty"`
	WorkspaceIcon string `json:"workspace_icon"`
	WorkspaceID   string `json:"workspace_id"`
	WorkspaceName string `json:"workspace_name"`
}

TokenCreateResponse is a type for token create response.

type URLProperty

type URLProperty struct {
	ID   ObjectID     `json:"id,omitempty"`
	Type PropertyType `json:"type,omitempty"`
	URL  string       `json:"url"`
}

URLProperty is a type for URL property.

func (URLProperty) GetID

func (p URLProperty) GetID() string

GetID returns the ID of the URLProperty.

func (URLProperty) GetType

func (p URLProperty) GetType() PropertyType

GetType returns the Type of the URLProperty.

type URLPropertyConfig

type URLPropertyConfig struct {
	ID   PropertyID         `json:"id,omitempty"`
	Type PropertyConfigType `json:"type"`
	URL  any                `json:"url"`
}

URLPropertyConfig is a type for URL property configs.

func (URLPropertyConfig) GetID

func (p URLPropertyConfig) GetID() PropertyID

GetID returns the ID of the URLPropertyConfig.

func (URLPropertyConfig) GetType

GetType returns the Type of the URLPropertyConfig.

type UniqueID

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

UniqueID is a type for unique ID.

func (UniqueID) String

func (uID UniqueID) String() string

String returns the string representation of the UniqueID.

type UniqueIDConfig

type UniqueIDConfig struct {
	Prefix string `json:"prefix"`
}

UniqueIDConfig is a type for unique ID configs.

type UniqueIDFilterCondition added in v0.0.3

type UniqueIDFilterCondition struct {
	Equals               *int `json:"equals,omitempty"`
	DoesNotEqual         *int `json:"does_not_equal,omitempty"`
	GreaterThan          *int `json:"greater_than,omitempty"`
	LessThan             *int `json:"less_than,omitempty"`
	GreaterThanOrEqualTo *int `json:"greater_than_or_equal_to,omitempty"`
	LessThanOrEqualTo    *int `json:"less_than_or_equal_to,omitempty"`
}

UniqueIDFilterCondition is a type for unique ID filter conditions.

type UniqueIDProperty

type UniqueIDProperty struct {
	ID       ObjectID     `json:"id,omitempty"`
	Type     PropertyType `json:"type,omitempty"`
	UniqueID UniqueID     `json:"unique_id"`
}

UniqueIDProperty is a type for unique ID property.

func (UniqueIDProperty) GetID

func (p UniqueIDProperty) GetID() string

GetID returns the ID of the UniqueIDProperty.

func (UniqueIDProperty) GetType

func (p UniqueIDProperty) GetType() PropertyType

GetType returns the Type of the UniqueIDProperty.

type UniqueIDPropertyConfig

type UniqueIDPropertyConfig struct {
	ID       PropertyID         `json:"id,omitempty"`
	Type     PropertyConfigType `json:"type"`
	UniqueID UniqueIDConfig     `json:"unique_id"`
}

UniqueIDPropertyConfig is a type for unique ID property configs.

func (UniqueIDPropertyConfig) GetID

GetID returns the ID of the UniqueIDPropertyConfig.

func (UniqueIDPropertyConfig) GetType

GetType returns the Type of the UniqueIDPropertyConfig.

type UnsupportedBlock

type UnsupportedBlock struct {
	BasicBlock
}

UnsupportedBlock is a Notion block for unsupported blocks

func NewUnsupportedBlock added in v0.0.3

func NewUnsupportedBlock() *UnsupportedBlock

NewUnsupportedBlock creates a new UnsupportedBlock

func (*UnsupportedBlock) SetBasicBlock added in v0.0.3

func (b *UnsupportedBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

type User

type User struct {
	AtomObject
	AtomID

	Type      UserType `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 is a Notion object that represents a user.

func NewBotUser added in v0.0.3

func NewBotUser(id UserID, bot *Bot) *User

NewBotUser returns a new User(Bot) with the given ID and Bot instance.

func NewPersonUser added in v0.0.3

func NewPersonUser(id UserID, email string) *User

NewPersonUser returns a new User(Person) with the given ID and email.

func (*User) IsBot added in v0.0.3

func (u *User) IsBot() bool

IsBot returns true if the User is a Bot.

func (*User) IsPerson added in v0.0.3

func (u *User) IsPerson() bool

IsPerson returns treu if the User is a Person.

type UserID

type UserID = ObjectID

UserID stands for ID of User object. User is an Object, so UserID is just an alias for Object

type UserMention added in v0.0.3

type UserMention struct {
	Object ObjectType `json:"object"` // always "user"
	ID     ObjectID   `json:"id"`
}

UserMention is a user mention object

type UserType

type UserType string

UserType stands for Type of User object.

const (
	UserTypePerson UserType = "person"
	UserTypeBot    UserType = "bot"
)

nolint:revive

type Users added in v0.0.3

type Users []*User

Users is a list of Users

type UsersListResponse

type UsersListResponse struct {
	Object     ObjectType `json:"object"`
	Results    Users      `json:"results"`
	HasMore    bool       `json:"has_more"`
	NextCursor Cursor     `json:"next_cursor"`
}

UsersListResponse stands for a paginated list of Users.

type UsersService added in v0.0.3

type UsersService struct {
	// contains filtered or unexported fields
}

UsersService is a service for Notion Users API.

func (*UsersService) Get added in v0.0.3

func (s *UsersService) Get(ctx context.Context, id UserID) (*User, error)

Get retrieves a User using the ID specified.

See https://developers.notion.com/reference/get-user

func (*UsersService) List added in v0.0.3

func (s *UsersService) List(ctx context.Context, pagination *Pagination) (*UsersListResponse, error)

List returns a paginated list of Users for the workspace. The response may containf fewer than page_size of results.

See https://developers.notion.com/reference/get-users

func (*UsersService) Me added in v0.0.3

func (s *UsersService) Me(ctx context.Context) (*User, error)

Me retrieves the bot User associated with the API token provided in the authorization header. The bot will have an owner field with information about the person who authorized the integration.

See https://developers.notion.com/reference/get-self

type Verification

type Verification struct {
	State      VerificationState `json:"state"`
	VerifiedBy *User             `json:"verified_by,omitempty"`
	Date       *DateObject       `json:"date,omitempty"`
}

Verification documented here: https://developers.notion.com/reference/page-property-values#verification

type VerificationProperty

type VerificationProperty struct {
	ID           ObjectID     `json:"id,omitempty"`
	Type         PropertyType `json:"type,omitempty"`
	Verification Verification `json:"verification"`
}

VerificationProperty is a type for verification property.

func (VerificationProperty) GetID

func (p VerificationProperty) GetID() string

GetID returns the ID of the VerificationProperty.

func (VerificationProperty) GetType

func (p VerificationProperty) GetType() PropertyType

GetType returns the Type of the VerificationProperty.

type VerificationPropertyConfig

type VerificationPropertyConfig struct {
	ID           PropertyID         `json:"id,omitempty"`
	Type         PropertyConfigType `json:"type,omitempty"`
	Verification Verification       `json:"verification"`
}

VerificationPropertyConfig is a type for verification property configs.

func (VerificationPropertyConfig) GetID

GetID returns the ID of the VerificationPropertyConfig.

func (VerificationPropertyConfig) GetType

GetType returns the Type of the VerificationPropertyConfig.

type VerificationState

type VerificationState string

VerificationState is a type for verification states.

const (
	VerificationStateVerified   VerificationState = "verified"
	VerificationStateUnverified VerificationState = "unverified"
)

nolint:revive

func (VerificationState) String

func (vs VerificationState) String() string

String returns the string representation of the VerificationState.

type VideoBlock

type VideoBlock struct {
	BasicBlock
	Video File `json:"video"`
}

VideoBlock is a Notion block for video files

func NewVideoBlock

func NewVideoBlock(video File) *VideoBlock

NewVideoBlock creates a new VideoBlock

func (*VideoBlock) GetExpiryTime added in v0.0.3

func (b *VideoBlock) GetExpiryTime() *time.Time

GetExpiryTime implements Media interface for VideoBlock

func (*VideoBlock) GetURL added in v0.0.3

func (b *VideoBlock) GetURL() string

GetURL implements Media interface for VideoBlock

func (*VideoBlock) SetBasicBlock added in v0.0.3

func (b *VideoBlock) SetBasicBlock(block BasicBlock) Block

SetBasicBlock implements the SetBasicBlock method of the BasicBlockHolder interface.

Directories

Path Synopsis
x
notionast
Package notionast provides a set of functions to work with Notion AST It is used to convert notion.Blocks to AST and vice versa It also provides Walk functionality to traverse the AST.
Package notionast provides a set of functions to work with Notion AST It is used to convert notion.Blocks to AST and vice versa It also provides Walk functionality to traverse the AST.

Jump to

Keyboard shortcuts

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