Skip to content

go-api-libs/notion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notion API

Go Reference OpenAPI Go Report Card Code Coverage License: MIT

Create an integration to retrieve an API token, add your database and page ID's as variables in the collection, and start making your requests!

For our full documentation, including sample integrations and guides, visit developers.notion.com

Need more help? Join our developer community on Slack

Installation

To install the library, use the following command:

go get github.com/go-api-libs/notion/pkg/notion

Usage

Example 1: Retrieve a Page

package main

import (
	"context"

	"github.com/go-api-libs/notion/pkg/notion"
	"github.com/google/uuid"
)

func main() {
	c, err := notion.NewClient()
	if err != nil {
		panic(err)
	}

	ctx := context.Background()
	page, err := c.GetPage(ctx, uuid.MustParse("96245c8f-1784-44a4-82ad-1941127c3ec3"))
	if err != nil {
		panic(err)
	}

	// Use page object
}

Example 2: Retrieve block children

package main

import (
	"context"

	"github.com/go-api-libs/notion/pkg/notion"
	"github.com/google/uuid"
)

func main() {
	c, err := notion.NewClient()
	if err != nil {
		panic(err)
	}

	ctx := context.Background()
	blocksList, err := c.GetBlocks(ctx, uuid.MustParse("96245c8f-1784-44a4-82ad-1941127c3ec3"), &notion.GetBlocksParams{PageSize: 100})
	if err != nil {
		panic(err)
	}

	// Use blocksList object
}

Additional Information

Contributing

If you have any contributions to make, please submit a pull request or open an issue on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.