ics

package module
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 12 Imported by: 100

README

golang-ical

A ICS / ICal parser and serialiser for Golang.

GoDoc

Because the other libraries didn't quite do what I needed.

Usage, parsing:

    cal, err := ParseCalendar(strings.NewReader(input))

Creating:

  cal := ics.NewCalendar()
  cal.SetMethod(ics.MethodRequest)
  event := cal.AddEvent(fmt.Sprintf("id@domain", p.SessionKey.IntID()))
  event.SetCreatedTime(time.Now())
  event.SetDtStampTime(time.Now())
  event.SetModifiedAt(time.Now())
  event.SetStartAt(time.Now())
  event.SetEndAt(time.Now())
  event.SetSummary("Summary")
  event.SetLocation("Address")
  event.SetDescription("Description")
  event.SetURL("https://URL/")
  event.AddRrule(fmt.Sprintf("FREQ=YEARLY;BYMONTH=%d;BYMONTHDAY=%d", time.Now().Month(), time.Now().Day()))
  event.SetOrganizer("sender@domain", ics.WithCN("This Machine"))
  event.AddAttendee("reciever or participant", ics.CalendarUserTypeIndividual, ics.ParticipationStatusNeedsAction, ics.ParticipationRoleReqParticipant, ics.WithRSVP(true))
  return cal.Serialize()

Helper methods created as needed feel free to send a P.R. with more.

Notice

Looking for a co-maintainer.

Documentation

Index

Constants

View Source
const (
	ComponentPropertyUniqueId        = ComponentProperty(PropertyUid) // TEXT
	ComponentPropertyDtstamp         = ComponentProperty(PropertyDtstamp)
	ComponentPropertyOrganizer       = ComponentProperty(PropertyOrganizer)
	ComponentPropertyAttendee        = ComponentProperty(PropertyAttendee)
	ComponentPropertyAttach          = ComponentProperty(PropertyAttach)
	ComponentPropertyDescription     = ComponentProperty(PropertyDescription) // TEXT
	ComponentPropertyCategories      = ComponentProperty(PropertyCategories)  // TEXT
	ComponentPropertyClass           = ComponentProperty(PropertyClass)       // TEXT
	ComponentPropertyColor           = ComponentProperty(PropertyColor)       // TEXT
	ComponentPropertyCreated         = ComponentProperty(PropertyCreated)
	ComponentPropertySummary         = ComponentProperty(PropertySummary) // TEXT
	ComponentPropertyDtStart         = ComponentProperty(PropertyDtstart)
	ComponentPropertyDtEnd           = ComponentProperty(PropertyDtend)
	ComponentPropertyLocation        = ComponentProperty(PropertyLocation) // TEXT
	ComponentPropertyStatus          = ComponentProperty(PropertyStatus)   // TEXT
	ComponentPropertyFreebusy        = ComponentProperty(PropertyFreebusy)
	ComponentPropertyLastModified    = ComponentProperty(PropertyLastModified)
	ComponentPropertyUrl             = ComponentProperty(PropertyUrl)
	ComponentPropertyGeo             = ComponentProperty(PropertyGeo)
	ComponentPropertyTransp          = ComponentProperty(PropertyTransp)
	ComponentPropertySequence        = ComponentProperty(PropertySequence)
	ComponentPropertyExdate          = ComponentProperty(PropertyExdate)
	ComponentPropertyExrule          = ComponentProperty(PropertyExrule)
	ComponentPropertyRdate           = ComponentProperty(PropertyRdate)
	ComponentPropertyRrule           = ComponentProperty(PropertyRrule)
	ComponentPropertyAction          = ComponentProperty(PropertyAction)
	ComponentPropertyTrigger         = ComponentProperty(PropertyTrigger)
	ComponentPropertyPriority        = ComponentProperty(PropertyPriority)
	ComponentPropertyResources       = ComponentProperty(PropertyResources)
	ComponentPropertyCompleted       = ComponentProperty(PropertyCompleted)
	ComponentPropertyDue             = ComponentProperty(PropertyDue)
	ComponentPropertyPercentComplete = ComponentProperty(PropertyPercentComplete)
	ComponentPropertyTzid            = ComponentProperty(PropertyTzid)
	ComponentPropertyComment         = ComponentProperty(PropertyComment)
)

Variables

This section is empty.

Functions

