1
0
mirror of https://github.com/dstotijn/go-notion.git synced 2024-11-19 17:41:49 +02:00
Go client for the Notion API.
Go to file
2023-02-28 19:08:08 +01:00
.github/workflows Add testing via GitHub Actions 2022-09-11 20:22:32 +02:00
examples Add support for audio block type (#48) 2022-11-18 19:55:59 +01:00
block.go Don't panic when unmarshaling blocks (#50) 2023-02-21 20:28:33 +01:00
client_test.go Don't panic when unmarshaling blocks (#50) 2023-02-21 20:28:33 +01:00
client.go Don't panic when unmarshaling blocks (#50) 2023-02-21 20:28:33 +01:00
comment.go Add support for new Comments endpoints (#43) 2022-09-04 20:48:51 +02:00
cover.go Add file metadata to file DB page prop 2021-12-20 20:12:44 +01:00
database.go Update status property type behavior (#40) 2022-09-03 21:52:15 +02:00
error.go Gracefully handle JSON decode error on erroneous API response (#51) 2023-02-28 19:08:08 +01:00
file.go Add file metadata to file DB page prop 2021-12-20 20:12:44 +01:00
go.mod Add testing via GitHub Actions 2022-09-11 20:22:32 +02:00
go.sum Add example for Client.CreatePage method (#39) 2022-09-03 21:03:02 +02:00
icon.go Add file metadata to file DB page prop 2021-12-20 20:12:44 +01:00
LICENSE Initial commit 2021-05-13 22:11:32 +02:00
page.go add block parent (#45) 2022-10-27 11:45:25 +02:00
parent.go Add missing block_id parent type 2022-08-20 15:40:41 +02:00
README.md Fix typo 2022-09-11 20:30:04 +02:00
rich_text.go Add support for template mentions in RichText values (#32) 2022-08-14 11:15:15 +02:00
search.go Fix faulty search sort type, add consts for sort props 2021-05-27 20:50:04 +02:00
time_test.go Add custom type for Notion date properties with optional time 2021-05-23 14:02:17 +02:00
time.go Add custom type for Notion date properties with optional time 2021-05-23 14:02:17 +02:00
user.go Add created_by and last_edited_by support, add archived for DB (#30) 2022-08-13 19:46:00 +02:00
util.go Fix incorrect types for Formula, Relation and Rollup page props 2021-05-24 16:33:03 +02:00

go-notion

GitHub tag (latest
SemVer) Test Go
Reference GitHub Go Report
Card

go-notion is a client for the Notion API, written in Go.

Features

The client supports all (non-deprecated) endpoints available in the Notion API, as of September 4, 2022:

Databases
Pages
Blocks
Users
Search
Comments

Installation

$ go get github.com/dstotijn/go-notion

Usage

To obtain an API key, follow Notion’s getting started guide.

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 for a complete reference and the 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.

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

© 2022 David Stotijn