package basetypes import ( ics "github.com/PuloV/ics-golang" ) // Calendar type type Calendar struct { ics.Calendar } // NewCalendar creates a new calendar func NewCalendar() *Calendar { return &Calendar{*ics.NewCalendar()} } // ParseCalendarFile parses an ICS file and returns a calendar func ParseCalendarFile(filePath string) (*Calendar, error) { return &Calendar{*ics.NewCalendar()}, nil } // AddEvent adds an event to the calendar func (cal *Calendar) AddEvent(event *Event) (*Calendar, error) { //c, err := cal.SetEvent(event) return cal, nil } // AddEvents adds all events to the calendar func (cal *Calendar) AddEvents(event []*Event) (*Calendar, error) { //c, err := cal.SetEvent(event) return cal, nil } // AddEvent adds an event to the calendar func (cal *Calendar) RemoveEvent(event *Event) (*Calendar, error) { // c, err := cal.SetEvent(event) return cal, nil } // AddEvent adds an event to the calendar func (cal *Calendar) RemoveEvents(event []*Event) (*Calendar, error) { // c, err := cal.SetEvent(event) return cal, nil } // GetEvents gets all events in the calendar func (cal *Calendar) GetEvents() []*Event { subcal := cal.Calendar subevents := subcal.GetEvents() wrapped := make([]*Event, len(subevents)) for i, v := range subevents { wrapped[i] = &Event{v} } return wrapped }