Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dstotijn/go-notion
Go client for the Notion API.
https://github.com/dstotijn/go-notion
client go golang notion notion-api
Last synced: 1 day ago
JSON representation
Go client for the Notion API.
- Host: GitHub
- URL: https://github.com/dstotijn/go-notion
- Owner: dstotijn
- License: mit
- Created: 2021-05-13T20:09:09.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-26T12:14:56.000Z (10 months ago)
- Last Synced: 2025-01-15T11:37:48.123Z (9 days ago)
- Topics: client, go, golang, notion, notion-api
- Language: Go
- Homepage:
- Size: 109 KB
- Stars: 383
- Watchers: 9
- Forks: 39
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-notion
[![GitHub tag (latest
SemVer)](https://img.shields.io/github/v/tag/dstotijn/go-notion?label=go%20module)](https://github.com/dstotijn/go-notion/tags)
[![Test](https://github.com/dstotijn/go-notion/actions/workflows/test.yaml/badge.svg)](https://github.com/dstotijn/go-notion/actions/workflows/test.yaml)
[![Go
Reference](https://pkg.go.dev/badge/github.com/dstotijn/go-notion.svg)](https://pkg.go.dev/github.com/dstotijn/go-notion)
[![GitHub](https://img.shields.io/github/license/dstotijn/go-notion)](LICENSE)
[![Go Report
Card](https://goreportcard.com/badge/github.com/dstotijn/go-notion)](https://goreportcard.com/report/github.com/dstotijn/go-notion)**go-notion** is a client for the [Notion
API](https://developers.notion.com/reference), written in
[Go](https://golang.org/).## Features
The client supports all (non-deprecated) endpoints available in the Notion API,
as of September 4, 2022:Databases
- [x] [Query a
database](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.QueryDatabase)
- [x] [Create a
database](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.CreateDatabase)
- [x] [Update
database](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.UpdateDatabase)
- [x] [Retrieve a
database](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.FindDatabaseByID)Pages
- [x] [Retrieve a
page](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.FindPageByID)
- [x] [Create a
page](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.CreatePage)
- [x] [Update
page](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.UpdatePage)
- [x] [Retrieve a page
property](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.FindPagePropertyByID)Blocks
- [x] [Retrieve a
block](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.FindBlockByID)
- [x] [Update
block](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.UpdateBlock)
- [x] [Retrieve block
children](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.FindBlockChildrenByID)
- [x] [Append block
children](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.AppendBlockChildren)
- [x] [Delete
block](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.DeleteBlock)Users
- [x] [Retrieve a
user](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.FindUserByID)
- [x] [List all
users](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.ListUsers)
- [x] [Retrieve your token's bot
user](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.FindCurrentUser)Search
- [x] [Search](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.Search)
Comments
- [x] [Retrieve
comments](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.FindCommentsByBlockID)
- [x] [Create a
comment](https://pkg.go.dev/github.com/dstotijn/go-notion#Client.CreateComment)## Installation
```sh
$ go get github.com/dstotijn/go-notion
```## Usage
To obtain an API key, follow Notionβs [getting started
guide](https://developers.notion.com/docs/getting-started).```go
import "github.com/dstotijn/go-notion"(...)
client := notion.NewClient("secret-api-key")
page, err := client.FindPageByID(context.Background(), "18d35eb5-91f1-4dcb-85b0-c340fd965015")
if err != nil {
// Handle error...
}
```π Check out the docs on
[pkg.go.dev](https://pkg.go.dev/github.com/dstotijn/go-notion) for a complete
reference and the [examples](/examples) directory for more example code.## Status
The Notion API itself is out of beta. This library is updated periodically
following documented changes from the Notion
[changelog](https://developers.notion.com/changelog).**Note:** This library **will** make breaking changes in its code until
`v1.0` of the module is released. There are no immediate plans for a `v1.0`
release. I want the design choices to be solidified and battle-tested more
before committing to a stable release (and the possible burden of a "v2+" Go
module should I want to introduce breaking changes).## License
[MIT License](LICENSE)
Β© 2022 [David Stotijn](https://v0x.nl)