calendar

package
v0.0.0-...-069b4f3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package calendar provides a Google Calendar barista module.

Index

Constants

View Source
const (
	StatusUnknown     = Status("")
	StatusConfirmed   = Status("confirmed")
	StatusTentative   = Status("tentative")
	StatusCancelled   = Status("cancelled")
	StatusDeclined    = Status("declined")
	StatusUnresponded = Status("needsAction")
)

Possible values for status per the calendar API.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Start       time.Time
	End         time.Time
	Alert       time.Time
	EventStatus Status
	Response    Status
	Location    string
	Summary     string
}

Event represents a calendar event.

func (Event) UntilAlert

func (e Event) UntilAlert() time.Duration

UntilAlert returns the time remaining until a notification should be displayed for this event.

func (Event) UntilEnd

func (e Event) UntilEnd() time.Duration

UntilEnd returns the time remaining until the event ends.

func (Event) UntilStart

func (e Event) UntilStart() time.Duration

UntilStart returns the time remaining until the event starts.

type EventList

type EventList struct {
	// All events currently in progress
	InProgress []Event
	// Events where the time until start is less than the notification duration
	Alerting []Event
	// All other future events
	Upcoming []Event
}

EventList represents the list of events split by the temporal state of each event: in progress, alerting (upcoming but within notification duration), or upcoming beyond the notification duration.

type Module

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

Module represents a Google Calendar barista module.

func New

func New(clientConfig []byte) *Module

New creates a calendar module from the given oauth config.

func (*Module) CalendarID

func (m *Module) CalendarID(id string) *Module

CalendarID sets the ID of the calendar to fetch events for.

func (*Module) Output

func (m *Module) Output(outputFunc func(EventList) bar.Output) *Module

Output sets the output format for the module.

func (*Module) RefreshInterval

func (m *Module) RefreshInterval(interval time.Duration) *Module

RefreshInterval sets the interval for fetching new events. Note that this is distinct from the rendering interval, which is returned by the output func on each new output.

func (*Module) ShowDeclined

func (m *Module) ShowDeclined(show bool) *Module

ShowDeclined controls whether declined events are shown or ignored.

func (*Module) Stream

func (m *Module) Stream(sink bar.Sink)

Stream starts the module.

func (*Module) TimeWindow

func (m *Module) TimeWindow(window time.Duration) *Module

TimeWindow controls the search window for future events.

type Status

type Status string

Status represents the response/status for an event.

Jump to

Keyboard shortcuts

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