func FromText

func FromText(s string) string

func ToText

func ToText(s string) string

Types

type Action

type Action string
const (
	ActionAudio     Action = "AUDIO"
	ActionDisplay   Action = "DISPLAY"
	ActionEmail     Action = "EMAIL"
	ActionProcedure Action = "PROCEDURE"
)

type Attendee

type Attendee struct {
	IANAProperty
}

func (*Attendee) Email

func (attendee *Attendee) Email() string

func (*Attendee) ParticipationStatus

func (attendee *Attendee) ParticipationStatus() ParticipationStatus

type BaseProperty

type BaseProperty struct {
	IANAToken      string
	ICalParameters map[string][]string
	Value          string
}

func ParseProperty

func ParseProperty(contentLine ContentLine) (*BaseProperty, error)

type Calendar

type Calendar struct {
	Components         []Component
	CalendarProperties []CalendarProperty
}

func NewCalendar

func NewCalendar() *Calendar

func NewCalendarFor

func NewCalendarFor(service string) *Calendar

func ParseCalendar

func ParseCalendar(r io.Reader) (*Calendar, error)

func (*Calendar) AddBusy added in v0.2.4

func (calendar *Calendar) AddBusy(id string) *VBusy

func (*Calendar) AddEvent

func (calendar *Calendar) AddEvent(id string) *VEvent

func (*Calendar) AddJournal added in v0.2.4

func (calendar *Calendar) AddJournal(id string) *VJournal

func (*Calendar) AddTimezone added in v0.2.4

func (calendar *Calendar) AddTimezone(id string) *VTimezone

func (*Calendar) AddTodo added in v0.2.4

func (calendar *Calendar) AddTodo(id string) *VTodo

func (*Calendar) AddVAlarm added in v0.2.4

func (calendar *Calendar) AddVAlarm(e *VAlarm)

func (*Calendar) AddVBusy added in v0.2.4

func (calendar *Calendar) AddVBusy(e *VBusy)

func (*Calendar) AddVEvent

func (calendar *Calendar) AddVEvent(e *VEvent)

func (*Calendar) AddVJournal added in v0.2.4

func (calendar *Calendar) AddVJournal(e *VJournal)

func (*Calendar) AddVTimezone added in v0.2.4

func (calendar *Calendar) AddVTimezone(e *VTimezone)

func (*Calendar) AddVTodo added in v0.2.4

func (calendar *Calendar) AddVTodo(e *VTodo)

func (*Calendar) Alarms added in v0.2.4

func (calendar *Calendar) Alarms() (r []*VAlarm)

func (*Calendar) Busys added in v0.2.4

func (calendar *Calendar) Busys() (r []*VBusy)

func (*Calendar) Events

func (calendar *Calendar) Events() (r []*VEvent)

func (*Calendar) Journals added in v0.2.4

func (calendar *Calendar) Journals() (r []*VJournal)

func (*Calendar) RemoveEvent added in v0.2.1

func (calendar *Calendar) RemoveEvent(id string)

func (*Calendar) Serialize

func (calendar *Calendar) Serialize() string

func (*Calendar) SerializeTo

func (calendar *Calendar) SerializeTo(w io.Writer) error

func (*Calendar) SetCalscale

func (calendar *Calendar) SetCalscale(s string, props ...PropertyParameter)

func (*Calendar) SetColor

func (calendar *Calendar) SetColor(s string, props ...PropertyParameter)

func (*Calendar) SetDescription

func (calendar *Calendar) SetDescription(s string, props ...PropertyParameter)

func (*Calendar) SetLastModified

func (calendar *Calendar) SetLastModified(t time.Time, props ...PropertyParameter)

func (*Calendar) SetMethod

func (calendar *Calendar) SetMethod(method Method, props ...PropertyParameter)

func (*Calendar) SetName

func (calendar *Calendar) SetName(s string, props ...PropertyParameter)

func (*Calendar) SetProductId

func (calendar *Calendar) SetProductId(s string, props ...PropertyParameter)

func (*Calendar) SetRefreshInterval

func (calendar *Calendar) SetRefreshInterval(s string, props ...PropertyParameter)

func (*Calendar) SetTimezoneId

func (calendar *Calendar) SetTimezoneId(s string, props ...PropertyParameter)

func (*Calendar) SetTzid

