notion

module
v0.0.0-...-1e12fbf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2025 License: MIT

README

Notion API

Go Reference OpenAPI Go Report Card Code Coverage

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,
		StartCursor: uuid.MustParse("d05aa478-397e-4954-b694-b7c1c6c78956"),
	})
	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.

Directories

Path Synopsis
internal
probe command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL