icalcache

package module
v0.0.0-...-d8aabf5 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: MIT Imports: 11 Imported by: 2

README

go-ical-cache

Go Reference

Package icalcache provides a caching iCalendar client. It caches only a few props (AllDay, Start, End, UID, URL, Summary). The client does up to one HTTP HEAD request every Interval. If the Last-Modified` header has changed, then the feed is fetched from upstream.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Config
	Interval time.Duration // default is two minutes
	// contains filtered or unexported fields
}

func (*Cache) Get

func (cache *Cache) Get(defaultLocation *time.Location) ([]Event, int64, error)

Get returns all events. The defaultLocation parameter is used if the ical data contains no TZID location.

type Config

type Config struct {
	URL           string `json:"url"`
	Username      string `json:"username"` // optional
	Password      string `json:"password"` // optional
	SkipTLSVerify bool   `json:"skip-tls-verify"`
}

func LoadConfig

func LoadConfig(jsonfile string) (Config, error)

type Event

type Event struct {
	AllDay         bool
	Start          time.Time
	End            time.Time
	RecurrenceRule string
	UID            string
	URL            string
	Summary        string
	Description    string
}

Jump to

Keyboard shortcuts

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