Skip to content

Latest commit

 

History

History

version1

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

go-notion examples

This README helps to provide useful information to help people understand the examples in this directory.

Examples

Databases

The image below represents the structure of the database that was used in the examples.

Example DB

Examples

Pages

Pages can be added within databases or within other pages. If a page's parent is a database, it is added as an entry to that database. The rows in the "Example DB" image above represents pages within the DB. If a page's parent is another page, then it looks like the image below:

Page within a page

Examples

Blocks

Read more about blocks here. In the append-block example, I demo-ed adding a header and paragraph to a page. It'll look like the image below.

Append block children

Examples

Users

Examples

Search

I couldn't figure out how to combine the two calls below into one call. Ideally, we should be able to make a call to the Notion server that can contains an array of pages and databases. See the model below

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

The Results field cannot be []Page, neither can it be []Database because the results can be an array of both models. So, for now, the calls are split (with its own model). I'll add the things I've tried later, but if you think of something feel free to add as an issue to the repo :).

Examples