About notionapi

This is an unofficial, Go API for Mostly for reading, limited write capabilities.

It allows you to retrieve content of a Notion page in structured format.

You can then e.g. convert that format to HTML.

It's used in


You can learn how I reverse-engineered the Notion API in order to write this library.

Real-life usage

I use this API to publish my blog and series of programming books from content stored in Notion.

Notion serves as a CMS (Content Management System). I write and edit pages in Notion.

I use custom Go program to download Notion pages using this this library and converts pages to HTML. It then publishes the result to Netlify.

You can see the code at and

Implementations for other languages




View Source
const (
	// BlockAudio is audio embed (e.g. an mp3 file)
	BlockAudio = "audio"
	// BlockBookmark is a bookmark block
	BlockBookmark = "bookmark"
	// BlockBreadcrumb is breadcrumb block
	BlockBreadcrumb = "breadcrumb"
	// BlockBulletedList is a bulleted list block
	BlockBulletedList = "bulleted_list"
	// BlockCode is a code block
	BlockCode = "code"
	// BlockCodepen is embedded codepen block
	BlockCodepen = "codepen"
	// BlockCallout is a callout
	BlockCallout = "callout"
	// BlockColumn is a child of TypeColumnList
	BlockColumn = "column"
	// BlockColumnList is for multi-column. Number of columns is
	// number of content blocks of type TypeColumn
	BlockColumnList = "column_list"
	// BlockCollectionView is a collection view block for inline collections
	BlockCollectionView = "collection_view"
	// BlockCollectionViewPage is a page that is a collection
	BlockCollectionViewPage = "collection_view_page"
	// BlockComment is a comment block
	BlockComment = "comment"
	// BlockDivider is a divider block
	BlockDivider = "divider"
	// BlockDrive is embedded Google Drive file
	BlockDrive = "drive"
	// BlockEmbed is a generic oembed link
	BlockEmbed = "embed"
	// BlockEquation is TeX equation block
	BlockEquation = "equation"
	// BlockFactory represents a factory block
	BlockFactory = "factory"
	// BlockFigma represents figma embed
	BlockFigma = "figma"
	// BlockFile is an embedded file
	BlockFile = "file"
	// BlockGist is embedded gist block
	BlockGist = "gist"
	// BlockHeader is a header block
	BlockHeader = "header"
	// BlockImage is an image block
	BlockImage = "image"
	// BlockMaps is embedded Google Map block
	BlockMaps = "maps"
	// BlockNumberedList is a numbered list block
	BlockNumberedList = "numbered_list"
	// BlockPDF is an embedded pdf file
	BlockPDF = "pdf"
	// BlockPage is a notion Page
	BlockPage = "page"
	// BlockQuote is a quote block
	BlockQuote = "quote"
	// BlockSubHeader is a header block
	BlockSubHeader = "sub_header"
	// BlockSubSubHeader
	BlockSubSubHeader = "sub_sub_header"
	// BlockTableOfContents is table of contents
	BlockTableOfContents = "table_of_contents"
	// BlockText is a text block
	BlockText = "text"
	// BlockTodo is a todo block
	BlockTodo = "to_do"
	// BlockToggle is a toggle block
	BlockToggle = "toggle"
	// BlockTweet is embedded gist block
	BlockTweet = "tweet"
	// BlockVideo is youtube video embed
	BlockVideo = "video"
View Source
const (
	// value of Permission.Type
	PermissionUser   = "user_permission"
	PermissionPublic = "public_permission"
View Source
const (
	// TODO: those are probably CollectionViewType
	// CollectionViewTypeTable is a table block
	CollectionViewTypeTable = "table"
	// CollectionViewTypeTable is a lists block
	CollectionViewTypeList = "list"
View Source
const (
	// PermissionTypeUser describes permissions for a user
	PermissionTypeUser = "user_permission"
	// PermissionTypePublic describes permissions for public
	PermissionTypePublic = "public_permission"
View Source
const (
	ColumnTypeCheckbox       = "checkbox"
	ColumnTypeCreatedBy      = "created_by"
	ColumnTypeCreatedTime    = "created_time"
	ColumnTypeDate           = "date"
	ColumnTypeEmail          = "email"
	ColumnTypeFile           = "file"
	ColumnTypeForumula       = "formula"
	ColumnTypeLastEditedBy   = "last_edited_by"
	ColumnTypeLastEditedTime = "last_edited_time"
	ColumnTypeMultiSelect    = "multi_select"
	ColumnTypeNumber         = "number"
	ColumnTypePerson         = "person"
	ColumnTypePhoneNumber    = "phone_number"
	ColumnTypeRelation       = "relation"
	ColumnTypeRollup         = "rollup"
	ColumnTypeSelect         = "select"
	ColumnTypeText           = "text"
	ColumnTypeTitle          = "title"
	ColumnTypeURL            = "url"

    for Schema.Type

    View Source
    const (
    	// those are Record.Type and determine the type of Record.Value
    	TableSpace          = "space"
    	TableActivity       = "activity"
    	TableBlock          = "block"
    	TableUser           = "notion_user"
    	TableCollection     = "collection"
    	TableCollectionView = "collection_view"
    	TableComment        = "comment"
    	TableDiscussion     = "discussion"
    View Source
    const (
    	// RoleReader represents a reader
    	RoleReader = "reader"
    	// RoleEditor represents an editor
    	RoleEditor = "editor"
    View Source
    const (
    	// DateTypeDate represents a date in Date.Type
    	DateTypeDate = "date"
    	// DateTypeDateTime represents a datetime in Date.Type
    	DateTypeDateTime = "datetime"
    View Source
    const (
    	ExportTypeMarkdown = "markdown"
    	ExportTypeHTML     = "html"
    View Source
    const (
    	// AttrBold represents bold block
    	AttrBold = "b"
    	// AttrCode represents code block
    	AttrCode = "c"
    	// AttrItalic represents italic block
    	AttrItalic = "i"
    	// AttrStrikeThrought represents strikethrough block
    	AttrStrikeThrought = "s"
    	// AttrComment represents a comment block
    	AttrComment = "m"
    	// AttrLink represnts a link (url)
    	AttrLink = "a"
    	// AttrUser represents an id of a user
    	AttrUser = "u"
    	// AttrHighlight represents text high-light
    	AttrHighlight = "h"
    	// AttrDate represents a date
    	AttrDate = "d"
    	// AtttrPage represents a link to a Notion page
    	AttrPage = "p"
    View Source
    const (
    	CommandSet        = "set"
    	CommandUpdate     = "update"
    	CommandListAfter  = "listAfter"
    	CommandListRemove = "listRemove"

      Command Types

      View Source
      const (
      	// TextSpanSpecial is what Notion uses for text to represent @user and @date blocks
      	TextSpanSpecial = "‣"


      View Source
      var (
      	// PanicOnFailures will force panics on unexpected situations.
      	// This is for debugging
      	PanicOnFailures bool
      	// TODO: maybe a logger io.Writer instead?
      	// LogFunc allows intercepting debug logs
      	LogFunc func(format string, args ...interface{})


      func AttrGetComment

      func AttrGetComment(attr TextAttr) string

      func AttrGetHighlight

      func AttrGetHighlight(attr TextAttr) string
      func AttrGetLink(attr TextAttr) string

      func AttrGetPageID

      func AttrGetPageID(attr TextAttr) string

      func AttrGetType

      func AttrGetType(attr TextAttr) string

      func AttrGetUserID

      func AttrGetUserID(attr TextAttr) string

      func Dump

      func Dump(w io.Writer, page *Page)

        Dump writes a simple representation of Page to w. A debugging helper.

        func DumpToString

        func DumpToString(page *Page) string

          DumpToString returns a simple representation of Page as a string. A debugging helper.

          func ExtractNoDashIDFromNotionURL

          func ExtractNoDashIDFromNotionURL(uri string) string

            ExtractNoDashIDFromNotionURL tries to extract notion page id from notion URL, e.g. given: returns ea07db1b9bff415ab180b0525f3898f6 returns "" if didn't detect valid notion id in the url

            func ForEachBlock

            func ForEachBlock(blocks []*Block, cb func(*Block))

              ForEachBlock traverses the tree of blocks and calls cb on every block in depth-first order. To traverse every blocks in a Page, do: ForEachBlock([]*notionapi.Block{page.Root}, cb)

              func FormatDate

              func FormatDate(d *Date) string

                FormatDate provides default formatting for Date TODO: add time zone, maybe

                func GetFileContentType

                func GetFileContentType(file *os.File) (contentType string, err error)

                  GetFileContentType tries to figure out the content type of the file using http detection

                  func GetUserNameByID

                  func GetUserNameByID(page *Page, userID string) string

                    GetUserNameByID returns a full user name given user id it's a helper function

                    func IsErrPageNotFound

                    func IsErrPageNotFound(err error) bool

                      IsErrPageNotFound returns true if err is an instance of ErrPageNotFound

                      func IsValidDashID

                      func IsValidDashID(id string) bool

                        IsValidDashID returns true if id looks like a valid Notion dash id

                        func IsValidNoDashID

                        func IsValidNoDashID(id string) bool

                          IsValidNoDashID returns true if id looks like a valid Notion no dash id

                          func Logf

                          func Logf(format string, args ...interface{})

                            Logf is for debug logging, will log using LogFunc (if set)

                            func MaybePanic

                            func MaybePanic(format string, args ...interface{})

                              MaybePanic will panic if PanicOnFailures is true

                              func Now

                              func Now() int64

                                Now returns now in micro seconds as expected by the notion API

                                func ParseRecordMap

                                func ParseRecordMap(recordMap *RecordMap) error

                                func SafeName

                                func SafeName(s string) string

                                  SafeName returns a file-system safe name

                                  func TextSpansToString

                                  func TextSpansToString(blocks []*TextSpan) string

                                    TextSpansToString returns flattened content of inline blocks, without formatting

                                    func ToDashID

                                    func ToDashID(id string) string

                                      ToDashID convert id in format bb760e2dd6794b64b2a903005b21870a to bb760e2d-d679-4b64-b2a9-03005b21870a If id is not in that format, we leave it untouched.

                                      func ToNoDashID

                                      func ToNoDashID(id string) string

                                        ToNoDashID converts 2131b10c-ebf6-4938-a127-7089ff02dbe4 to 2131b10cebf64938a1277089ff02dbe4. If not in expected format, we leave it untouched


                                        type Activity

                                        type Activity struct {
                                        	Role string `json:"role"`
                                        	ID        string `json:"id"`
                                        	SpaceID   string `json:"space_id"`
                                        	StartTime string `json:"start_time"`
                                        	EndTime   string `json:"end_time"`
                                        	Type      string `json:"type"`
                                        	Version   int    `json:"version"`
                                        	ParentID    string `json:"parent_id"`
                                        	ParentTable string `json:"parent_table"`
                                        	// If the edit was to a block inside a regular page
                                        	NavigableBlockID string `json:"navigable_block_id"`
                                        	// If the edit was to a block inside a collection or collection row
                                        	CollectionID    string `json:"collection_id"`
                                        	CollectionRowID string `json:"collection_row_id"`
                                        	Edits []Edit `json:"edits"`
                                        	Index   int  `json:"index"`
                                        	Invalid bool `json:"invalid"`
                                        	RawJSON map[string]interface{} `json:"-"`

                                          Activity represents a Notion activity (ie. event)

                                          type AggregationResult

                                          type AggregationResult struct {
                                          	ID   string `json:"id"`
                                          	Type string `json:"type"`
                                          	// TODO: maybe json.Number? Shouldn't float64 cover both?
                                          	// When type is equal to date, value is an object.
                                          	Value interface{} `json:"value"`

                                            AggregationResult represents result of aggregation

                                            type Author

                                            type Author struct {
                                            	ID    string `json:"id"`
                                            	Table string `json:"table"`

                                              Author represents the author of an Edit

                                              type Block

                                              type Block struct {
                                              	// values that come from JSON
                                              	// a unique ID of the block
                                              	ID string `json:"id"`
                                              	// if false, the page is deleted
                                              	Alive bool `json:"alive"`
                                              	// List of block ids for that make up content of this block
                                              	// Use Content to get corresponding block (they are in the same order)
                                              	ContentIDs   []string `json:"content,omitempty"`
                                              	CopiedFrom   string   `json:"copied_from,omitempty"`
                                              	CollectionID string   `json:"collection_id,omitempty"` // for BlockCollectionView
                                              	// ID of the user who created this block
                                              	CreatedBy   string `json:"created_by"`
                                              	CreatedTime int64  `json:"created_time"`
                                              	CreatedByTable    string `json:"created_by_table"`     // e.g. "notion_user"
                                              	CreatedByID       string `json:"created_by_id"`        // e.g. "bb760e2d-d679-4b64-b2a9-03005b21870a",
                                              	LastEditedByTable string `json:"last_edited_by_table"` // e.g. "notion_user"
                                              	LastEditedByID    string `json:"last_edited_by_id"`    // e.g. "bb760e2d-d679-4b64-b2a9-03005b21870a"
                                              	// List of block ids with discussion content
                                              	DiscussionIDs []string `json:"discussion,omitempty"`
                                              	// those ids seem to map to storage in s3
                                              	FileIDs []string `json:"file_ids,omitempty"`
                                              	// TODO: don't know what this means
                                              	IgnoreBlockCount bool `json:"ignore_block_count,omitempty"`
                                              	// ID of the user who last edited this block
                                              	LastEditedBy   string `json:"last_edited_by"`
                                              	LastEditedTime int64  `json:"last_edited_time"`
                                              	// ID of parent Block
                                              	ParentID    string `json:"parent_id"`
                                              	ParentTable string `json:"parent_table"`
                                              	// not always available
                                              	Permissions *[]Permission          `json:"permissions,omitempty"`
                                              	Properties  map[string]interface{} `json:"properties,omitempty"`
                                              	// type of the block e.g. TypeText, TypePage etc.
                                              	Type string `json:"type"`
                                              	// blocks are versioned
                                              	Version int64 `json:"version"`
                                              	// for BlockCollectionView
                                              	ViewIDs []string `json:"view_ids,omitempty"`
                                              	// Parent of this block
                                              	Parent *Block `json:"-"`
                                              	// maps ContentIDs array to Block type
                                              	Content []*Block `json:"-"`
                                              	// this is for some types like TypePage, TypeText, TypeHeader etc.
                                              	InlineContent []*TextSpan `json:"-"`
                                              	// for BlockPage
                                              	Title string `json:"-"`
                                              	// For BlockTodo, a checked state
                                              	IsChecked bool `json:"-"`
                                              	// for BlockBookmark
                                              	Description string `json:"-"`
                                              	Link        string `json:"-"`
                                              	// for BlockBookmark it's the url of the page
                                              	// for BlockGist it's the url for the gist
                                              	// fot BlockImage it's url of the image, but use ImageURL instead
                                              	// because Source is sometimes not accessible
                                              	// for BlockFile it's url of the file
                                              	// for BlockEmbed it's url of the embed
                                              	Source string `json:"-"`
                                              	// for BlockFile
                                              	FileSize string `json:"-"`
                                              	// for BlockImage it's an URL built from Source that is always accessible
                                              	ImageURL string `json:"-"`
                                              	// for BlockCode
                                              	Code         string `json:"-"`
                                              	CodeLanguage string `json:"-"`
                                              	// for BlockCollectionView. There can be multiple views
                                              	// those correspond to ViewIDs
                                              	TableViews []*TableView `json:"-"`
                                              	Page *Page `json:"-"`
                                              	// RawJSON represents Block as
                                              	RawJSON map[string]interface{} `json:"-"`
                                              	// contains filtered or unexported fields

                                                Block describes a block

                                                func (*Block) BlockByID

                                                func (b *Block) BlockByID(id string) *Block

                                                func (*Block) CollectionByID

                                                func (b *Block) CollectionByID(id string) *Collection

                                                func (*Block) CollectionViewByID

                                                func (b *Block) CollectionViewByID(id string) *CollectionView

                                                func (*Block) CreatedOn

                                                func (b *Block) CreatedOn() time.Time

                                                  CreatedOn return the time the page was created

                                                  func (*Block) EmbedUploadedFileOps

                                                  func (b *Block) EmbedUploadedFileOps(client *Client, userID, fileID, fileURL string) (*Block, []*Operation)

                                                    EmbedFile creates a set of operations to embed a file into a block

                                                    func (*Block) FormatBookmark

                                                    func (b *Block) FormatBookmark() *FormatBookmark

                                                    func (*Block) FormatBulletedList

                                                    func (b *Block) FormatBulletedList() *FormatBulletedList

                                                    func (*Block) FormatCallout

                                                    func (b *Block) FormatCallout() *FormatCallout

                                                    func (*Block) FormatColumn

                                                    func (b *Block) FormatColumn() *FormatColumn

                                                    func (*Block) FormatEmbed

                                                    func (b *Block) FormatEmbed() *FormatEmbed

                                                    func (*Block) FormatHeader

                                                    func (b *Block) FormatHeader() *FormatHeader

                                                    func (*Block) FormatImage

                                                    func (b *Block) FormatImage() *FormatImage

                                                    func (*Block) FormatNumberedList

                                                    func (b *Block) FormatNumberedList() *FormatNumberedList

                                                    func (*Block) FormatPage

                                                    func (b *Block) FormatPage() *FormatPage

                                                      FormatPage returns decoded format property for BlockPage TODO: maybe separate FormatCollectionViewPage

                                                      func (*Block) FormatText

                                                      func (b *Block) FormatText() *FormatText

                                                      func (*Block) FormatToggle

                                                      func (b *Block) FormatToggle() *FormatToggle

                                                      func (*Block) FormatVideo

                                                      func (b *Block) FormatVideo() *FormatVideo

                                                      func (*Block) GetCaption

                                                      func (b *Block) GetCaption() []*TextSpan

                                                      func (*Block) GetProperty

                                                      func (b *Block) GetProperty(name string) []*TextSpan

                                                      func (*Block) GetTitle

                                                      func (b *Block) GetTitle() []*TextSpan

                                                      func (*Block) IsCode

                                                      func (b *Block) IsCode() bool

                                                        IsCode returns true if block represents a code block

                                                        func (*Block) IsEmbeddedType

                                                        func (b *Block) IsEmbeddedType() bool

                                                          IsEmbeddedType returns true if block represents an embedded type

                                                          func (*Block) IsImage

                                                          func (b *Block) IsImage() bool

                                                            IsImage returns true if block represents an image

                                                            func (*Block) IsLinkToPage

                                                            func (b *Block) IsLinkToPage() bool

                                                              IsLinkToPage returns true if block element is a link to a page (as opposed to embedded page)

                                                              func (*Block) IsPage

                                                              func (b *Block) IsPage() bool

                                                                IsPage returns true if block represents a page (either a sub-page or a link to a page)

                                                                func (*Block) IsSubPage

                                                                func (b *Block) IsSubPage() bool

                                                                  IsSubPage returns true if this is a sub-page (as opposed to link to a page that is not a child of that page)

                                                                  func (*Block) LastEditedOn

                                                                  func (b *Block) LastEditedOn() time.Time

                                                                    LastEditedOn returns the time the page was last updated

                                                                    func (*Block) ListAfterContentOp

                                                                    func (b *Block) ListAfterContentOp(id, afterID string) *Operation

                                                                      ListAfterContentOp creates an operation to list a child block block after another one if afterID is empty the block will be listed as the last one

                                                                      func (*Block) ListAfterFileIDsOp

                                                                      func (b *Block) ListAfterFileIDsOp(fileID string) *Operation

                                                                        ListAfterFileIDsOp creates an operation to set the file ID

                                                                        func (*Block) ListRemoveContentOp

                                                                        func (b *Block) ListRemoveContentOp(id string) *Operation

                                                                          ListRemoveContentOp creates an operation to remove a record from the block

                                                                          func (*Block) Prop

                                                                          func (b *Block) Prop(key string) (interface{}, bool)

                                                                          func (*Block) PropAsString

                                                                          func (b *Block) PropAsString(key string) (string, bool)

                                                                          func (*Block) SetTitleOp

                                                                          func (b *Block) SetTitleOp(title string) *Operation

                                                                            SetTitleOp creates an Operation to set the title property

                                                                            func (*Block) UpdateEmbeddedFileOps

                                                                            func (b *Block) UpdateEmbeddedFileOps(userID, fileID, fileURL string) []*Operation

                                                                              UpdateEmbeddedFileOps creates a set of operations to update an existing embedded file

                                                                              func (*Block) UpdateFormatOp

                                                                              func (b *Block) UpdateFormatOp(params interface{}) *Operation

                                                                                TODO: Make the input more strict UpdateFormatOp creates an operation to update the block's format

                                                                                func (*Block) UpdateOp

                                                                                func (b *Block) UpdateOp(block *Block) *Operation

                                                                                  TODO: Make this work somehow for all of Block's fields UpdateOp creates an operation to update the block

                                                                                  func (*Block) UpdatePropertiesOp

                                                                                  func (b *Block) UpdatePropertiesOp(source string) *Operation

                                                                                    TODO: Generalize this for the other fields UpdatePropertiesOp creates an op to update the block's properties

                                                                                    func (*Block) UserByID

                                                                                    func (b *Block) UserByID(id string) *User

                                                                                    type Client

                                                                                    type Client struct {
                                                                                    	// AuthToken allows accessing non-public pages.
                                                                                    	AuthToken string
                                                                                    	// HTTPClient allows over-riding http.Client to e.g. implement caching
                                                                                    	// on a per-request level
                                                                                    	HTTPClient *http.Client
                                                                                    	// Logger is used to log requests and responses for debugging.
                                                                                    	// By default is not set.
                                                                                    	Logger io.Writer
                                                                                    	// DebugLog enables debug logging
                                                                                    	DebugLog bool

                                                                                      Client is client for invoking Notion API

                                                                                      func (*Client) CreateEmailUser

                                                                                      func (c *Client) CreateEmailUser(email string) (*User, error)

                                                                                        CreateEmailUser invites a new user through his email address

                                                                                        func (*Client) DownloadFile

                                                                                        func (c *Client) DownloadFile(uri string, blockID string) (*DownloadFileResponse, error)

                                                                                          DownloadFile downloads a file stored in Notion

                                                                                          func (*Client) DownloadPage

                                                                                          func (c *Client) DownloadPage(pageID string) (*Page, error)

                                                                                            DownloadPage returns Notion page data given its id

                                                                                            func (*Client) ExportPages

                                                                                            func (c *Client) ExportPages(id string, exportType string, recursive bool) ([]byte, error)

                                                                                              ExportPages exports a page as html or markdown, potentially recursively

                                                                                              func (*Client) GetActivityLog

                                                                                              func (c *Client) GetActivityLog(spaceID string, startingAfterID string, limit int) (*GetActivityLogResponse, error)

                                                                                                GetActivityLog executes a raw API call /api/v3/getActivityLog. If startingAfterId is "", starts at the most recent log entry.

                                                                                                func (*Client) GetBlockRecords

                                                                                                func (c *Client) GetBlockRecords(ids []string) (*GetRecordValuesResponse, error)

                                                                                                  GetBlockRecords executes a raw API call /api/v3/getRecordValues to get records for blocks with given ids

                                                                                                  func (*Client) GetRecordValues

                                                                                                  func (c *Client) GetRecordValues(records []RecordRequest) (*GetRecordValuesResponse, error)

                                                                                                    GetRecordValues executes a raw API call /api/v3/getRecordValues

                                                                                                    func (*Client) GetSignedFileUrls

                                                                                                    func (c *Client) GetSignedFileUrls(urls []string, blockIDs []string) (*GetSignedFileUrlsResponse, error)

                                                                                                      GetSignedFileUrls executes a raw API call /api/v3/getSignedFileUrls For files (e.g. images) stored in Notion we need to get a temporary download url (which will be valid for only a short period of time)

                                                                                                      func (*Client) GetSubscriptionData

                                                                                                      func (c *Client) GetSubscriptionData(spaceID string) (*SubscriptionData, error)

                                                                                                        GetSubscriptionData executes a raw API call /api/v3/getSubscriptionData

                                                                                                        func (*Client) LoadPageChunk

                                                                                                        func (c *Client) LoadPageChunk(pageID string, chunkNo int, cur *cursor) (*LoadPageChunkResponse, error)

                                                                                                          LoadPageChunk executes a raw API call /api/v3/loadPageChunk

                                                                                                          func (*Client) LoadUserContent

                                                                                                          func (c *Client) LoadUserContent() (*LoadUserResponse, error)

                                                                                                          func (*Client) QueryCollection

                                                                                                          func (c *Client) QueryCollection(collectionID, collectionViewID string, q json.RawMessage, user *User) (*QueryCollectionResponse, error)

                                                                                                            QueryCollection executes a raw API call /api/v3/queryCollection

                                                                                                            func (*Client) RequestPageExportURL

                                                                                                            func (c *Client) RequestPageExportURL(id string, exportType string, recursive bool) (string, error)

                                                                                                              RequestPageExportURL executes a raw API call to enqueue an export of pages and returns the URL to the exported data once the task is complete

                                                                                                              func (*Client) SetNewRecordOp

                                                                                                              func (c *Client) SetNewRecordOp(userID string, parent *Block, recordType string) (newBlock *Block, operation *Operation)

                                                                                                                TODO: Support adding new records to collections and other non-block parent tables SetNewRecordOp creates an operation to create a new record

                                                                                                                func (*Client) SubmitTransaction

                                                                                                                func (c *Client) SubmitTransaction(ops []*Operation) error

                                                                                                                func (*Client) UploadFile

                                                                                                                func (c *Client) UploadFile(file *os.File) (fileID, fileURL string, err error)

                                                                                                                  UploadFile Uploads a file to notion's asset hosting(aws s3)

                                                                                                                  type Collection

                                                                                                                  type Collection struct {
                                                                                                                  	ID          string                   `json:"id"`
                                                                                                                  	Version     int                      `json:"version"`
                                                                                                                  	Name        interface{}              `json:"name"`
                                                                                                                  	Schema      map[string]*ColumnSchema `json:"schema"`
                                                                                                                  	Format      *CollectionFormat        `json:"format"`
                                                                                                                  	ParentID    string                   `json:"parent_id"`
                                                                                                                  	ParentTable string                   `json:"parent_table"`
                                                                                                                  	Alive       bool                     `json:"alive"`
                                                                                                                  	CopiedFrom  string                   `json:"copied_from"`
                                                                                                                  	Cover       string                   `json:"cover"`
                                                                                                                  	Description []interface{}            `json:"description"`
                                                                                                                  	// TODO: are those ever present?
                                                                                                                  	Type          string   `json:"type"`
                                                                                                                  	FileIDs       []string `json:"file_ids"`
                                                                                                                  	Icon          string   `json:"icon"`
                                                                                                                  	TemplatePages []string `json:"template_pages"`
                                                                                                                  	RawJSON map[string]interface{} `json:"-"`
                                                                                                                  	// contains filtered or unexported fields

                                                                                                                    Collection describes a collection

                                                                                                                    func (*Collection) GetName

                                                                                                                    func (c *Collection) GetName() string

                                                                                                                      GetName parses Name and returns as a string

                                                                                                                      type CollectionColumnOption

                                                                                                                      type CollectionColumnOption struct {
                                                                                                                      	Color string `json:"color"`
                                                                                                                      	ID    string `json:"id"`
                                                                                                                      	Value string `json:"value"`

                                                                                                                        CollectionColumnOption describes options for ColumnTypeMultiSelect collection column

                                                                                                                        type CollectionFormat

                                                                                                                        type CollectionFormat struct {
                                                                                                                        	CoverPosition  float64                   `json:"collection_cover_position"`
                                                                                                                        	PageProperties []*CollectionPageProperty `json:"collection_page_properties"`

                                                                                                                          CollectionFormat describes format of a collection

                                                                                                                          type CollectionPageProperty

                                                                                                                          type CollectionPageProperty struct {
                                                                                                                          	Property string `json:"property"`
                                                                                                                          	Visible  bool   `json:"visible"`

                                                                                                                            CollectionPageProperty describes properties of a collection

                                                                                                                            type CollectionView

                                                                                                                            type CollectionView struct {
                                                                                                                            	ID          string          `json:"id"`
                                                                                                                            	Version     int64           `json:"version"`
                                                                                                                            	Type        string          `json:"type"` // "table"
                                                                                                                            	Format      *FormatTable    `json:"format"`
                                                                                                                            	Name        string          `json:"name"`
                                                                                                                            	ParentID    string          `json:"parent_id"`
                                                                                                                            	ParentTable string          `json:"parent_table"`
                                                                                                                            	Query       json.RawMessage `json:"query"`
                                                                                                                            	Query2      json.RawMessage `json:"query2"`
                                                                                                                            	Alive       bool            `json:"alive"`
                                                                                                                            	PageSort    []string        `json:"page_sort"`
                                                                                                                            	ShardID     int64           `json:"shard_id"`
                                                                                                                            	SpaceID     string          `json:"space_id"`
                                                                                                                            	// set by us
                                                                                                                            	RawJSON map[string]interface{} `json:"-"`

                                                                                                                              CollectionView represents a collection view

                                                                                                                              type ColumnFormula

                                                                                                                              type ColumnFormula struct {
                                                                                                                              	Args       []FormulaArg `json:"args"`
                                                                                                                              	Name       string       `json:"name"`
                                                                                                                              	Operator   string       `json:"operator"`
                                                                                                                              	ResultType string       `json:"result_type"`
                                                                                                                              	Type       string       `json:"type"`

                                                                                                                              type ColumnInfo

                                                                                                                              type ColumnInfo struct {
                                                                                                                              	// TableView that owns this column
                                                                                                                              	TableView *TableView
                                                                                                                              	// so that we can access TableRow.Columns[Index]
                                                                                                                              	Index    int
                                                                                                                              	Schema   *ColumnSchema
                                                                                                                              	Property *TableProperty

                                                                                                                                ColumnInfo describes a schema for a given cell (column)

                                                                                                                                func (*ColumnInfo) ID

                                                                                                                                func (c *ColumnInfo) ID() string

                                                                                                                                func (*ColumnInfo) Name

                                                                                                                                func (c *ColumnInfo) Name() string

                                                                                                                                func (*ColumnInfo) Type

                                                                                                                                func (c *ColumnInfo) Type() string

                                                                                                                                type ColumnSchema

                                                                                                                                type ColumnSchema struct {
                                                                                                                                	Name string `json:"name"`
                                                                                                                                	// ColumnTypeTitle etc.
                                                                                                                                	Type string `json:"type"`
                                                                                                                                	// for Type == ColumnTypeNumber, e.g. "dollar", "number"
                                                                                                                                	NumberFormat string `json:"number_format"`
                                                                                                                                	// For Type == ColumnTypeRollup
                                                                                                                                	Aggregation        string `json:"aggregation"` // e.g. "unique"
                                                                                                                                	TargetProperty     string `json:"target_property"`
                                                                                                                                	RelationProperty   string `json:"relation_property"`
                                                                                                                                	TargetPropertyType string `json:"target_property_type"`
                                                                                                                                	// for Type == ColumnTypeRelation
                                                                                                                                	CollectionID string `json:"collection_id"`
                                                                                                                                	Property     string `json:"property"`
                                                                                                                                	// for Type == ColumnTypeFormula
                                                                                                                                	Formula *ColumnFormula
                                                                                                                                	Options []*CollectionColumnOption `json:"options"`

                                                                                                                                  ColumnSchema describes a info of a collection column

                                                                                                                                  type Comment

                                                                                                                                  type Comment struct {
                                                                                                                                  	ID             string      `json:"id"`
                                                                                                                                  	Version        int64       `json:"version"`
                                                                                                                                  	Alive          bool        `json:"alive"`
                                                                                                                                  	ParentID       string      `json:"parent_id"`
                                                                                                                                  	ParentTable    string      `json:"parent_table"`
                                                                                                                                  	CreatedBy      string      `json:"created_by"`
                                                                                                                                  	CreatedTime    int64       `json:"created_time"`
                                                                                                                                  	Text           interface{} `json:"text"`
                                                                                                                                  	LastEditedTime int64       `json:"last_edited_time"`
                                                                                                                                  	// set by us
                                                                                                                                  	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                    Comment describes a single comment in a discussion

                                                                                                                                    type Date

                                                                                                                                    type Date struct {
                                                                                                                                    	// "MMM DD, YYYY", "MM/DD/YYYY", "DD/MM/YYYY", "YYYY/MM/DD", "relative"
                                                                                                                                    	DateFormat string    `json:"date_format"`
                                                                                                                                    	Reminder   *Reminder `json:"reminder,omitempty"`
                                                                                                                                    	// "2018-07-12"
                                                                                                                                    	StartDate string `json:"start_date"`
                                                                                                                                    	// "09:00"
                                                                                                                                    	StartTime string `json:"start_time,omitempty"`
                                                                                                                                    	// "2018-07-12"
                                                                                                                                    	EndDate string `json:"end_date,omitempty"`
                                                                                                                                    	// "09:00"
                                                                                                                                    	EndTime string `json:"end_time,omitempty"`
                                                                                                                                    	// "America/Los_Angeles"
                                                                                                                                    	TimeZone *string `json:"time_zone,omitempty"`
                                                                                                                                    	// "H:mm" for 24hr, not given for 12hr
                                                                                                                                    	TimeFormat string `json:"time_format,omitempty"`
                                                                                                                                    	// "date", "datetime", "datetimerange", "daterange"
                                                                                                                                    	Type string `json:"type"`

                                                                                                                                      Date represents a date

                                                                                                                                      func AttrGetDate

                                                                                                                                      func AttrGetDate(attr TextAttr) *Date

                                                                                                                                      type Discussion

                                                                                                                                      type Discussion struct {
                                                                                                                                      	ID          string   `json:"id"`
                                                                                                                                      	Version     int64    `json:"version"`
                                                                                                                                      	ParentID    string   `json:"parent_id"`
                                                                                                                                      	ParentTable string   `json:"parent_table"`
                                                                                                                                      	Resolved    bool     `json:"resolved"`
                                                                                                                                      	Comments    []string `json:"comments"`
                                                                                                                                      	// set by us
                                                                                                                                      	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                        Discussion represents a discussion

                                                                                                                                        type DownloadFileResponse

                                                                                                                                        type DownloadFileResponse struct {
                                                                                                                                        	URL           string
                                                                                                                                        	CacheFileName string
                                                                                                                                        	Data          []byte
                                                                                                                                        	Header        http.Header

                                                                                                                                          DownloadFileResponse is a result of DownloadFile()

                                                                                                                                          type DriveProperties

                                                                                                                                          type DriveProperties struct {
                                                                                                                                          	FileID       string `json:"file_id"`
                                                                                                                                          	Icon         string `json:"icon"`
                                                                                                                                          	ModifiedTime int64  `json:"modified_time"`
                                                                                                                                          	Thumbnail    string `json:"thumbnail"` // url
                                                                                                                                          	Title        string `json:"title"`
                                                                                                                                          	Trashed      bool   `json:"trashed"`
                                                                                                                                          	URL          string `json:"url"`
                                                                                                                                          	UserName     string `json:"user_name"`
                                                                                                                                          	Version      int    `json:"version"`

                                                                                                                                          type DriveStatus

                                                                                                                                          type DriveStatus struct {
                                                                                                                                          	Authed      bool  `json:"authed"`
                                                                                                                                          	LastFetched int64 `json:"last_fetched"`

                                                                                                                                          type Edit

                                                                                                                                          type Edit struct {
                                                                                                                                          	SpaceID   string   `json:"space_id"`
                                                                                                                                          	Authors   []Author `json:"authors"`
                                                                                                                                          	Timestamp int64    `json:"timestamp"`
                                                                                                                                          	Type      string   `json:"type"`
                                                                                                                                          	Version   int      `json:"version"`
                                                                                                                                          	CommentData  Comment `json:"comment_data"`
                                                                                                                                          	CommentID    string  `json:"comment_id"`
                                                                                                                                          	DiscussionID string  `json:"discussion_id"`
                                                                                                                                          	BlockID   string `json:"block_id"`
                                                                                                                                          	BlockData struct {
                                                                                                                                          		BlockValue Block `json:"block_value"`
                                                                                                                                          	} `json:"block_data"`
                                                                                                                                          	NavigableBlockID string `json:"navigable_block_id"`
                                                                                                                                          	CollectionID    string `json:"collection_id"`
                                                                                                                                          	CollectionRowID string `json:"collection_row_id"`

                                                                                                                                            Edit represents a Notion edit (ie. a change made during an Activity)

                                                                                                                                            type ErrPageNotFound

                                                                                                                                            type ErrPageNotFound struct {
                                                                                                                                            	PageID string

                                                                                                                                              ErrPageNotFound is returned by Client.DownloadPage if page cannot be found

                                                                                                                                              func (*ErrPageNotFound) Error

                                                                                                                                              func (e *ErrPageNotFound) Error() string

                                                                                                                                                Error return error string

                                                                                                                                                type FormatBookmark

                                                                                                                                                type FormatBookmark struct {
                                                                                                                                                	BlockColor string `json:"block_color"`
                                                                                                                                                	Cover      string `json:"bookmark_cover"`
                                                                                                                                                	Icon       string `json:"bookmark_icon"`

                                                                                                                                                  FormatBookmark describes format for BlockBookmark

                                                                                                                                                  type FormatBulletedList

                                                                                                                                                  type FormatBulletedList struct {
                                                                                                                                                  	BlockColor string `json:"block_color"`

                                                                                                                                                    FormatBulletedList describes format for BlockBulletedList

                                                                                                                                                    type FormatCallout

                                                                                                                                                    type FormatCallout struct {
                                                                                                                                                    	BlockColor string `json:"block_color"`
                                                                                                                                                    	Icon       string `json:"bookmark_icon"`

                                                                                                                                                      FormatCallout describes format for BlockCallout

                                                                                                                                                      type FormatCode

                                                                                                                                                      type FormatCode struct {
                                                                                                                                                      	CodeWrap bool `json:"code_wrap"`

                                                                                                                                                        FormatCode describes format for BlockCode

                                                                                                                                                        type FormatCodepen

                                                                                                                                                        type FormatCodepen struct {
                                                                                                                                                        	BlockFullWidth     bool    `json:"block_full_width"`
                                                                                                                                                        	BlockHeight        float64 `json:"block_height"`
                                                                                                                                                        	BlockPageWidth     bool    `json:"block_page_width"`
                                                                                                                                                        	BlockPreserveScale bool    `json:"block_preserve_scale"`
                                                                                                                                                        	BlockWidth         float64 `json:"block_width"`
                                                                                                                                                        	DisplaySource      string  `json:"display_source,omitempty"`

                                                                                                                                                        type FormatCollectionView

                                                                                                                                                        type FormatCollectionView struct {
                                                                                                                                                        	BlockFullWidth bool    `json:"block_full_width"`
                                                                                                                                                        	BlockHeight    float64 `json:"block_height"`
                                                                                                                                                        	BlockPageWidth bool    `json:"block_page_width"`
                                                                                                                                                        	BlockWidth     float64 `json:"block_width"`

                                                                                                                                                        type FormatColumn

                                                                                                                                                        type FormatColumn struct {
                                                                                                                                                        	// e.g. 0.5 for half-sized column
                                                                                                                                                        	ColumnRatio float64 `json:"column_ratio"`

                                                                                                                                                          FormatColumn describes format for BlockColumn

                                                                                                                                                          type FormatDrive

                                                                                                                                                          type FormatDrive struct {
                                                                                                                                                          	DriveProperties *DriveProperties `json:"drive_properties"`
                                                                                                                                                          	DriveStatus     *DriveStatus     `json:"drive_status"`

                                                                                                                                                          type FormatEmbed

                                                                                                                                                          type FormatEmbed struct {
                                                                                                                                                          	BlockFullWidth     bool    `json:"block_full_width"`
                                                                                                                                                          	BlockHeight        float64 `json:"block_height"`
                                                                                                                                                          	BlockPageWidth     bool    `json:"block_page_width"`
                                                                                                                                                          	BlockPreserveScale bool    `json:"block_preserve_scale"`
                                                                                                                                                          	BlockWidth         float64 `json:"block_width"`
                                                                                                                                                          	DisplaySource      string  `json:"display_source"`

                                                                                                                                                            FormatEmbed describes format for BlockEmbed

                                                                                                                                                            type FormatFigma

                                                                                                                                                            type FormatFigma struct {
                                                                                                                                                            	BlockFullWidth     bool    `json:"block_full_width"`
                                                                                                                                                            	BlockHeight        float64 `json:"block_height"`
                                                                                                                                                            	BlockPageWidth     bool    `json:"block_page_width"`
                                                                                                                                                            	BlockPreserveScale bool    `json:"block_preserve_scale"`
                                                                                                                                                            	BlockWidth         float64 `json:"block_width"`
                                                                                                                                                            	DisplaySource      string  `json:"display_source"`

                                                                                                                                                            type FormatHeader

                                                                                                                                                            type FormatHeader struct {
                                                                                                                                                            	BlockColor string `json:"block_color,omitempty"`

                                                                                                                                                              FormatHeader describes format for BlockHeader, BlockSubHeader, BlockSubSubHeader

                                                                                                                                                              type FormatImage

                                                                                                                                                              type FormatImage struct {
                                                                                                                                                              	// comes from notion API
                                                                                                                                                              	BlockAspectRatio   float64 `json:"block_aspect_ratio"`
                                                                                                                                                              	BlockFullWidth     bool    `json:"block_full_width"`
                                                                                                                                                              	BlockHeight        float64 `json:"block_height"`
                                                                                                                                                              	BlockPageWidth     bool    `json:"block_page_width"`
                                                                                                                                                              	BlockPreserveScale bool    `json:"block_preserve_scale"`
                                                                                                                                                              	BlockWidth         float64 `json:"block_width"`
                                                                                                                                                              	DisplaySource      string  `json:"display_source,omitempty"`
                                                                                                                                                              	// calculated by us
                                                                                                                                                              	ImageURL string `json:"image_url,omitempty"`

                                                                                                                                                                FormatImage describes format for BlockImage

                                                                                                                                                                type FormatMaps

                                                                                                                                                                type FormatMaps struct {
                                                                                                                                                                	BlockFullWidth     bool    `json:"block_full_width"`
                                                                                                                                                                	BlockHeight        float64 `json:"block_height"`
                                                                                                                                                                	BlockPageWidth     bool    `json:"block_page_width"`
                                                                                                                                                                	BlockPreserveScale bool    `json:"block_preserve_scale"`
                                                                                                                                                                	BlockWidth         float64 `json:"block_width"`
                                                                                                                                                                	DisplaySource      string  `json:"display_source,omitempty"`

                                                                                                                                                                type FormatNumberedList

                                                                                                                                                                type FormatNumberedList struct {
                                                                                                                                                                	BlockColor string `json:"block_color"`

                                                                                                                                                                  FormatNumberedList describes format for BlockNumberedList

                                                                                                                                                                  type FormatPDF

                                                                                                                                                                  type FormatPDF struct {
                                                                                                                                                                  	BlockFullWidth     bool    `json:"block_full_width"`
                                                                                                                                                                  	BlockHeight        float64 `json:"block_height"`
                                                                                                                                                                  	BlockPageWidth     bool    `json:"block_page_width"`
                                                                                                                                                                  	BlockPreserveScale bool    `json:"block_preserve_scale"`
                                                                                                                                                                  	BlockWidth         float64 `json:"block_width"`

                                                                                                                                                                  type FormatPage

                                                                                                                                                                  type FormatPage struct {
                                                                                                                                                                  	// /images/page-cover/gradients_11.jpg
                                                                                                                                                                  	PageCover string `json:"page_cover"`
                                                                                                                                                                  	// e.g. 0.6
                                                                                                                                                                  	PageCoverPosition float64 `json:"page_cover_position"`
                                                                                                                                                                  	PageFont          string  `json:"page_font"`
                                                                                                                                                                  	PageFullWidth     bool    `json:"page_full_width"`
                                                                                                                                                                  	// it's url like
                                                                                                                                                                  	// or emoji like "✉️"
                                                                                                                                                                  	PageIcon      string `json:"page_icon"`
                                                                                                                                                                  	PageSmallText bool   `json:"page_small_text"`
                                                                                                                                                                  	BlockColor    string `json:"block_color"`
                                                                                                                                                                  	BlockLocked   bool   `json:"block_locked"`
                                                                                                                                                                  	BlockLockedBy string `json:"block_locked_by"`
                                                                                                                                                                  	// calculated by us
                                                                                                                                                                  	PageCoverURL string `json:"page_cover_url,omitempty"`

                                                                                                                                                                    FormatPage describes format for BlockPage

                                                                                                                                                                    type FormatTable

                                                                                                                                                                    type FormatTable struct {
                                                                                                                                                                    	PageSort        []string         `json:"page_sort"`
                                                                                                                                                                    	TableWrap       bool             `json:"table_wrap"`
                                                                                                                                                                    	TableProperties []*TableProperty `json:"table_properties"`

                                                                                                                                                                      FormatTable describes format for BlockTable

                                                                                                                                                                      type FormatTableOfContents

                                                                                                                                                                      type FormatTableOfContents struct {
                                                                                                                                                                      	BlockColor string `json:"block_color,omitempty"`

                                                                                                                                                                      type FormatText

                                                                                                                                                                      type FormatText struct {
                                                                                                                                                                      	BlockColor string `json:"block_color,omitempty"`

                                                                                                                                                                        FormatText describes format for BlockText

                                                                                                                                                                        type FormatToggle

                                                                                                                                                                        type FormatToggle struct {
                                                                                                                                                                        	BlockColor string `json:"block_color"`

                                                                                                                                                                          FormatToggle describes format for BlockToggle

                                                                                                                                                                          type FormatVideo

                                                                                                                                                                          type FormatVideo struct {
                                                                                                                                                                          	BlockAspectRatio   float64 `json:"block_aspect_ratio"`
                                                                                                                                                                          	BlockFullWidth     bool    `json:"block_full_width"`
                                                                                                                                                                          	BlockHeight        int64   `json:"block_height"`
                                                                                                                                                                          	BlockPageWidth     bool    `json:"block_page_width"`
                                                                                                                                                                          	BlockPreserveScale bool    `json:"block_preserve_scale"`
                                                                                                                                                                          	BlockWidth         int64   `json:"block_width"`
                                                                                                                                                                          	DisplaySource      string  `json:"display_source"`

                                                                                                                                                                            FormatVideo describes fromat form BlockVideo

                                                                                                                                                                            type FormulaArg

                                                                                                                                                                            type FormulaArg struct {
                                                                                                                                                                            	Name       *string `json:"name,omitempty"`
                                                                                                                                                                            	ResultType string  `json:"result_type"`
                                                                                                                                                                            	Type       string  `json:"type"`
                                                                                                                                                                            	Value      *string `json:"value,omitempty"`
                                                                                                                                                                            	ValueType  *string `json:"value_type,omitempty"`

                                                                                                                                                                            type GetActivityLogResponse

                                                                                                                                                                            type GetActivityLogResponse struct {
                                                                                                                                                                            	ActivityIDs []string   `json:"activityIds"`
                                                                                                                                                                            	RecordMap   *RecordMap `json:"recordMap"`
                                                                                                                                                                            	NextID      string     `json:"-"`
                                                                                                                                                                            	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                                                              LoadPageChunkResponse is a response to /api/v3/loadPageChunk api

                                                                                                                                                                              type GetRecordValuesResponse

                                                                                                                                                                              type GetRecordValuesResponse struct {
                                                                                                                                                                              	Results []*Record              `json:"results"`
                                                                                                                                                                              	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                                                                GetRecordValuesResponse represents response to /api/v3/getRecordValues api Note: it depends on Table type in request

                                                                                                                                                                                type GetSignedFileUrlsResponse

                                                                                                                                                                                type GetSignedFileUrlsResponse struct {
                                                                                                                                                                                	SignedUrls []string               `json:"signedUrls"`
                                                                                                                                                                                	RawJSON    map[string]interface{} `json:"-"`

                                                                                                                                                                                  GetSignedFileUrlsResponse is a response of GetSignedFileUrls()

                                                                                                                                                                                  type GetUploadFileUrlResponse

                                                                                                                                                                                  type GetUploadFileUrlResponse struct {
                                                                                                                                                                                  	URL          string `json:"url"`
                                                                                                                                                                                  	SignedGetURL string `json:"signedGetUrl"`
                                                                                                                                                                                  	SignedPutURL string `json:"signedPutUrl"`
                                                                                                                                                                                  	FileID string `json:"-"`
                                                                                                                                                                                  	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                                                                    GetUploadFileUrlResponse is a response to POST /api/v3/getUploadFileUrl

                                                                                                                                                                                    func (*GetUploadFileUrlResponse) Parse

                                                                                                                                                                                    func (r *GetUploadFileUrlResponse) Parse()

                                                                                                                                                                                    type LoadPageChunkResponse

                                                                                                                                                                                    type LoadPageChunkResponse struct {
                                                                                                                                                                                    	RecordMap *RecordMap `json:"recordMap"`
                                                                                                                                                                                    	Cursor    cursor     `json:"cursor"`
                                                                                                                                                                                    	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                                                                      LoadPageChunkResponse is a response to /api/v3/loadPageChunk api

                                                                                                                                                                                      type LoadUserResponse

                                                                                                                                                                                      type LoadUserResponse struct {
                                                                                                                                                                                      	ID    string `json:"id"`
                                                                                                                                                                                      	Table string `json:"table"`
                                                                                                                                                                                      	Role  string `json:"role"`
                                                                                                                                                                                      	Value json.RawMessage `json:"value"`
                                                                                                                                                                                      	Block *Block `json:"-"`
                                                                                                                                                                                      	Space *Space `json:"-"`
                                                                                                                                                                                      	User  *User  `json:"-"`
                                                                                                                                                                                      	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                                                                      type Operation

                                                                                                                                                                                      type Operation struct {
                                                                                                                                                                                      	ID      string      `json:"id"`      // id of the block being modified
                                                                                                                                                                                      	Table   string      `json:"table"`   // "block" etc.
                                                                                                                                                                                      	Path    []string    `json:"path"`    // e.g. ["properties", "title"]
                                                                                                                                                                                      	Command string      `json:"command"` // "set", "update", "listAfter"
                                                                                                                                                                                      	Args    interface{} `json:"args"`

                                                                                                                                                                                        Operation describes a single operation sent

                                                                                                                                                                                        type Page

                                                                                                                                                                                        type Page struct {
                                                                                                                                                                                        	ID string
                                                                                                                                                                                        	// expose raw records for all data associated with this page
                                                                                                                                                                                        	BlockRecords          []*Record
                                                                                                                                                                                        	UserRecords           []*Record
                                                                                                                                                                                        	CollectionRecords     []*Record
                                                                                                                                                                                        	CollectionViewRecords []*Record
                                                                                                                                                                                        	DiscussionRecords     []*Record
                                                                                                                                                                                        	CommentRecords        []*Record
                                                                                                                                                                                        	// for every block of type collection_view and its view_ids
                                                                                                                                                                                        	// we } TableView representing that collection view_id
                                                                                                                                                                                        	TableViews []*TableView
                                                                                                                                                                                        	// contains filtered or unexported fields

                                                                                                                                                                                          Page describes a single Notion page

                                                                                                                                                                                          func (*Page) BlockByID

                                                                                                                                                                                          func (p *Page) BlockByID(id string) *Block

                                                                                                                                                                                            BlockByID returns a block by its id

                                                                                                                                                                                            func (*Page) CollectionByID

                                                                                                                                                                                            func (p *Page) CollectionByID(id string) *Collection

                                                                                                                                                                                              CollectionByID returns a collection by its id

                                                                                                                                                                                              func (*Page) CollectionViewByID

                                                                                                                                                                                              func (p *Page) CollectionViewByID(id string) *CollectionView

                                                                                                                                                                                                CollectionViewByID returns a collection view by its id

                                                                                                                                                                                                func (*Page) CommentByID

                                                                                                                                                                                                func (p *Page) CommentByID(id string) *Comment

                                                                                                                                                                                                  CommentByID returns a comment by its id

                                                                                                                                                                                                  func (*Page) DiscussionByID

                                                                                                                                                                                                  func (p *Page) DiscussionByID(id string) *Discussion

                                                                                                                                                                                                    DiscussionByID returns a discussion by its id

                                                                                                                                                                                                    func (*Page) ForEachBlock

                                                                                                                                                                                                    func (p *Page) ForEachBlock(cb func(*Block))

                                                                                                                                                                                                      ForEachBlock recursively calls cb for each block in th epage

                                                                                                                                                                                                      func (*Page) GetSubPages

                                                                                                                                                                                                      func (p *Page) GetSubPages() []string

                                                                                                                                                                                                        GetSubPages return list of ids for direct sub-pages of this page

                                                                                                                                                                                                        func (*Page) IsRoot

                                                                                                                                                                                                        func (p *Page) IsRoot(block *Block) bool

                                                                                                                                                                                                          IsRoot returns true if this block is root block of the page i.e. of type BlockPage and very first block

                                                                                                                                                                                                          func (*Page) IsSubPage

                                                                                                                                                                                                          func (p *Page) IsSubPage(block *Block) bool

                                                                                                                                                                                                            IsSubPage returns true if a given block is BlockPage and a direct child of this page (as opposed to a link to arbitrary page)

                                                                                                                                                                                                            func (*Page) NotionURL

                                                                                                                                                                                                            func (p *Page) NotionURL() string

                                                                                                                                                                                                              NotionURL returns url of this page on

                                                                                                                                                                                                              func (*Page) Root

                                                                                                                                                                                                              func (p *Page) Root() *Block

                                                                                                                                                                                                                Root returns a root block representing a page

                                                                                                                                                                                                                func (*Page) SetFormat

                                                                                                                                                                                                                func (p *Page) SetFormat(args map[string]interface{}) error

                                                                                                                                                                                                                  SetFormat changes format properties of a page. Valid values are: page_full_width (bool), page_small_text (bool)

                                                                                                                                                                                                                  func (*Page) SetTitle

                                                                                                                                                                                                                  func (p *Page) SetTitle(s string) error

                                                                                                                                                                                                                    SetTitle changes page title

                                                                                                                                                                                                                    func (*Page) UserByID

                                                                                                                                                                                                                    func (p *Page) UserByID(id string) *User

                                                                                                                                                                                                                      UserByID returns a user by its id

                                                                                                                                                                                                                      type Permission

                                                                                                                                                                                                                      type Permission struct {
                                                                                                                                                                                                                      	Type string `json:"type"`
                                                                                                                                                                                                                      	// common to some permission types
                                                                                                                                                                                                                      	Role string `json:"role"`
                                                                                                                                                                                                                      	// if Type == "user_permission"
                                                                                                                                                                                                                      	UserID *string `json:"user_id,omitempty"`
                                                                                                                                                                                                                      	// if Type == "public_permission"
                                                                                                                                                                                                                      	AllowDuplicate            bool `json:"allow_duplicate"`
                                                                                                                                                                                                                      	AllowSearchEngineIndexing bool `json:"allow_search_engine_indexing"`

                                                                                                                                                                                                                        Permission represents user permissions o

                                                                                                                                                                                                                        type QueryCollectionResponse

                                                                                                                                                                                                                        type QueryCollectionResponse struct {
                                                                                                                                                                                                                        	RecordMap *RecordMap             `json:"recordMap"`
                                                                                                                                                                                                                        	Result    *QueryCollectionResult `json:"result"`
                                                                                                                                                                                                                        	RawJSON   map[string]interface{} `json:"-"`

                                                                                                                                                                                                                          QueryCollectionResponse is json response for /api/v3/queryCollection

                                                                                                                                                                                                                          type QueryCollectionResult

                                                                                                                                                                                                                          type QueryCollectionResult struct {
                                                                                                                                                                                                                          	Type               string               `json:"type"`
                                                                                                                                                                                                                          	BlockIDS           []string             `json:"blockIds"`
                                                                                                                                                                                                                          	AggregationResults []*AggregationResult `json:"aggregationResults"`
                                                                                                                                                                                                                          	Total              int                  `json:"total"`

                                                                                                                                                                                                                            QueryCollectionResult is part of response for /api/v3/queryCollection

                                                                                                                                                                                                                            type Record

                                                                                                                                                                                                                            type Record struct {
                                                                                                                                                                                                                            	// fields returned by the server
                                                                                                                                                                                                                            	Role string `json:"role"`
                                                                                                                                                                                                                            	// polymorphic value of the record, which we decode into Block, Space etc.
                                                                                                                                                                                                                            	Value json.RawMessage `json:"value"`
                                                                                                                                                                                                                            	// fields set from Value based on type
                                                                                                                                                                                                                            	ID    string `json:"-"`
                                                                                                                                                                                                                            	Table string `json:"-"`
                                                                                                                                                                                                                            	Activity       *Activity       `json:"-"`
                                                                                                                                                                                                                            	Block          *Block          `json:"-"`
                                                                                                                                                                                                                            	Space          *Space          `json:"-"`
                                                                                                                                                                                                                            	User           *User           `json:"-"`
                                                                                                                                                                                                                            	Collection     *Collection     `json:"-"`
                                                                                                                                                                                                                            	CollectionView *CollectionView `json:"-"`
                                                                                                                                                                                                                            	Comment        *Comment        `json:"-"`
                                                                                                                                                                                                                            	Discussion     *Discussion     `json:"-"`

                                                                                                                                                                                                                              Record represents a polymorphic record

                                                                                                                                                                                                                              type RecordMap

                                                                                                                                                                                                                              type RecordMap struct {
                                                                                                                                                                                                                              	Activities      map[string]*Record `json:"activity"`
                                                                                                                                                                                                                              	Blocks          map[string]*Record `json:"block"`
                                                                                                                                                                                                                              	Spaces          map[string]*Record `json:"space"`
                                                                                                                                                                                                                              	Users           map[string]*Record `json:"notion_user"`
                                                                                                                                                                                                                              	Collections     map[string]*Record `json:"collection"`
                                                                                                                                                                                                                              	CollectionViews map[string]*Record `json:"collection_view"`
                                                                                                                                                                                                                              	Comments        map[string]*Record `json:"comment"`
                                                                                                                                                                                                                              	Discussions     map[string]*Record `json:"discussion"`

                                                                                                                                                                                                                                RecordMap contains a collections of blocks, a space, users, and collections.

                                                                                                                                                                                                                                type RecordRequest

                                                                                                                                                                                                                                type RecordRequest struct {
                                                                                                                                                                                                                                	Table string `json:"table"`
                                                                                                                                                                                                                                	ID    string `json:"id"`

                                                                                                                                                                                                                                  RecordRequest represents argument to GetRecordValues

                                                                                                                                                                                                                                  type Reminder

                                                                                                                                                                                                                                  type Reminder struct {
                                                                                                                                                                                                                                  	Time  string `json:"time"` // e.g. "09:00"
                                                                                                                                                                                                                                  	Unit  string `json:"unit"` // e.g. "day"
                                                                                                                                                                                                                                  	Value int64  `json:"value"`

                                                                                                                                                                                                                                    Reminder represents a date reminder

                                                                                                                                                                                                                                    type Space

                                                                                                                                                                                                                                    type Space struct {
                                                                                                                                                                                                                                    	ID                  string                  `json:"id"`
                                                                                                                                                                                                                                    	Version             float64                 `json:"version"`
                                                                                                                                                                                                                                    	Name                string                  `json:"name"`
                                                                                                                                                                                                                                    	Domain              string                  `json:"domain"`
                                                                                                                                                                                                                                    	Permissions         []*SpacePermissions     `json:"permissions,omitempty"`
                                                                                                                                                                                                                                    	PermissionGroups    []SpacePermissionGroups `json:"permission_groups"`
                                                                                                                                                                                                                                    	Icon                string                  `json:"icon"`
                                                                                                                                                                                                                                    	EmailDomains        []string                `json:"email_domains"`
                                                                                                                                                                                                                                    	BetaEnabled         bool                    `json:"beta_enabled"`
                                                                                                                                                                                                                                    	Pages               []string                `json:"pages,omitempty"`
                                                                                                                                                                                                                                    	DisablePublicAccess bool                    `json:"disable_public_access"`
                                                                                                                                                                                                                                    	DisableGuests       bool                    `json:"disable_guests"`
                                                                                                                                                                                                                                    	DisableMoveToSpace  bool                    `json:"disable_move_to_space"`
                                                                                                                                                                                                                                    	DisableExport       bool                    `json:"disable_export"`
                                                                                                                                                                                                                                    	CreatedBy           string                  `json:"created_by"`
                                                                                                                                                                                                                                    	CreatedTime         int64                   `json:"created_time"`
                                                                                                                                                                                                                                    	LastEditedBy        string                  `json:"last_edited_by"`
                                                                                                                                                                                                                                    	LastEditedTime      int64                   `json:"last_edited_time"`
                                                                                                                                                                                                                                    	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                                                                                                                      Space describes Notion workspace.

                                                                                                                                                                                                                                      type SpacePermissionGroups

                                                                                                                                                                                                                                      type SpacePermissionGroups struct {
                                                                                                                                                                                                                                      	ID      string   `json:"id"`
                                                                                                                                                                                                                                      	Name    string   `json:"name"`
                                                                                                                                                                                                                                      	UserIds []string `json:"user_ids,omitempty"`

                                                                                                                                                                                                                                        SpacePermissionGroups represesnts group permissions for space

                                                                                                                                                                                                                                        type SpacePermissions

                                                                                                                                                                                                                                        type SpacePermissions struct {
                                                                                                                                                                                                                                        	Role   string `json:"role"`
                                                                                                                                                                                                                                        	Type   string `json:"type"` // e.g. "user_permission"
                                                                                                                                                                                                                                        	UserID string `json:"user_id"`

                                                                                                                                                                                                                                          SpacePermissions represents permissions for space

                                                                                                                                                                                                                                          type SubscriptionData

                                                                                                                                                                                                                                          type SubscriptionData struct {
                                                                                                                                                                                                                                          	Type              string                       `json:"type"`
                                                                                                                                                                                                                                          	SpaceUsers        []SubscriptionDataSpaceUsers `json:"spaceUsers"`
                                                                                                                                                                                                                                          	Credits           []SubscriptionDataCredits    `json:"credits"`
                                                                                                                                                                                                                                          	TotalCredit       int                          `json:"totalCredit"`
                                                                                                                                                                                                                                          	AvailableCredit   int                          `json:"availableCredit"`
                                                                                                                                                                                                                                          	CreditEnabled     bool                         `json:"creditEnabled"`
                                                                                                                                                                                                                                          	CustomerID        string                       `json:"customerId"`
                                                                                                                                                                                                                                          	CustomerName      string                       `json:"customerName"`
                                                                                                                                                                                                                                          	VatID             string                       `json:"vatId"`
                                                                                                                                                                                                                                          	IsDelinquent      bool                         `json:"isDelinquent"`
                                                                                                                                                                                                                                          	ProductID         string                       `json:"productId"`
                                                                                                                                                                                                                                          	BillingEmail      string                       `json:"billingEmail"`
                                                                                                                                                                                                                                          	Plan              string                       `json:"plan"`
                                                                                                                                                                                                                                          	PlanAmount        int                          `json:"planAmount"`
                                                                                                                                                                                                                                          	AccountBalance    int                          `json:"accountBalance"`
                                                                                                                                                                                                                                          	MonthlyPlanAmount int                          `json:"monthlyPlanAmount"`
                                                                                                                                                                                                                                          	YearlyPlanAmount  int                          `json:"yearlyPlanAmount"`
                                                                                                                                                                                                                                          	Quantity          int                          `json:"quantity"`
                                                                                                                                                                                                                                          	Billing           string                       `json:"billing"`
                                                                                                                                                                                                                                          	Address           SubscriptionDataAddress      `json:"address"`
                                                                                                                                                                                                                                          	Last4             string                       `json:"last4"`
                                                                                                                                                                                                                                          	Brand             string                       `json:"brand"`
                                                                                                                                                                                                                                          	Interval          string                       `json:"interval"`
                                                                                                                                                                                                                                          	Created           int64                        `json:"created"`
                                                                                                                                                                                                                                          	PeriodEnd         int64                        `json:"periodEnd"`
                                                                                                                                                                                                                                          	NextInvoiceTime   int64                        `json:"nextInvoiceTime"`
                                                                                                                                                                                                                                          	NextInvoiceAmount int                          `json:"nextInvoiceAmount"`
                                                                                                                                                                                                                                          	IsPaid            bool                         `json:"isPaid"`
                                                                                                                                                                                                                                          	Members           []interface{}                `json:"members"`
                                                                                                                                                                                                                                          	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                                                                                                                          type SubscriptionDataAddress

                                                                                                                                                                                                                                          type SubscriptionDataAddress struct {
                                                                                                                                                                                                                                          	Name         string `json:"name"`
                                                                                                                                                                                                                                          	BusinessName string `json:"businessName"`
                                                                                                                                                                                                                                          	AddressLine1 string `json:"addressLine1"`
                                                                                                                                                                                                                                          	AddressLine2 string `json:"addressLine2"`
                                                                                                                                                                                                                                          	ZipCode      string `json:"zipCode"`
                                                                                                                                                                                                                                          	City         string `json:"city"`
                                                                                                                                                                                                                                          	State        string `json:"state"`
                                                                                                                                                                                                                                          	Country      string `json:"country"`

                                                                                                                                                                                                                                          type SubscriptionDataCredits

                                                                                                                                                                                                                                          type SubscriptionDataCredits struct {
                                                                                                                                                                                                                                          	ID               string `json:"id"`
                                                                                                                                                                                                                                          	Version          int    `json:"version"`
                                                                                                                                                                                                                                          	UserID           string `json:"user_id"`
                                                                                                                                                                                                                                          	Amount           int    `json:"amount"`
                                                                                                                                                                                                                                          	Activated        bool   `json:"activated"`
                                                                                                                                                                                                                                          	CreatedTimestamp string `json:"created_timestamp"`
                                                                                                                                                                                                                                          	Type             string `json:"type"`

                                                                                                                                                                                                                                          type SubscriptionDataSpaceUsers

                                                                                                                                                                                                                                          type SubscriptionDataSpaceUsers struct {
                                                                                                                                                                                                                                          	UserID       string        `json:"userId"`
                                                                                                                                                                                                                                          	Role         string        `json:"role"`
                                                                                                                                                                                                                                          	IsGuest      bool          `json:"isGuest"`
                                                                                                                                                                                                                                          	GuestPageIds []interface{} `json:"guestPageIds"`

                                                                                                                                                                                                                                          type TableProperty

                                                                                                                                                                                                                                          type TableProperty struct {
                                                                                                                                                                                                                                          	Width    int    `json:"width"`
                                                                                                                                                                                                                                          	Visible  bool   `json:"visible"`
                                                                                                                                                                                                                                          	Property string `json:"property"`

                                                                                                                                                                                                                                            TableProperty describes property of a table

                                                                                                                                                                                                                                            type TableRow

                                                                                                                                                                                                                                            type TableRow struct {
                                                                                                                                                                                                                                            	// TableView that owns this row
                                                                                                                                                                                                                                            	TableView *TableView
                                                                                                                                                                                                                                            	// data for row is stored as properties of a page
                                                                                                                                                                                                                                            	Page *Block
                                                                                                                                                                                                                                            	// values extracted from Page for each column
                                                                                                                                                                                                                                            	Columns [][]*TextSpan

                                                                                                                                                                                                                                            type TableView

                                                                                                                                                                                                                                            type TableView struct {
                                                                                                                                                                                                                                            	// original data
                                                                                                                                                                                                                                            	Page           *Page
                                                                                                                                                                                                                                            	CollectionView *CollectionView
                                                                                                                                                                                                                                            	Collection     *Collection
                                                                                                                                                                                                                                            	// easier to work representation we calculate
                                                                                                                                                                                                                                            	Columns []*ColumnInfo
                                                                                                                                                                                                                                            	Rows    []*TableRow

                                                                                                                                                                                                                                              TableView represents a view of a table (Notion calls it a Collection View) Meant to be a representation that is easier to work with

                                                                                                                                                                                                                                              func (*TableView) CellContent

                                                                                                                                                                                                                                              func (t *TableView) CellContent(row, col int) []*TextSpan

                                                                                                                                                                                                                                              func (*TableView) ColumnCount

                                                                                                                                                                                                                                              func (t *TableView) ColumnCount() int

                                                                                                                                                                                                                                              func (*TableView) RowCount

                                                                                                                                                                                                                                              func (t *TableView) RowCount() int

                                                                                                                                                                                                                                              type TextAttr

                                                                                                                                                                                                                                              type TextAttr = []string

                                                                                                                                                                                                                                                TextAttr describes attributes of a span of text First element is name of the attribute (e.g. AttrLink) The rest are optional information about attribute (e.g. for AttrLink it's URL, for AttrUser it's user id etc.)

                                                                                                                                                                                                                                                type TextSpan

                                                                                                                                                                                                                                                type TextSpan struct {
                                                                                                                                                                                                                                                	Text  string     `json:"Text"`
                                                                                                                                                                                                                                                	Attrs []TextAttr `json:"Attrs"`

                                                                                                                                                                                                                                                  TextSpan describes a text with attributes

                                                                                                                                                                                                                                                  func ParseTextSpans

                                                                                                                                                                                                                                                  func ParseTextSpans(raw interface{}) ([]*TextSpan, error)

                                                                                                                                                                                                                                                    ParseTextSpans parses content from JSON into an easier to use form

                                                                                                                                                                                                                                                    func (*TextSpan) IsPlain

                                                                                                                                                                                                                                                    func (t *TextSpan) IsPlain() bool

                                                                                                                                                                                                                                                      IsPlain returns true if this InlineBlock is plain text i.e. has no attributes

                                                                                                                                                                                                                                                      type User

                                                                                                                                                                                                                                                      type User struct {
                                                                                                                                                                                                                                                      	Email                      string `json:"email"`
                                                                                                                                                                                                                                                      	FamilyName                 string `json:"family_name"`
                                                                                                                                                                                                                                                      	GivenName                  string `json:"given_name"`
                                                                                                                                                                                                                                                      	ID                         string `json:"id"`
                                                                                                                                                                                                                                                      	Locale                     string `json:"locale"`
                                                                                                                                                                                                                                                      	MobileOnboardingCompleted  bool   `json:"mobile_onboarding_completed"`
                                                                                                                                                                                                                                                      	OnboardingCompleted        bool   `json:"onboarding_completed"`
                                                                                                                                                                                                                                                      	ClipperOnboardingCompleted bool   `json:"clipper_onboarding_completed"`
                                                                                                                                                                                                                                                      	ProfilePhoto               string `json:"profile_photo"`
                                                                                                                                                                                                                                                      	TimeZone                   string `json:"time_zone"`
                                                                                                                                                                                                                                                      	Version                    int    `json:"version"`
                                                                                                                                                                                                                                                      	RawJSON map[string]interface{} `json:"-"`

                                                                                                                                                                                                                                                        User represents a Notion user


                                                                                                                                                                                                                                                        Path Synopsis
                                                                                                                                                                                                                                                        do module