Skip to content

mkfsn/notion-go

Repository files navigation

notion-go

Go Report Card Actions Status codecov

Go Reference GitHub go.mod Go version License

A go client for the Notion API

Description

This aims to be an unofficial Go version of the official SDK which is written in JavaScript.

Installation

go get -u github.com/mkfsn/notion-go

Usage

c := notion.New("<NOTION_AUTH_TOKEN>")

// Retrieve block children
c.Blocks().Children().List(context.Background(), notion.BlocksChildrenListParameters{...})

// Append block children
c.Blocks().Children().Append(context.Background(), notion.BlocksChildrenAppendParameters{...})

// List databases
c.Databases().List(context.Background(), notion.DatabasesListParameters{...})

// Query a database
c.Databases().Query(context.Background(), notion.DatabasesQueryParameters{...})

// Retrieve a database
c.Databases().Retrieve(context.Background(), notion.DatabasesRetrieveParameters{...})

// Create a page
c.Pages().Create(context.Background(), notion.PagesCreateParameters{...})

// Retrieve a page
c.Pages().Retreive(context.Background(), notion.PagesRetrieveParameters{...})

// Update page properties
c.Pages().Update(context.Background(), notion.PagesUpdateParameters{...})

// List all users
c.Users().List(context.Background(), notion.UsersListParameters{...})

// Retrieve a user
c.Users().Retrieve(context.Background(), notion.UsersRetrieveParameters{...})

// Search
c.Search(context.Background(), notion.SearchParameters{...})

For more information, please see examples.

Supported Features

This client supports all endpoints in the Notion API.