func (calendar *Calendar) SetTzid(s string, props ...PropertyParameter)

func (*Calendar) SetUrl

func (calendar *Calendar) SetUrl(s string, props ...PropertyParameter)

func (*Calendar) SetVersion

func (calendar *Calendar) SetVersion(s string, props ...PropertyParameter)

func (*Calendar) SetXPublishedTTL

func (calendar *Calendar) SetXPublishedTTL(s string, props ...PropertyParameter)

func (*Calendar) SetXWRCalDesc

func (calendar *Calendar) SetXWRCalDesc(s string, props ...PropertyParameter)

func (*Calendar) SetXWRCalID

func (calendar *Calendar) SetXWRCalID(s string, props ...PropertyParameter)

func (*Calendar) SetXWRCalName

func (calendar *Calendar) SetXWRCalName(s string, props ...PropertyParameter)

func (*Calendar) SetXWRTimezone

func (calendar *Calendar) SetXWRTimezone(s string, props ...PropertyParameter)

func (*Calendar) Timezones added in v0.2.4

func (calendar *Calendar) Timezones() (r []*VTimezone)

func (*Calendar) Todos added in v0.2.4

func (calendar *Calendar) Todos() (r []*VTodo)

type CalendarProperty

type CalendarProperty struct {
	BaseProperty
}

type CalendarStream

type CalendarStream struct {
	// contains filtered or unexported fields
}

func NewCalendarStream

func NewCalendarStream(r io.Reader) *CalendarStream

func (*CalendarStream) ReadLine

func (cs *CalendarStream) ReadLine() (*ContentLine, error)

type CalendarUserType

type CalendarUserType string
const (
	CalendarUserTypeIndividual CalendarUserType = "INDIVIDUAL"
	CalendarUserTypeGroup      CalendarUserType = "GROUP"
	CalendarUserTypeResource   CalendarUserType = "RESOURCE"
	CalendarUserTypeRoom       CalendarUserType = "ROOM"
	CalendarUserTypeUnknown    CalendarUserType = "UNKNOWN"
)

func (CalendarUserType) KeyValue

func (cut CalendarUserType) KeyValue(s ...interface{}) (string, []string)

type Classification

type Classification string
const (
	ClassificationPublic       Classification = "PUBLIC"
	ClassificationPrivate      Classification = "PRIVATE"
	ClassificationConfidential Classification = "CONFIDENTIAL"
)

type Component

type Component interface {
	UnknownPropertiesIANAProperties() []IANAProperty
	SubComponents() []Component
	// contains filtered or unexported methods
}

func GeneralParseComponent

func GeneralParseComponent(cs *CalendarStream, startLine *BaseProperty) (Component, error)

type ComponentBase

type ComponentBase struct {
	Properties []IANAProperty
	Components []Component
}

func NewComponent added in v0.2.4

func NewComponent(uniqueId string) ComponentBase

func ParseComponent

func ParseComponent(cs *CalendarStream, startLine *BaseProperty) (ComponentBase, error)

func (*ComponentBase) AddAttachment added in v0.2.4

func (cb *ComponentBase) AddAttachment(s string, props ...PropertyParameter)

func (*ComponentBase) AddAttachmentBinary added in v0.2.4

func (cb *ComponentBase) AddAttachmentBinary(binary []byte, contentType string)

func (*ComponentBase) AddAttachmentURL added in v0.2.4

func (cb *ComponentBase) AddAttachmentURL(uri string, contentType string)

func (*ComponentBase) AddAttendee added in v0.2.4

func (cb *ComponentBase) AddAttendee(s string, props ...PropertyParameter)

func (*ComponentBase) AddCategory added in v0.2.4

func (cb *ComponentBase) AddCategory(s string, props ...PropertyParameter)

func (*ComponentBase) AddComment added in v0.2.4

func (cb *ComponentBase) AddComment(s string, props ...PropertyParameter)

func (*ComponentBase) AddExdate added in v0.2.4

func (cb *ComponentBase) AddExdate(s string, props ...PropertyParameter)

func (*ComponentBase) AddExrule added in v0.2.4

func (cb *ComponentBase) AddExrule(s string, props ...PropertyParameter)

func (*ComponentBase) AddProperty

func (cb *ComponentBase) AddProperty(property ComponentProperty, value string, props ...PropertyParameter)

func (*ComponentBase) AddRdate added in v0.2.4

func (cb *ComponentBase) AddRdate(s string, props ...PropertyParameter)

func (*ComponentBase) AddRrule added in v0.2.4

func (cb *ComponentBase) AddRrule(s string, props ...PropertyParameter)

func (*ComponentBase) Attendees added in v0.2.4

func (cb *ComponentBase) Attendees() (r []*Attendee)

func (*ComponentBase) GetAllDayStartAt added in v0.2.4

func (cb *ComponentBase) GetAllDayStartAt() (time.Time, error)

func (*ComponentBase) GetDtStampTime added in v0.2.4

func (cb *ComponentBase) GetDtStampTime() (time.Time, error)

func (*ComponentBase) GetLastModifiedAt added in v0.2.4

func (cb *ComponentBase) GetLastModifiedAt() (time.Time, error)

func (*ComponentBase) GetProperty

func (cb *ComponentBase) GetProperty(componentProperty ComponentProperty) *IANAProperty

func (*ComponentBase) GetStartAt added in v0.2.4

func (cb *ComponentBase) GetStartAt() (time.Time, error)

func (*ComponentBase) Id added in v0.2.4

func (cb *ComponentBase) Id() string

func (*ComponentBase) SetAllDayEndAt added in v0.2.4

func (cb *ComponentBase) SetAllDayEndAt(t time.Time, props ...PropertyParameter)

func (*ComponentBase) SetAllDayStartAt added in v0.2.4

func (cb *ComponentBase) SetAllDayStartAt(t time.Time, props ...PropertyParameter)

func (*ComponentBase) SetClass added in v0.2.4

func (cb *ComponentBase) SetClass(c Classification, props ...PropertyParameter)

func (*ComponentBase) SetColor added in v0.2.4

func (cb *ComponentBase) SetColor(s string, props ...PropertyParameter)

func (*ComponentBase) SetCreatedTime added in v0.2.4

func (cb *ComponentBase) SetCreatedTime(t time.Time, props ...PropertyParameter)

func (*ComponentBase) SetDescription added in v0.2.4

func (cb *ComponentBase) SetDescription(s string, props ...PropertyParameter)

func (*ComponentBase) SetDtStampTime added in v0.2.4

func (cb *ComponentBase) SetDtStampTime(t time.Time, props ...PropertyParameter)

func (*ComponentBase) SetLocation added in v0.2.4

func (cb *ComponentBase) SetLocation(s string, props ...PropertyParameter)

func (*ComponentBase) SetModifiedAt added in v0.2.4

func (cb *ComponentBase) SetModifiedAt(t time.Time, props ...PropertyParameter)

func (*ComponentBase) SetOrganizer added in v0.2.4

func (cb *ComponentBase) SetOrganizer(s string, props ...PropertyParameter)

func (*ComponentBase) SetProperty

func (cb *ComponentBase) SetProperty(property ComponentProperty, value string, props ...PropertyParameter)

func (*ComponentBase) SetSequence added in v0.2.4

func (cb *ComponentBase) SetSequence(seq int, props ...PropertyParameter)

func (*ComponentBase) SetStartAt added in v0.2.4

func (cb *ComponentBase) SetStartAt(t time.Time, props ...PropertyParameter)

func (*ComponentBase) SetStatus added in v0.2.4

func (cb *ComponentBase) SetStatus(s ObjectStatus, props ...PropertyParameter)

func (*ComponentBase) SetSummary added in v0.2.4

func (cb *ComponentBase) SetSummary(s string, props ...PropertyParameter)

func (*ComponentBase) SetURL added in v0.2.4

func (cb *ComponentBase) SetURL(s string, props ...PropertyParameter)

func (*ComponentBase) SubComponents

func (cb *ComponentBase) SubComponents() []Component

func (*ComponentBase) UnknownPropertiesIANAProperties

func (cb *ComponentBase) UnknownPropertiesIANAProperties() []IANAProperty

type ComponentProperty

type ComponentProperty Property

type ComponentType

type ComponentType string
const (
	ComponentVCalendar ComponentType = "VCALENDAR"
	ComponentVEvent    ComponentType = "VEVENT"
	ComponentVTodo     ComponentType = "VTODO"
	ComponentVJournal  ComponentType = "VJOURNAL"
	ComponentVFreeBusy ComponentType = "VFREEBUSY"
	ComponentVTimezone ComponentType = "VTIMEZONE"
	ComponentVAlarm    ComponentType = "VALARM"
	ComponentStandard  ComponentType = "STANDARD"
	ComponentDaylight  ComponentType = "DAYLIGHT"
)

type ContentLine

type ContentLine string

type Daylight

type Daylight struct {
	ComponentBase
}

func ParseDaylight

func ParseDaylight(cs *CalendarStream, startLine *BaseProperty) *Daylight

func (*Daylight) Serialize

func (c *Daylight) Serialize() string

type FreeBusyTimeType

type FreeBusyTimeType string
const (
	FreeBusyTimeTypeFree            FreeBusyTimeType = "FREE"
	FreeBusyTimeTypeBusy            FreeBusyTimeType = "BUSY"
	FreeBusyTimeTypeBusyUnavailable FreeBusyTimeType = "BUSY-UNAVAILABLE"
	FreeBusyTimeTypeBusyTentative   FreeBusyTimeType = "BUSY-TENTATIVE"
)

type GeneralComponent

type GeneralComponent struct {
	ComponentBase
	Token string
}

func ParseGeneralComponent

func ParseGeneralComponent(cs *CalendarStream, startLine *BaseProperty) *GeneralComponent

func (*GeneralComponent) Serialize

func (c *GeneralComponent) Serialize() string

type IANAProperty

type IANAProperty struct {
	BaseProperty
}

type KeyValues

type KeyValues struct {
	Key   string
	Value []string
}

func (*KeyValues) KeyValue

func (kv *KeyValues) KeyValue(s ...interface{}) (string, []string)

type Method

type Method string
const (
	MethodPublish        Method = "PUBLISH"
	MethodRequest        Method = "REQUEST"
	MethodReply          Method = "REPLY"
	MethodAdd            Method = "ADD"
	MethodCancel         Method = "CANCEL"
	MethodRefresh        Method = "REFRESH"
	MethodCounter        Method = "COUNTER"
	MethodDeclinecounter Method = "DECLINECOUNTER"
)

type ObjectStatus

type ObjectStatus string
const (
	ObjectStatusTentative   ObjectStatus = "TENTATIVE"
	ObjectStatusConfirmed   ObjectStatus = "CONFIRMED"
	ObjectStatusCancelled   ObjectStatus = "CANCELLED"
	ObjectStatusNeedsAction ObjectStatus = "NEEDS-ACTION"
	ObjectStatusCompleted   ObjectStatus = "COMPLETED"
	ObjectStatusInProcess   ObjectStatus = "IN-PROCESS"
	ObjectStatusDraft       ObjectStatus = "DRAFT"
	ObjectStatusFinal       ObjectStatus = "FINAL"
)

func (ObjectStatus) KeyValue

func (ps ObjectStatus) KeyValue(s ...interface{}) (string, []string)

type Parameter

type Parameter string
const (
	ParameterAltrep              Parameter = "ALTREP"
	ParameterCn                  Parameter = "CN"
	ParameterCutype              Parameter = "CUTYPE"
	ParameterDelegatedFrom       Parameter = "DELEGATED-FROM"
	ParameterDelegatedTo         Parameter = "DELEGATED-TO"
	ParameterDir                 Parameter = "DIR"
	ParameterEncoding            Parameter = "ENCODING"
	ParameterFmttype             Parameter = "FMTTYPE"
	ParameterFbtype              Parameter = "FBTYPE"
	ParameterLanguage            Parameter = "LANGUAGE"
	ParameterMember              Parameter = "MEMBER"
	ParameterParticipationStatus Parameter = "PARTSTAT"
	ParameterRange               Parameter = "RANGE"
	ParameterRelated             Parameter = "RELATED"
	ParameterReltype             Parameter = "RELTYPE"
	ParameterRole                Parameter = "ROLE"
	ParameterRsvp                Parameter = "RSVP"
	ParameterSentBy              Parameter = "SENT-BY"
	ParameterTzid                Parameter = "TZID"
	ParameterValue               Parameter = "VALUE"
)

type ParticipationRole

type ParticipationRole string
const (
	ParticipationRoleChair          ParticipationRole = "CHAIR"
	ParticipationRoleReqParticipant ParticipationRole = "REQ-PARTICIPANT"
	ParticipationRoleOptParticipant ParticipationRole = "OPT-PARTICIPANT"
	ParticipationRoleNonParticipant ParticipationRole = "NON-PARTICIPANT"
)

