notion

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const IgnoreDatabaseDuration = 5 * time.Minute

IgnoreDatabaseDuration define how often we can try to pull unknown databases when database pull fails

Variables

This section is empty.

Functions

This section is empty.

Types

type DataItem

type DataItem struct {
	ID          string         `json:"id"`
	Properties  []DataProperty `json:"properties"`
	LastUpdated time.Time      `json:"last_updated"`
}

type DataProperty

type DataProperty struct {
	Name   string   `json:"name"`   // e.g. Status
	Values []string `json:"values"` // One or more values, e.g. In Progress
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewDataService

func NewDataService(notionAccessToken string, pollDuration time.Duration, knownDatabases []string) *Service

func (*Service) CleanupLoop

func (s *Service) CleanupLoop()

func (*Service) IsDatabaseIgnored

func (s *Service) IsDatabaseIgnored(notionID string) bool

func (*Service) ListDatabases

func (s *Service) ListDatabases() []string

The Notion has deprecated the List databases endpoint. So there is no option to list them. Instead of List, we construct list of the databases map in the Service struct. Object is added to the database map when requested for a first time.

func (*Service) QueryDatabase

func (s *Service) QueryDatabase(notionID string, updateMapIfSuccess bool) ([]DataItem, error)

func (*Service) QueryDatabaseCached

func (s *Service) QueryDatabaseCached(notionID string) ([]DataItem, error)

func (*Service) Start

func (s *Service) Start()

func (*Service) Stop

func (s *Service) Stop()

Jump to

Keyboard shortcuts

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