client

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToBlocks added in v0.1.0

func ToBlocks(text string) []notionapi.Block

ToBlocks converts a string of text to a list of Notion blocks.

Types

type Config added in v0.1.0

type Config struct {
	NotionKey    string
	OpenAIAPIKey string
	// contains filtered or unexported fields
}

Config holds the configuration for the client.

func LoadConfig added in v1.1.2

func LoadConfig() *Config

LoadConfig loads configuration from environment variables.

func (*Config) DeletePost added in v0.1.0

func (c *Config) DeletePost(ctx context.Context, pageID string) error

DeletePost deletes a journal entry by archiving it in Notion.

func (*Config) GetClient added in v0.1.0

func (c *Config) GetClient() *notionapi.Client

GetClient returns a cached Notion client.

func (*Config) GetPost added in v0.1.0

func (c *Config) GetPost(ctx context.Context, key string) (*Post, error)

GetPost retrieves a journal entry by its key.

func (*Config) GetPostFullContent added in v0.1.0

func (c *Config) GetPostFullContent(ctx context.Context, pageID string) (string, error)

GetPostFullContent fetches the full content of a post by page ID

func (*Config) ListPosts added in v0.1.0

func (c *Config) ListPosts(ctx context.Context, count int) ([]*Post, error)

ListPosts lists the most recent journal entries.

func (*Config) SaveEntry added in v0.1.0

func (c *Config) SaveEntry(ctx context.Context, text string) error

SaveEntry saves a new journal entry to Notion.

func (*Config) SearchPosts added in v0.1.0

func (c *Config) SearchPosts(ctx context.Context, query string, maxResults int) ([]*Post, error)

SearchPosts uses Notion's native Search API to find matching pages.

func (*Config) TimeSinceLastPost added in v0.1.0

func (c *Config) TimeSinceLastPost(ctx context.Context) (time.Duration, error)

TimeSinceLastPost returns the time since the last post was created.

func (*Config) UpdateCache added in v0.1.0

func (c *Config) UpdateCache(ctx context.Context) error

UpdateCache updates the cache with the latest post.

func (*Config) Validate added in v1.1.2

func (c *Config) Validate() error

Validate checks that all required configuration values are present.

type Post

type Post struct {
	// ID is the unique identifier of the post.
	ID     string
	PageID string // Notion page ID for fetching full content
	// Tags are the tags associated with the post.
	Tags []string
	// Text is the content of the post.
	Text string
	// CreatedAt is the time the post was created.
	CreatedAt time.Time
	// ModifiedAt is the time the post was last modified.
	ModifiedAt time.Time
}

Post represents a journal entry.

Jump to

Keyboard shortcuts

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