func (ParticipationRole) KeyValue

func (pr ParticipationRole) KeyValue(s ...interface{}) (string, []string)

type ParticipationStatus

type ParticipationStatus string
const (
	ParticipationStatusNeedsAction ParticipationStatus = "NEEDS-ACTION"
	ParticipationStatusAccepted    ParticipationStatus = "ACCEPTED"
	ParticipationStatusDeclined    ParticipationStatus = "DECLINED"
	ParticipationStatusTentative   ParticipationStatus = "TENTATIVE"
	ParticipationStatusDelegated   ParticipationStatus = "DELEGATED"
	ParticipationStatusCompleted   ParticipationStatus = "COMPLETED"
	ParticipationStatusInProcess   ParticipationStatus = "IN-PROCESS"
)

func (ParticipationStatus) KeyValue

func (ps ParticipationStatus) KeyValue(s ...interface{}) (string, []string)

type Property

type Property string
const (
	PropertyCalscale        Property = "CALSCALE" // TEXT
	PropertyMethod          Property = "METHOD"   // TEXT
	PropertyProductId       Property = "PRODID"   // TEXT
	PropertyVersion         Property = "VERSION"  // TEXT
	PropertyXPublishedTTL   Property = "X-PUBLISHED-TTL"
	PropertyRefreshInterval Property = "REFRESH-INTERVAL;VALUE=DURATION"
	PropertyAttach          Property = "ATTACH"
	PropertyCategories      Property = "CATEGORIES"  // TEXT
	PropertyClass           Property = "CLASS"       // TEXT
	PropertyColor           Property = "COLOR"       // TEXT
	PropertyComment         Property = "COMMENT"     // TEXT
	PropertyDescription     Property = "DESCRIPTION" // TEXT
	PropertyXWRCalDesc      Property = "X-WR-CALDESC"
	PropertyGeo             Property = "GEO"
	PropertyLocation        Property = "LOCATION" // TEXT
	PropertyPercentComplete Property = "PERCENT-COMPLETE"
	PropertyPriority        Property = "PRIORITY"
	PropertyResources       Property = "RESOURCES" // TEXT
	PropertyStatus          Property = "STATUS"    // TEXT
	PropertySummary         Property = "SUMMARY"   // TEXT
	PropertyCompleted       Property = "COMPLETED"
	PropertyDtend           Property = "DTEND"
	PropertyDue             Property = "DUE"
	PropertyDtstart         Property = "DTSTART"
	PropertyDuration        Property = "DURATION"
	PropertyFreebusy        Property = "FREEBUSY"
	PropertyTransp          Property = "TRANSP" // TEXT
	PropertyTzid            Property = "TZID"   // TEXT
	PropertyTzname          Property = "TZNAME" // TEXT
	PropertyTzoffsetfrom    Property = "TZOFFSETFROM"
	PropertyTzoffsetto      Property = "TZOFFSETTO"
	PropertyTzurl           Property = "TZURL"
	PropertyAttendee        Property = "ATTENDEE"
	PropertyContact         Property = "CONTACT" // TEXT
	PropertyOrganizer       Property = "ORGANIZER"
	PropertyRecurrenceId    Property = "RECURRENCE-ID"
	PropertyRelatedTo       Property = "RELATED-TO" // TEXT
	PropertyUrl             Property = "URL"
	PropertyUid             Property = "UID" // TEXT
	PropertyExdate          Property = "EXDATE"
	PropertyExrule          Property = "EXRULE"
	PropertyRdate           Property = "RDATE"
	PropertyRrule           Property = "RRULE"
	PropertyAction          Property = "ACTION" // TEXT
	PropertyRepeat          Property = "REPEAT"
	PropertyTrigger         Property = "TRIGGER"
	PropertyCreated         Property = "CREATED"
	PropertyDtstamp         Property = "DTSTAMP"
	PropertyLastModified    Property = "LAST-MODIFIED"
	PropertyRequestStatus   Property = "REQUEST-STATUS" // TEXT
	PropertyName            Property = "NAME"
	PropertyXWRCalName      Property = "X-WR-CALNAME"
	PropertyXWRTimezone     Property = "X-WR-TIMEZONE"
	PropertySequence        Property = "SEQUENCE"
	PropertyXWRCalID        Property = "X-WR-RELCALID"
	PropertyTimezoneId      Property = "TIMEZONE-ID"
)

