data

package
v1.0.14 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEventsForDay added in v1.0.10

func GetEventsForDay(calendarBody io.Reader, start, end time.Time, location *time.Location) ([]gocal.Event, error)

GetEventsForDay gets events for the day given the calendar body and start/end times

func RewriteToLocal added in v1.0.5

func RewriteToLocal(t time.Time, loc *time.Location) time.Time

RewriteToLocal - rewrites a given time to use the passed location data

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