forked from jomei/notionapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
20 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,42 @@ | ||
# notionapi | ||
|
||
[](https://github.com/jomei/notionapi/tags) | ||
[](https://pkg.go.dev/github.com/jomei/notionapi) | ||
[](https://github.com/jomei/notionapi/actions/workflows/test.yml) | ||
|
||
An API client for the [Notion API](https://developers.notion.com/) implemented in Golang | ||
This is a Golang implementation of an API client for the [Notion API](https://developers.notion.com/). | ||
|
||
# Supported APIs | ||
It supports all APIs for Notion API version `2022-06-28` | ||
## Supported APIs | ||
|
||
# Installation | ||
It supports all APIs of the Notion API version `2022-06-28`. | ||
|
||
## Installation | ||
|
||
```bash | ||
go get github.com/jomei/notionapi | ||
``` | ||
$ go get github.com/jomei/notionapi | ||
``` | ||
|
||
# Getting started | ||
Follow Notion’s [getting started guide](https://developers.notion.com/docs/getting-started) to obtain an Integration Token. | ||
## Usage | ||
|
||
First, please follow the [Getting Started Guide](https://developers.notion.com/docs/getting-started) to obtain an integration token. | ||
|
||
## Example | ||
### Initialization | ||
|
||
Make a new `Client` | ||
Import this library and initialize the API client using the obtained integration token. | ||
|
||
```go | ||
import "github.com/jomei/notionapi" | ||
|
||
|
||
client := notionapi.NewClient("your-integration-token") | ||
client := notionapi.NewClient("your_integration_token") | ||
``` | ||
Then, use client's methods to retrieve or update your content | ||
|
||
### Calling the API | ||
|
||
You can use the methods of the initialized client to call the Notion API. Here is an example of how to retrieve a page: | ||
|
||
```go | ||
page, err := client.Page.Get(context.Background(), "your-page-id") | ||
page, err := client.Page.Get(context.Background(), "your_page_id") | ||
if err != nil { | ||
// do something | ||
// Handle the error | ||
} | ||
``` |