type PropertyParameter

type PropertyParameter interface {
	KeyValue(s ...interface{}) (string, []string)
}

func WithCN

func WithCN(cn string) PropertyParameter

func WithEncoding

func WithEncoding(encType string) PropertyParameter

func WithFmtType

func WithFmtType(contentType string) PropertyParameter

func WithRSVP

func WithRSVP(b bool) PropertyParameter

func WithValue

func WithValue(kind string) PropertyParameter

type RelationshipType

type RelationshipType string
const (
	RelationshipTypeChild   RelationshipType = "CHILD"
	RelationshipTypeParent  RelationshipType = "PARENT"
	RelationshipTypeSibling RelationshipType = "SIBLING"
)

type Standard

type Standard struct {
	ComponentBase
}

func ParseStandard

func ParseStandard(cs *CalendarStream, startLine *BaseProperty) *Standard

func (*Standard) Serialize

func (c *Standard) Serialize() string

type TimeTransparency

type TimeTransparency string
const (
	TransparencyOpaque      TimeTransparency = "OPAQUE" // default
	TransparencyTransparent TimeTransparency = "TRANSPARENT"
)

type VAlarm

type VAlarm struct {
	ComponentBase
}

func NewAlarm added in v0.2.4

func NewAlarm(tzId string) *VAlarm

func ParseVAlarm

func ParseVAlarm(cs *CalendarStream, startLine *BaseProperty) *VAlarm

func (*VAlarm) Serialize

func (c *VAlarm) Serialize() string

func (*VAlarm) SetAction

func (alarm *VAlarm) SetAction(a Action, props ...PropertyParameter)

func (*VAlarm) SetTrigger

func (alarm *VAlarm) SetTrigger(s string, props ...PropertyParameter)

type VBusy

type VBusy struct {
	ComponentBase
}

func NewBusy added in v0.2.4

func NewBusy(uniqueId string) *VBusy

func ParseVBusy

func ParseVBusy(cs *CalendarStream, startLine *BaseProperty) *VBusy

func (*VBusy) Serialize

func (c *VBusy) Serialize() string

type VEvent

type VEvent struct {
	ComponentBase
}

func NewEvent

func NewEvent(uniqueId string) *VEvent

func ParseVEvent

func ParseVEvent(cs *CalendarStream, startLine *BaseProperty) *VEvent

func (*VEvent) AddAlarm

func (event *VEvent) AddAlarm() *VAlarm

func (*VEvent) AddVAlarm added in v0.2.4

func (event *VEvent) AddVAlarm(a *VAlarm)

func (*VEvent) Alarms

func (event *VEvent) Alarms() (r []*VAlarm)

func (*VEvent) GetAllDayEndAt

func (event *VEvent) GetAllDayEndAt() (time.Time, error)

func (*VEvent) GetEndAt

func (event *VEvent) GetEndAt() (time.Time, error)

func (*VEvent) Serialize

func (c *VEvent) Serialize() string

func (*VEvent) SetDuration

func (event *VEvent) SetDuration(d time.Duration) error

SetDuration updates the duration of an event. This function will set either the end or start time of an event depending what is already given. The duration defines the length of a event relative to start or end time.

Notice: It will not set the DURATION key of the ics - only DTSTART and DTEND will be affected.

func (*VEvent) SetEndAt

func (event *VEvent) SetEndAt(t time.Time, props ...PropertyParameter)

func (*VEvent) SetGeo

func (event *VEvent) SetGeo(lat interface{}, lng interface{}, props ...PropertyParameter)

func (*VEvent) SetLastModifiedAt added in v0.2.3

func (event *VEvent) SetLastModifiedAt(t time.Time, props ...PropertyParameter)

func (*VEvent) SetPriority added in v0.2.4

func (event *VEvent) SetPriority(p int, props ...PropertyParameter)

func (*VEvent) SetResources added in v0.2.4

func (event *VEvent) SetResources(r string, props ...PropertyParameter)

func (*VEvent) SetTimeTransparency

func (event *VEvent) SetTimeTransparency(v TimeTransparency, props ...PropertyParameter)

