client

package
v1.4.12 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CachePath added in v1.3.0

func CachePath(filename string) (string, error)

CachePath returns the path for a cache file under the config directory. Example: CachePath("timesince.cache") => ~/.config/etu/timesince.cache

func ConfigDir added in v1.3.0

func ConfigDir() (string, error)

ConfigDir returns the etu config directory (e.g. ~/.config/etu on Unix). Creates the directory if it does not exist. Use this for config and cache files.

func ConfigPath added in v1.3.0

func ConfigPath() (string, error)

ConfigPath returns the path to the config file (~/.config/etu/config.json).

func LoadAudioUploads added in v1.3.0

func LoadAudioUploads(paths []string) ([]*proto.AudioUpload, error)

LoadAudioUploads reads audio files from paths and returns proto AudioUpload messages. MIME type is detected from content (or file extension as fallback).

func LoadImageUploads added in v1.3.0

func LoadImageUploads(paths []string) ([]*proto.ImageUpload, error)

LoadImageUploads reads image files from paths and returns proto ImageUpload messages. MIME type is detected from content (or file extension as fallback).

Types

type Config added in v0.1.0

type Config struct {
	ApiKey     string
	GRPCTarget 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 ~/.config/etu/config.json and environment variables. Env ETU_API_KEY and ETU_GRPC_TARGET override file values. If no config file exists and no API key is set, a config file is created with the correct structure and an empty key.

func (*Config) DeletePost added in v0.1.0

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

DeletePost deletes a journal entry by ID.

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 ID.

func (*Config) GetRandomPosts added in v1.4.0

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

GetRandomPosts fetches random journal entries from the backend.

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, imagePaths, audioPaths []string) error

SaveEntry saves a new journal entry via the backend (tags are generated on the backend). imagePaths and audioPaths are optional paths to image and audio files to attach to the note.

func (*Config) SearchPosts added in v0.1.0

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

SearchPosts searches journal entries via the backend.

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 the API key is present.

type ConfigFile added in v1.3.0

type ConfigFile struct {
	APIKey     string `json:"api_key"`
	GRPCTarget string `json:"grpc_target"`
}

configFile represents the persisted config file format.

func SaveConfig added in v1.3.0

func SaveConfig(apiKey, grpcTarget string) (*ConfigFile, error)

SaveConfig writes api_key and grpc_target to ~/.config/etu/config.json. Creates the config directory if it does not exist.

type Post

type Post struct {
	PageID    string // Note ID for fetching full content
	Tags      []string
	Text      string
	CreatedAt time.Time
	Images    []*proto.NoteImage
	Audios    []*proto.NoteAudio
}

Post represents a journal entry (display model for TUI/CLI).

Jump to

Keyboard shortcuts

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