Index | Files

package calendar

import ""

Package calendar provides a Google Calendar barista module.


Package Files



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.

type Event Uses

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 Uses

func (e Event) UntilAlert() time.Duration

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

func (Event) UntilEnd Uses

func (e Event) UntilEnd() time.Duration

UntilEnd returns the time remaining until the event ends.

func (Event) UntilStart Uses

func (e Event) UntilStart() time.Duration

UntilStart returns the time remaining until the event starts.

type EventList Uses

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 Uses

type Module struct {
    // contains filtered or unexported fields

Module represents a Google Calendar barista module.

func New Uses

func New(clientConfig []byte) *Module

New creates a calendar module from the given oauth config.

func (*Module) CalendarID Uses

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

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

func (*Module) Output Uses

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

Output sets the output format for the module.

func (*Module) RefreshInterval Uses

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 Uses

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

ShowDeclined controls whether declined events are shown or ignored.

func (*Module) Stream Uses

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

Stream starts the module.

func (*Module) TimeWindow Uses

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

TimeWindow controls the search window for future events.

type Status Uses

type Status string

Status represents the response/status for an event.

Package calendar imports 9 packages (graph) and is imported by 2 packages. Updated 2018-11-25. Refresh now. Tools for package owners.