type VJournal

type VJournal struct {
	ComponentBase
}

func NewJournal added in v0.2.4

func NewJournal(uniqueId string) *VJournal

func ParseVJournal

func ParseVJournal(cs *CalendarStream, startLine *BaseProperty) *VJournal

func (*VJournal) Serialize

func (c *VJournal) Serialize() string

type VTimezone

type VTimezone struct {
	ComponentBase
}

func NewTimezone added in v0.2.4

func NewTimezone(tzId string) *VTimezone

func ParseVTimezone

func ParseVTimezone(cs *CalendarStream, startLine *BaseProperty) *VTimezone

func (*VTimezone) Serialize

func (c *VTimezone) Serialize() string

type VTodo

type VTodo struct {
	ComponentBase
}

func NewTodo added in v0.2.4

func NewTodo(uniqueId string) *VTodo

func ParseVTodo

func ParseVTodo(cs *CalendarStream, startLine *BaseProperty) *VTodo

func (*VTodo) AddAlarm added in v0.2.4

func (todo *VTodo) AddAlarm() *VAlarm

func (*VTodo) AddVAlarm added in v0.2.4

func (todo *VTodo) AddVAlarm(a *VAlarm)

func (*VTodo) Alarms added in v0.2.4

func (todo *VTodo) Alarms() (r []*VAlarm)

func (*VTodo) GetAllDayDueAt added in v0.2.4

func (todo *VTodo) GetAllDayDueAt() (time.Time, error)

func (*VTodo) GetDueAt added in v0.2.4

func (todo *VTodo) GetDueAt() (time.Time, error)

func (*VTodo) Serialize

func (todo *VTodo) Serialize() string

func (*VTodo) SetAllDayCompletedAt added in v0.2.4

func (todo *VTodo) SetAllDayCompletedAt(t time.Time, props ...PropertyParameter)

func (*VTodo) SetAllDayDueAt added in v0.2.4

func (todo *VTodo) SetAllDayDueAt(t time.Time, props ...PropertyParameter)

func (*VTodo) SetCompletedAt added in v0.2.4

func (todo *VTodo) SetCompletedAt(t time.Time, props ...PropertyParameter)

func (*VTodo) SetDueAt added in v0.2.4

func (todo *VTodo) SetDueAt(t time.Time, props ...PropertyParameter)

func (*VTodo) SetDuration added in v0.2.4

func (todo *VTodo) SetDuration(d time.Duration) error

SetDuration updates the duration of an event. This function will set either the end or start time of an event depending what is already given. The duration defines the length of a event relative to start or end time.

Notice: It will not set the DURATION key of the ics - only DTSTART and DTEND will be affected.

func (*VTodo) SetGeo added in v0.2.4

func (todo *VTodo) SetGeo(lat interface{}, lng interface{}, props ...PropertyParameter)

func (*VTodo) SetPercentComplete added in v0.2.4

func (todo *VTodo) SetPercentComplete(p int, props ...PropertyParameter)

func (*VTodo) SetPriority added in v0.2.4

func (todo *VTodo) SetPriority(p int, props ...PropertyParameter)

func (*VTodo) SetResources added in v0.2.4

func (todo *VTodo) SetResources(r string, props ...PropertyParameter)

type ValueDataType

type ValueDataType string
const (
	ValueDataTypeBinary     ValueDataType = "BINARY"
	ValueDataTypeBoolean    ValueDataType = "BOOLEAN"
	ValueDataTypeCalAddress ValueDataType = "CAL-ADDRESS"
	ValueDataTypeDate       ValueDataType = "DATE"
	ValueDataTypeDateTime   ValueDataType = "DATE-TIME"
	ValueDataTypeDuration   ValueDataType = "DURATION"
	ValueDataTypeFloat      ValueDataType = "FLOAT"
	ValueDataTypeInteger    ValueDataType = "INTEGER"
	ValueDataTypePeriod     ValueDataType = "PERIOD"
	ValueDataTypeRecur      ValueDataType = "RECUR"
	ValueDataTypeText       ValueDataType = "TEXT"
	ValueDataTypeTime       ValueDataType = "TIME"
	ValueDataTypeUri        ValueDataType = "URI"
	ValueDataTypeUtcOffset  ValueDataType = "UTC-OFFSET"
)

Jump to

Keyboard shortcuts

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