data

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginningOfDay

func BeginningOfDay(t time.Time) time.Time

func EndOfDay

func EndOfDay(t time.Time) time.Time

func GetTime

func GetTime(t time.Time) time.Time

func SetTimezone

func SetTimezone(tz string) error

Types

type CalService

type CalService struct{}

CalService is a service to fetch iCalendar formatted data

func (CalService) GetTodaysEvents

func (s CalService) GetTodaysEvents(ctx context.Context, url, timezone string) (CalendarResponse, error)

GetTodaysEvents gets today's events from the given ical calendar url and the timezone.

type CalendarEvent

type CalendarEvent struct {
	UID         string    `json:"uid"`         // Unique event id
	Summary     string    `json:"summary"`     // Event summary
	Description string    `json:"description"` // Event long description
	StartTime   time.Time `json:"starttime"`   // Event start time
	EndTime     time.Time `json:"endtime"`     // Event end time
}

type CalendarResponse

type CalendarResponse struct {
	TimeZone         string          `json:"timezone"`         // The timezone used
	CurrentLocalTime time.Time       `json:"currentlocaltime"` // Sanity check:  Current local time in the timezone given
	Events           []CalendarEvent `json:"events"`           // The calendar events found
	Version          string          `json:"version"`          // Service version
}

Jump to

Keyboard shortcuts

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