Skip to content

johnhaha/nose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👃 nose

notion api support basic functions such as create page, db, text block

🔽 How to install

go get github.com/johnhaha/[email protected]

📃 Page API

Create Page Client

client := nose.NewPageClient("YOUR-TOKEN","PARENT-PAGE-ID")

Create New Page

client.NewEmptyPage("PAGE-NAME")

Create Database

save Struct data to json, with nose tag

type Sample struct {
	Title     string     `json:"title" nose:"title"`
    Desc      string     `json:"desc" nose:"orange,bold"`
	Count     int        `json:"count"`
	Updated   time.Time  `json:"updated"`
	CreatedAt time.Time  `json:"createdAt"`
} 
client.NewDB("DATABASE-NAME",Sample{})

Append Text Block

only support text

client.AppendTextBlock("TEXT-CONTENT")

Append TODO Block

client.AppendTodoBlock("BLOCK-CONTENT")

🐬 Database API

Create Database Client

client := nose.NewDBClient("YOUR-TOKEN","DATABASE-ID")

Insert page to database

save struct data to database

client.SaveData(sample)

🎎 Client Exchange

Page Client to DB Client

client := nose.NewPageClient("YOUR-TOKEN","PARENT-PAGE-ID")
dbClient := client.ToDB("DBID")

DB Client to Page Client

client := nose.NewDBClient("YOUR-TOKEN","DB-ID")
dbClient := client.ToPage("PAGE-ID")

About

notion api

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages