ical

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 8 Imported by: 0

README

ical-go

iCal package for Go (Golang), forked from github.com/laurent22/ical-go

Installation

go get github.com/phcorcoran/ical-go

Status

Currently, the package doesn't support the full iCal specification. It's still a work in progress towards that goal.

The most useful function in the package is:

func ParseCalendar(data string) (*Node, error)

Parses a VCALENDAR string, unwrap and unfold lines, etc. and put all this into a usable structure (a collection of Nodes with name, value, type, etc.).

With the Node in hand, you can use several of its functions to, e.g., find specific parameters, children, etc.

License

MIT

Documentation

Index

Constants

View Source
const (
	VCALENDAR = "VCALENDAR"
	VEVENT    = "VEVENT"
	DTSTART   = "DTSTART"
	DTEND     = "DTEND"
	DURATION  = "DURATION"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Calendar

type Calendar struct {
	Items []CalendarEvent
}

func (*Calendar) Serialize

func (this *Calendar) Serialize() string

func (*Calendar) ToICS

func (this *Calendar) ToICS() string

type CalendarEvent

type CalendarEvent struct {
	Id            string
	Summary       string
	Description   string
	Location      string
	URL           string
	CreatedAtUTC  *time.Time
	ModifiedAtUTC *time.Time
	StartAt       *time.Time
	EndAt         *time.Time
}

func (*CalendarEvent) EndAtUTC

func (this *CalendarEvent) EndAtUTC() *time.Time

func (*CalendarEvent) Serialize

func (this *CalendarEvent) Serialize() string

func (*CalendarEvent) StartAtUTC

func (this *CalendarEvent) StartAtUTC() *time.Time

func (*CalendarEvent) ToICS

func (this *CalendarEvent) ToICS() string

type Node

type Node struct {
	Name       string
	Value      string
	Type       int // 1 = Object, 0 = Name/Value
	Parameters map[string]string
	Children   []*Node
}

func ParseCalendar

func ParseCalendar(data string) (*Node, error)

func (*Node) ChildByName

func (this *Node) ChildByName(name string) *Node

func (*Node) ChildrenByName

func (this *Node) ChildrenByName(name string) []*Node

func (*Node) DigParameter

func (this *Node) DigParameter(paramPath ...string) (string, bool)

func (*Node) DigProperty

func (this *Node) DigProperty(propPath ...string) (string, bool)

func (*Node) Parameter

func (this *Node) Parameter(name string, defaultValue string) string

func (*Node) PropDate

func (this *Node) PropDate(name string, defaultValue time.Time) time.Time

func (*Node) PropDuration

func (this *Node) PropDuration(name string) time.Duration

func (*Node) PropInt

func (this *Node) PropInt(name string, defaultValue int) int

func (*Node) PropString

func (this *Node) PropString(name string, defaultValue string) string

func (*Node) String

func (this *Node) String() string

Jump to

Keyboard shortcuts

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