Documentation
¶
Index ¶
- Constants
- Variables
- func AcceptUnknownPropertyHandler(cal *Calendar, state string, cl *BaseProperty) error
- func DefaultUnknownCalendarPropertyHandler(cal *Calendar, state string, cl *BaseProperty) error
- func FromText(s string) string
- func IANAToWindowsTimezone(loc *time.Location) (string, bool)
- func NewMalformedError(line, character int, err error) error
- func SetGeo[T GeoType](c SetPropertyOwner, lat T, lng T, params ...PropertyParameter)
- func ToText(s string) string
- func WindowsTimezoneToIANA(tzid string) *time.Location
- func WithCustomClient(client *http.Client) *http.Client
- func WithCustomRequest(request *http.Request) *http.Request
- type Action
- type Attendee
- type BaseProperty
- type Calendar
- func NewCalendar() *Calendar
- func NewCalendarFor(service string) *Calendar
- func NewCalendarWithOptions(options ...any) (*Calendar, error)
- func ParseCalendar(r io.Reader) (*Calendar, error)
- func ParseCalendarFromUrl(url string, opts ...any) (*Calendar, error)
- func ParseCalendarWithOptions(r io.Reader, options ...any) (*Calendar, error)
- func (cal *Calendar) AddBusy(id string) *VBusy
- func (calendar *Calendar) AddEvent(id string) *VEvent
- func (cal *Calendar) AddJournal(id string) *VJournal
- func (cal *Calendar) AddTimezone(id string) *VTimezone
- func (cal *Calendar) AddTodo(id string) *VTodo
- func (cal *Calendar) AddVAlarm(e *VAlarm)
- func (cal *Calendar) AddVBusy(e *VBusy)
- func (calendar *Calendar) AddVEvent(e *VEvent)
- func (cal *Calendar) AddVJournal(e *VJournal)
- func (cal *Calendar) AddVTimezone(e *VTimezone)
- func (cal *Calendar) AddVTodo(e *VTodo)
- func (cal *Calendar) Alarms() []*VAlarm
- func (cal *Calendar) Busys() []*VBusy
- func (calendar *Calendar) Events() (r []*VEvent)
- func (cal *Calendar) Journals() []*VJournal
- func (calendar *Calendar) RemoveEvent(id string)
- func (cal *Calendar) Serialize(ops ...any) string
- func (cal *Calendar) SerializeTo(w io.Writer, ops ...any) error
- func (cal *Calendar) SetCalscale(s string, params ...PropertyParameter)
- func (cal *Calendar) SetColor(s string, params ...PropertyParameter)
- func (cal *Calendar) SetDescription(s string, params ...PropertyParameter)
- func (cal *Calendar) SetLastModified(t time.Time, params ...PropertyParameter)
- func (cal *Calendar) SetMethod(method Method, params ...PropertyParameter)
- func (cal *Calendar) SetName(s string, params ...PropertyParameter)
- func (cal *Calendar) SetProductId(s string, params ...PropertyParameter)
- func (cal *Calendar) SetRefreshInterval(s string, params ...PropertyParameter)
- func (cal *Calendar) SetTimezoneId(s string, params ...PropertyParameter)
- func (cal *Calendar) SetTzid(s string, params ...PropertyParameter)
- func (cal *Calendar) SetUrl(s string, params ...PropertyParameter)
- func (cal *Calendar) SetVersion(s string, params ...PropertyParameter)
- func (cal *Calendar) SetXPublishedTTL(s string, params ...PropertyParameter)
- func (cal *Calendar) SetXWRCalDesc(s string, params ...PropertyParameter)
- func (cal *Calendar) SetXWRCalID(s string, params ...PropertyParameter)
- func (cal *Calendar) SetXWRCalName(s string, params ...PropertyParameter)
- func (cal *Calendar) SetXWRTimezone(s string, params ...PropertyParameter)
- func (cal *Calendar) Timezones() []*VTimezone
- func (cal *Calendar) Todos() []*VTodo
- type CalendarOption
- type CalendarProperty
- type CalendarStream
- type CalendarUserType
- type Classification
- type Component
- type ComponentBase
- func (cb *ComponentBase) AddAttachment(s string, params ...PropertyParameter)
- func (cb *ComponentBase) AddAttachmentBinary(binary []byte, contentType string)
- func (cb *ComponentBase) AddAttachmentURL(uri string, contentType string)
- func (cb *ComponentBase) AddAttendee(s string, params ...PropertyParameter)
- func (cb *ComponentBase) AddCategory(s string, params ...PropertyParameter)
- func (cb *ComponentBase) AddComment(s string, params ...PropertyParameter)
- func (cb *ComponentBase) AddExdate(s string, params ...PropertyParameter)
- func (cb *ComponentBase) AddExrule(s string, params ...PropertyParameter)
- func (cb *ComponentBase) AddProperty(property ComponentProperty, value string, params ...PropertyParameter)
- func (cb *ComponentBase) AddRdate(s string, params ...PropertyParameter)
- func (cb *ComponentBase) AddRrule(s string, params ...PropertyParameter)
- func (cb *ComponentBase) Attendees() []*Attendee
- func (cb *ComponentBase) GetAllDayStartAt() (time.Time, error)
- func (cb *ComponentBase) GetDtStampTime() (time.Time, error)
- func (cb *ComponentBase) GetEndAt() (time.Time, error)
- func (cb *ComponentBase) GetExDates() ([]time.Time, error)
- func (cb *ComponentBase) GetExRules() ([]*RecurrenceRule, error)
- func (cb *ComponentBase) GetLastModifiedAt() (time.Time, error)
- func (cb *ComponentBase) GetProperties(componentProperty ComponentProperty) []*IANAProperty
- func (cb *ComponentBase) GetProperty(componentProperty ComponentProperty) *IANAProperty
- func (cb *ComponentBase) GetRDates() ([]time.Time, error)
- func (cb *ComponentBase) GetRRules() ([]*RecurrenceRule, error)
- func (cb *ComponentBase) GetRecurrenceID() (time.Time, error)
- func (cb *ComponentBase) GetStartAt() (time.Time, error)
- func (cb *ComponentBase) HasProperty(componentProperty ComponentProperty) bool
- func (cb *ComponentBase) Id() string
- func (cb *ComponentBase) RemoveProperty(removeProp ComponentProperty) []IANAProperty
- func (cb *ComponentBase) RemovePropertyByFunc(removeProp ComponentProperty, remove func(p IANAProperty) bool) []IANAProperty
- func (cb *ComponentBase) RemovePropertyByValue(removeProp ComponentProperty, value string) []IANAProperty
- func (cb *ComponentBase) ReplaceProperty(property ComponentProperty, value string, params ...PropertyParameter) []IANAProperty
- func (cb *ComponentBase) SetAllDayEndAt(t time.Time, params ...PropertyParameter)
- func (cb *ComponentBase) SetAllDayStartAt(t time.Time, params ...PropertyParameter)
- func (cb *ComponentBase) SetClass(c Classification, params ...PropertyParameter)
- func (cb *ComponentBase) SetColor(s string, params ...PropertyParameter)
- func (cb *ComponentBase) SetCreatedTime(t time.Time, params ...PropertyParameter)
- func (cb *ComponentBase) SetDescription(s string, params ...PropertyParameter)
- func (cb *ComponentBase) SetDtStampTime(t time.Time, params ...PropertyParameter)
- func (cb *ComponentBase) SetDuration(d time.Duration) error
- func (cb *ComponentBase) SetEndAt(t time.Time, params ...PropertyParameter)
- func (cb *ComponentBase) SetLocation(s string, params ...PropertyParameter)
- func (cb *ComponentBase) SetModifiedAt(t time.Time, params ...PropertyParameter)
- func (cb *ComponentBase) SetOrganizer(s string, params ...PropertyParameter)
- func (cb *ComponentBase) SetProperty(property ComponentProperty, value string, params ...PropertyParameter)
- func (cb *ComponentBase) SetSequence(seq int, params ...PropertyParameter)
- func (cb *ComponentBase) SetStartAt(t time.Time, params ...PropertyParameter)
- func (cb *ComponentBase) SetStatus(s ObjectStatus, params ...PropertyParameter)
- func (cb *ComponentBase) SetSummary(s string, params ...PropertyParameter)
- func (cb *ComponentBase) SetURL(s string, params ...PropertyParameter)
- func (cb *ComponentBase) SubComponents() []Component
- func (cb *ComponentBase) UnknownPropertiesIANAProperties() []IANAProperty
- type ComponentProperty
- type ComponentType
- type ContentLine
- type Daylight
- type FreeBusyTimeType
- type Frequency
- type GeneralComponent
- type GeoType
- type HttpClientLike
- type IANAProperty
- type KeyValues
- type MalformedError
- type Method
- type ObjectStatus
- type Parameter
- type ParseOption
- type ParticipationRole
- type ParticipationStatus
- type Property
- type PropertyParameter
- func WithAlternativeRepresentation(uri *url.URL) PropertyParameter
- func WithCN(cn string) PropertyParameter
- func WithEncoding(encType string) PropertyParameter
- func WithFmtType(contentType string) PropertyParameter
- func WithRSVP(b bool) PropertyParameter
- func WithTZID(tzid string) PropertyParameter
- func WithValue(kind string) PropertyParameter
- type PropertyParser
- type RecurrenceRule
- type RelationshipType
- type SerializationConfiguration
- type SerializationOption
- type SetPropertyOwner
- type Standard
- type TimeTransparency
- type TimezoneMapper
- type TimezoneSerializationMapper
- type VAlarm
- type VBusy
- type VEvent
- func (event *VEvent) AddAlarm() *VAlarm
- func (event *VEvent) AddVAlarm(a *VAlarm)
- func (event *VEvent) Alarms() []*VAlarm
- func (todo *VEvent) GetAllDayDueAt() (time.Time, error)
- func (event *VEvent) GetAllDayEndAt() (time.Time, error)
- func (event *VEvent) Serialize(serialConfig *SerializationConfiguration) string
- func (event *VEvent) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
- func (event *VEvent) SetEndAt(t time.Time, props ...PropertyParameter)
- func (event *VEvent) SetGeo(lat interface{}, lng interface{}, params ...PropertyParameter)
- func (event *VEvent) SetLastModifiedAt(t time.Time, props ...PropertyParameter)
- func (event *VEvent) SetPriority(p int, params ...PropertyParameter)
- func (event *VEvent) SetResources(r string, params ...PropertyParameter)
- func (event *VEvent) SetTimeTransparency(v TimeTransparency, params ...PropertyParameter)
- type VJournal
- type VTimezone
- type VTodo
- func (todo *VTodo) AddAlarm() *VAlarm
- func (todo *VTodo) AddVAlarm(a *VAlarm)
- func (todo *VTodo) Alarms() []*VAlarm
- func (todo *VTodo) GetDueAt() (time.Time, error)
- func (todo *VTodo) Serialize(serialConfig *SerializationConfiguration) string
- func (todo *VTodo) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
- func (todo *VTodo) SetAllDayCompletedAt(t time.Time, params ...PropertyParameter)
- func (todo *VTodo) SetAllDayDueAt(t time.Time, params ...PropertyParameter)
- func (todo *VTodo) SetCompletedAt(t time.Time, params ...PropertyParameter)
- func (todo *VTodo) SetDueAt(t time.Time, params ...PropertyParameter)
- func (todo *VTodo) SetDuration(d time.Duration) error
- func (todo *VTodo) SetGeo(lat interface{}, lng interface{}, params ...PropertyParameter)
- func (todo *VTodo) SetPercentComplete(p int, params ...PropertyParameter)
- func (todo *VTodo) SetPriority(p int, params ...PropertyParameter)
- func (todo *VTodo) SetResources(r string, params ...PropertyParameter)
- type ValueDataType
- type Weekday
- type WeekdayNum
- type WithLineLength
- type WithNewLine
Constants ¶
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) ComponentPropertyRelatedTo = ComponentProperty(PropertyRelatedTo) ComponentPropertyMethod = ComponentProperty(PropertyMethod) ComponentPropertyRecurrenceId = ComponentProperty(PropertyRecurrenceId) ComponentPropertyDuration = ComponentProperty(PropertyDuration) ComponentPropertyContact = ComponentProperty(PropertyContact) ComponentPropertyRequestStatus = ComponentProperty(PropertyRequestStatus) ComponentPropertyRDate = ComponentProperty(PropertyRdate) )
const (
NewLine = WithNewLineUnix
)
Variables ¶
var ( // ErrUnexpectedParamValueLength reports a truncated parameter value. ErrUnexpectedParamValueLength = errors.New("unexpected end of param value") // ErrExpectedVCalendar reports a VCALENDAR token appearing where another token was expected. ErrExpectedVCalendar = errors.New("expected a vcalendar") // ErrExpectedBegin reports a missing BEGIN token. ErrExpectedBegin = errors.New("expected begin") // ErrExpectedEnd reports a missing END token. ErrExpectedEnd = errors.New("expected a end") // ErrExpectedBeginOrEnd reports a token where either BEGIN or END was expected. ErrExpectedBeginOrEnd = errors.New("expected begin or end") // ErrUnexpectedCalendarEnd reports an END token that appears after the calendar has already ended. ErrUnexpectedCalendarEnd = errors.New("unexpected end") // ErrBadCalendarState reports an invalid parser state. ErrBadCalendarState = errors.New("bad state") // ErrVCalendarNotWhereExpected reports a nested VCALENDAR token. ErrVCalendarNotWhereExpected = errors.New("vcalendar not where expected") // ErrMissingPropertyParamOperator reports a property parameter missing its `=` separator. ErrMissingPropertyParamOperator = errors.New("missing property param operator") // ErrUnexpectedEndOfProperty reports a property line that ends before the value is complete. ErrUnexpectedEndOfProperty = errors.New("unexpected end of property") // ErrStartOrEndNotYetDefined reports a missing start or end time. ErrStartOrEndNotYetDefined = errors.New("start or end not yet defined") // ErrPropertyNotFound reports that a requested property was not set. ErrPropertyNotFound = errors.New("property not found") // ErrExpectedOneTZID reports an invalid number of TZID parameters. ErrExpectedOneTZID = errors.New("expected one TZID") // ErrTimeValueNotMatched reports a timestamp that does not match the parser's supported formats. ErrTimeValueNotMatched = errors.New("time value not matched") // ErrTimeValueMatchedButUnsupportedAllDayTimeStamp reports an all-day timestamp shape that is not supported. ErrTimeValueMatchedButUnsupportedAllDayTimeStamp = errors.New("time value matched but unsupported all-day timestamp") // ErrTimeValueMatchedButNotSupported reports a recognized timestamp shape that still cannot be parsed. ErrTimeValueMatchedButNotSupported = errors.New("time value matched but not supported") // ErrParsingComponentProperty reports a failure while parsing a component property. ErrParsingComponentProperty = errors.New("parsing component property") // ErrParsingComponentLine reports a failure while parsing a component line. ErrParsingComponentLine = errors.New("parsing component line") // ErrParsingLine reports a failure while parsing a calendar content line. ErrParsingLine = errors.New("parsing line") // ErrParsingCalendarLine reports a failure while parsing a calendar line. ErrParsingCalendarLine = errors.New("parsing calendar line") // ErrParsingProperty reports a failure while parsing a property. ErrParsingProperty = errors.New("parsing property") // ErrParse reports a generic parse failure. ErrParse = errors.New("parse error") // ErrMissingPropertyValue reports a property parameter missing its value. ErrMissingPropertyValue = errors.New("missing property value") // ErrUnexpectedASCIIChar reports a disallowed ASCII control character. ErrUnexpectedASCIIChar = errors.New("unexpected char ascii") // ErrUnexpectedDoubleQuoteInPropertyParamValue reports an invalid quote in a parameter value. ErrUnexpectedDoubleQuoteInPropertyParamValue = errors.New("unexpected double quote in property param value") // ErrUnbalancedEnd reports a closing token that does not match the current component. ErrUnbalancedEnd = errors.New("unbalanced end") // ErrOutOfLines reports that the parser ran out of content lines. ErrOutOfLines = errors.New("ran out of lines") // ErrComponentNestingTooDeep reports that nested components exceeded the maximum allowed depth. ErrComponentNestingTooDeep = errors.New("component nesting too deep") // ErrorPropertyNotFound reports that a requested property was not found. ErrorPropertyNotFound = errors.New("property not found") // ErrInvalidOpArg marks an invalid variadic option argument. ErrInvalidOpArg = errors.New("invalid option argument") // ErrNilStartLine reports that a parser was called without a starting line. ErrNilStartLine = errors.New("nil start line") // ErrPropertySkipped marks a parser decision to skip a malformed line and continue. ErrPropertySkipped = errors.New("property skipped") )
Functions ¶
func AcceptUnknownPropertyHandler ¶ added in v0.3.3
func AcceptUnknownPropertyHandler(cal *Calendar, state string, cl *BaseProperty) error
AcceptUnknownPropertyHandler allows properties between components (non-standard but occurs in real-world ICS files) These properties are added to the calendar properties list
func DefaultUnknownCalendarPropertyHandler ¶ added in v0.3.3
func DefaultUnknownCalendarPropertyHandler(cal *Calendar, state string, cl *BaseProperty) error
func IANAToWindowsTimezone ¶ added in v0.3.6
IANAToWindowsTimezone maps IANA timezone locations to their Windows equivalents.
func NewMalformedError ¶ added in v0.3.6
NewMalformedError wraps err with line and character context when err is non-nil.
func SetGeo ¶ added in v0.3.3
func SetGeo[T GeoType](c SetPropertyOwner, lat T, lng T, params ...PropertyParameter)
func WindowsTimezoneToIANA ¶ added in v0.3.6
WindowsTimezoneToIANA maps Windows timezone names to their IANA equivalents.
Types ¶
type Attendee ¶
type Attendee struct {
IANAProperty
}
func (*Attendee) ParticipationStatus ¶
func (p *Attendee) ParticipationStatus() ParticipationStatus
type BaseProperty ¶
func LooseParser ¶ added in v0.3.6
func LooseParser(rawLine ContentLine) (*BaseProperty, error)
LooseParser is an alternative to the default strict parser path used by ParseCalendar and ParseComponent. It preserves the property token and value when malformed parameters prevent a full parse.
func ParseProperty ¶
func ParseProperty(contentLine ContentLine) (*BaseProperty, error)
ParseProperty parses a single RFC5545 content line using strict parsing rules.
func SkipPropertyParser ¶ added in v0.3.6
func SkipPropertyParser(rawLine ContentLine) (*BaseProperty, error)
SkipPropertyParser is an alternative to the default strict parser path used by ParseCalendar and ParseComponent. It returns parsed properties when the line is valid and skips malformed lines.
func (*BaseProperty) GetValueType ¶ added in v0.3.0
func (bp *BaseProperty) GetValueType() ValueDataType
func (*BaseProperty) SerializeTo ¶ added in v0.3.4
func (bp *BaseProperty) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
type Calendar ¶
type Calendar struct {
Components []Component
CalendarProperties []CalendarProperty
// contains filtered or unexported fields
}
func NewCalendar ¶
func NewCalendar() *Calendar
func NewCalendarFor ¶
func NewCalendarWithOptions ¶ added in v0.3.6
NewCalendarWithOptions constructs a calendar with sane parser defaults and optional overrides.
func ParseCalendarFromUrl ¶ added in v0.3.2
func ParseCalendarWithOptions ¶ added in v0.3.3
func (*Calendar) AddJournal ¶ added in v0.2.4
func (*Calendar) AddTimezone ¶ added in v0.2.4
func (*Calendar) AddVJournal ¶ added in v0.2.4
func (*Calendar) AddVTimezone ¶ added in v0.2.4
func (*Calendar) RemoveEvent ¶ added in v0.2.1
func (*Calendar) Serialize ¶
Serialize converts the Calendar and all its nested components (such as events, timezones, and alarms) into a single, fully formatted iCalendar string.
It accepts optional configuration arguments (ops) to customize the output layout, such as setting custom line folding lengths or overriding line endings.
Note on Line Endings: By default, uses Unix-style line endings (LF). To strictly comply with the iCalendar specification (RFC 5545), which requires Windows-style line endings (CRLF) for broad compatibility with clients like Outlook and Apple Calendar, pass the explicit formatting option:
cal.Serialize(ics.WithNewLineWindows)
func (*Calendar) SetCalscale ¶
func (cal *Calendar) SetCalscale(s string, params ...PropertyParameter)
func (*Calendar) SetColor ¶
func (cal *Calendar) SetColor(s string, params ...PropertyParameter)
func (*Calendar) SetDescription ¶
func (cal *Calendar) SetDescription(s string, params ...PropertyParameter)
func (*Calendar) SetLastModified ¶
func (cal *Calendar) SetLastModified(t time.Time, params ...PropertyParameter)
func (*Calendar) SetMethod ¶
func (cal *Calendar) SetMethod(method Method, params ...PropertyParameter)
SetMethod sets the METHOD property for the calendar.
These should be used with caution when creating simple iCal (.ics) files. The iCalendar specification is defined in RFC 5545. It refers to RFC 5546, which defines the ADD method as allowing the Organizer to add one or more new instances to an existing VEVENT, VTODO, or VJOURNAL using a single iTIP message. The UID must be that of the existing event/task/journal.
If you include METHOD: ADD in your .ics file (or use SetMethod(MethodAdd)), it is required to refer to existing calendar components. If you are simply writing .ics files to import into calendaring tools, it is not likely that you will want to use this option. Notably, the Apple Calendar program will reject events in .ics files that have this set if they do not refer to existing calendar events; some other calendars (like Microsoft Outlook) have a more permissive import process and will accept them.
func (*Calendar) SetName ¶
func (cal *Calendar) SetName(s string, params ...PropertyParameter)
func (*Calendar) SetProductId ¶
func (cal *Calendar) SetProductId(s string, params ...PropertyParameter)
func (*Calendar) SetRefreshInterval ¶
func (cal *Calendar) SetRefreshInterval(s string, params ...PropertyParameter)
func (*Calendar) SetTimezoneId ¶
func (cal *Calendar) SetTimezoneId(s string, params ...PropertyParameter)
func (*Calendar) SetTzid ¶
func (cal *Calendar) SetTzid(s string, params ...PropertyParameter)
func (*Calendar) SetUrl ¶
func (cal *Calendar) SetUrl(s string, params ...PropertyParameter)
func (*Calendar) SetVersion ¶
func (cal *Calendar) SetVersion(s string, params ...PropertyParameter)
func (*Calendar) SetXPublishedTTL ¶
func (cal *Calendar) SetXPublishedTTL(s string, params ...PropertyParameter)
func (*Calendar) SetXWRCalDesc ¶
func (cal *Calendar) SetXWRCalDesc(s string, params ...PropertyParameter)
func (*Calendar) SetXWRCalID ¶
func (cal *Calendar) SetXWRCalID(s string, params ...PropertyParameter)
func (*Calendar) SetXWRCalName ¶
func (cal *Calendar) SetXWRCalName(s string, params ...PropertyParameter)
func (*Calendar) SetXWRTimezone ¶
func (cal *Calendar) SetXWRTimezone(s string, params ...PropertyParameter)
type CalendarOption ¶ added in v0.3.6
CalendarOption provides functional options for Calendar construction.
func WithProductId ¶ added in v0.3.6
func WithProductId(productID string, params ...PropertyParameter) CalendarOption
WithProductId sets the calendar product identifier.
func WithVersion ¶ added in v0.3.6
func WithVersion(version string, params ...PropertyParameter) CalendarOption
WithVersion sets the calendar version.
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, int, 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(_ ...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
SerializeTo(b io.Writer, serialConfig *SerializationConfiguration) error
}
Component To determine what this is please use a type switch or typecast to each of: - *VEvent - *VTodo - *VBusy - *VJournal
func GeneralParseComponent ¶
func GeneralParseComponent(cs *CalendarStream, startLine *BaseProperty) (Component, error)
func GeneralParseComponentWithOptions ¶ added in v0.3.6
func GeneralParseComponentWithOptions(cs *CalendarStream, startLine *BaseProperty, opts ...any) (Component, error)
type ComponentBase ¶
type ComponentBase struct {
Properties []IANAProperty
Components []Component
// contains filtered or unexported fields
}
func NewComponent ¶ added in v0.2.4
func NewComponent(uniqueId string) ComponentBase
func ParseComponent ¶
func ParseComponent(cs *CalendarStream, startLine *BaseProperty) (ComponentBase, error)
func ParseComponentWithOptions ¶ added in v0.3.6
func ParseComponentWithOptions(cs *CalendarStream, startLine *BaseProperty, opts ...any) (ComponentBase, error)
func (*ComponentBase) AddAttachment ¶ added in v0.2.4
func (cb *ComponentBase) AddAttachment(s string, params ...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, params ...PropertyParameter)
func (*ComponentBase) AddCategory ¶ added in v0.2.4
func (cb *ComponentBase) AddCategory(s string, params ...PropertyParameter)
func (*ComponentBase) AddComment ¶ added in v0.2.4
func (cb *ComponentBase) AddComment(s string, params ...PropertyParameter)
func (*ComponentBase) AddExdate ¶ added in v0.2.4
func (cb *ComponentBase) AddExdate(s string, params ...PropertyParameter)
func (*ComponentBase) AddExrule ¶ added in v0.2.4
func (cb *ComponentBase) AddExrule(s string, params ...PropertyParameter)
func (*ComponentBase) AddProperty ¶
func (cb *ComponentBase) AddProperty(property ComponentProperty, value string, params ...PropertyParameter)
AddProperty appends a property
func (*ComponentBase) AddRdate ¶ added in v0.2.4
func (cb *ComponentBase) AddRdate(s string, params ...PropertyParameter)
func (*ComponentBase) AddRrule ¶ added in v0.2.4
func (cb *ComponentBase) AddRrule(s string, params ...PropertyParameter)
func (*ComponentBase) Attendees ¶ added in v0.2.4
func (cb *ComponentBase) Attendees() []*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) GetEndAt ¶ added in v0.3.2
func (cb *ComponentBase) GetEndAt() (time.Time, error)
func (*ComponentBase) GetExDates ¶ added in v0.3.5
func (cb *ComponentBase) GetExDates() ([]time.Time, error)
GetExDates returns all EXDATE times, handling both comma-separated values within a single property and multiple EXDATE properties.
func (*ComponentBase) GetExRules ¶ added in v0.3.5
func (cb *ComponentBase) GetExRules() ([]*RecurrenceRule, error)
GetExRules returns all EXRULE properties parsed into RecurrenceRule structs.
func (*ComponentBase) GetLastModifiedAt ¶ added in v0.2.4
func (cb *ComponentBase) GetLastModifiedAt() (time.Time, error)
func (*ComponentBase) GetProperties ¶ added in v0.3.2
func (cb *ComponentBase) GetProperties(componentProperty ComponentProperty) []*IANAProperty
GetProperties returns all matches for the particular property you're after. Please consider using: ComponentProperty.Singular/ComponentProperty.Multiple to determine if GetProperty or GetProperties is more appropriate.
func (*ComponentBase) GetProperty ¶
func (cb *ComponentBase) GetProperty(componentProperty ComponentProperty) *IANAProperty
GetProperty returns the first match for the particular property you're after. Please consider using: ComponentProperty.Required to determine if GetProperty or GetProperties is more appropriate.
func (*ComponentBase) GetRDates ¶ added in v0.3.5
func (cb *ComponentBase) GetRDates() ([]time.Time, error)
GetRDates returns all RDATE times, handling both comma-separated values within a single property and multiple RDATE properties.
func (*ComponentBase) GetRRules ¶ added in v0.3.5
func (cb *ComponentBase) GetRRules() ([]*RecurrenceRule, error)
GetRRules returns all RRULE properties parsed into RecurrenceRule structs.
func (*ComponentBase) GetRecurrenceID ¶ added in v0.3.5
func (cb *ComponentBase) GetRecurrenceID() (time.Time, error)
GetRecurrenceID returns the RECURRENCE-ID property as a time.Time.
func (*ComponentBase) GetStartAt ¶ added in v0.2.4
func (cb *ComponentBase) GetStartAt() (time.Time, error)
func (*ComponentBase) HasProperty ¶ added in v0.3.2
func (cb *ComponentBase) HasProperty(componentProperty ComponentProperty) bool
HasProperty returns true if a component property is in the component.
func (*ComponentBase) Id ¶ added in v0.2.4
func (cb *ComponentBase) Id() string
func (*ComponentBase) RemoveProperty ¶ added in v0.3.2
func (cb *ComponentBase) RemoveProperty(removeProp ComponentProperty) []IANAProperty
RemoveProperty removes from the component all properties that is of a particular property type, returning an slice of removed entities
func (*ComponentBase) RemovePropertyByFunc ¶ added in v0.3.2
func (cb *ComponentBase) RemovePropertyByFunc(removeProp ComponentProperty, remove func(p IANAProperty) bool) []IANAProperty
RemovePropertyByFunc removes from the component all properties that has a particular property type and the function remove returns true for
func (*ComponentBase) RemovePropertyByValue ¶ added in v0.3.2
func (cb *ComponentBase) RemovePropertyByValue(removeProp ComponentProperty, value string) []IANAProperty
RemovePropertyByValue removes properties matching the given type and value. It returns a slice of the removed properties.
func (*ComponentBase) ReplaceProperty ¶ added in v0.3.2
func (cb *ComponentBase) ReplaceProperty(property ComponentProperty, value string, params ...PropertyParameter) []IANAProperty
ReplaceProperty replaces all matches of the particular property you're setting, otherwise adds it. Returns a slice of removed properties. Please consider using: ComponentProperty.Singular/ComponentProperty.Multiple to determine if AddProperty, SetProperty or ReplaceProperty is more appropriate.
func (*ComponentBase) SetAllDayEndAt ¶ added in v0.2.4
func (cb *ComponentBase) SetAllDayEndAt(t time.Time, params ...PropertyParameter)
func (*ComponentBase) SetAllDayStartAt ¶ added in v0.2.4
func (cb *ComponentBase) SetAllDayStartAt(t time.Time, params ...PropertyParameter)
func (*ComponentBase) SetClass ¶ added in v0.2.4
func (cb *ComponentBase) SetClass(c Classification, params ...PropertyParameter)
func (*ComponentBase) SetColor ¶ added in v0.2.4
func (cb *ComponentBase) SetColor(s string, params ...PropertyParameter)
func (*ComponentBase) SetCreatedTime ¶ added in v0.2.4
func (cb *ComponentBase) SetCreatedTime(t time.Time, params ...PropertyParameter)
func (*ComponentBase) SetDescription ¶ added in v0.2.4
func (cb *ComponentBase) SetDescription(s string, params ...PropertyParameter)
func (*ComponentBase) SetDtStampTime ¶ added in v0.2.4
func (cb *ComponentBase) SetDtStampTime(t time.Time, params ...PropertyParameter)
func (*ComponentBase) SetDuration ¶ added in v0.3.2
func (cb *ComponentBase) 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 (*ComponentBase) SetEndAt ¶ added in v0.3.2
func (cb *ComponentBase) SetEndAt(t time.Time, params ...PropertyParameter)
func (*ComponentBase) SetLocation ¶ added in v0.2.4
func (cb *ComponentBase) SetLocation(s string, params ...PropertyParameter)
func (*ComponentBase) SetModifiedAt ¶ added in v0.2.4
func (cb *ComponentBase) SetModifiedAt(t time.Time, params ...PropertyParameter)
func (*ComponentBase) SetOrganizer ¶ added in v0.2.4
func (cb *ComponentBase) SetOrganizer(s string, params ...PropertyParameter)
func (*ComponentBase) SetProperty ¶
func (cb *ComponentBase) SetProperty(property ComponentProperty, value string, params ...PropertyParameter)
SetProperty replaces the first match for the particular property you're setting, otherwise adds it. Please consider using: ComponentProperty.Singular/ComponentProperty.Multiple to determine if AddProperty, SetProperty or ReplaceProperty is more appropriate.
func (*ComponentBase) SetSequence ¶ added in v0.2.4
func (cb *ComponentBase) SetSequence(seq int, params ...PropertyParameter)
func (*ComponentBase) SetStartAt ¶ added in v0.2.4
func (cb *ComponentBase) SetStartAt(t time.Time, params ...PropertyParameter)
func (*ComponentBase) SetStatus ¶ added in v0.2.4
func (cb *ComponentBase) SetStatus(s ObjectStatus, params ...PropertyParameter)
func (*ComponentBase) SetSummary ¶ added in v0.2.4
func (cb *ComponentBase) SetSummary(s string, params ...PropertyParameter)
func (*ComponentBase) SetURL ¶ added in v0.2.4
func (cb *ComponentBase) SetURL(s string, params ...PropertyParameter)
func (*ComponentBase) SubComponents ¶
func (cb *ComponentBase) SubComponents() []Component
func (*ComponentBase) UnknownPropertiesIANAProperties ¶
func (cb *ComponentBase) UnknownPropertiesIANAProperties() []IANAProperty
type ComponentProperty ¶
type ComponentProperty Property
func ComponentPropertyExtended ¶ added in v0.3.2
func ComponentPropertyExtended(s string) ComponentProperty
func (ComponentProperty) Exclusive ¶ added in v0.3.2
func (cp ComponentProperty) Exclusive(c Component) []ComponentProperty
Exclusive returns the ComponentProperty's using the rules from the RFC as to if one or more existing properties are prohibiting this one If unspecified or incomplete, it returns false. -- This list is incomplete verify source. Happy to take PRs with reference iana-prop and x-props are not covered as it would always be true and require an exhaustive list.
func (ComponentProperty) Multiple ¶ added in v0.3.2
func (cp ComponentProperty) Multiple(c Component) bool
Multiple returns the rules from the RFC as to if the spec states explicitly if multiple are allowed iana-prop and x-props are not covered as it would always be true and require an exhaustive list.
func (ComponentProperty) Optional ¶ added in v0.3.2
func (cp ComponentProperty) Optional(c Component) bool
Optional returns the rules from the RFC as to if the spec states that if these are optional iana-prop and x-props are not covered as it would always be true and require an exhaustive list.
func (ComponentProperty) Required ¶ added in v0.3.2
func (cp ComponentProperty) Required(c Component) bool
Required returns the rules from the RFC as to if they are required or not for any particular component type If unspecified or incomplete, it returns false. -- This list is incomplete verify source. Happy to take PRs with reference iana-prop and x-props are not covered as it would always be true and require an exhaustive list.
func (ComponentProperty) Singular ¶ added in v0.3.2
func (cp ComponentProperty) Singular(c Component) bool
Singular returns the rules from the RFC as to if the spec states that if "Must not occur more than once" iana-prop and x-props are not covered as it would always be true and require an exhaustive list.
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 ParseDaylightWithError ¶ added in v0.3.2
func ParseDaylightWithError(cs *CalendarStream, startLine *BaseProperty) (*Daylight, error)
func (*Daylight) Serialize ¶
func (daylight *Daylight) Serialize(serialConfig *SerializationConfiguration) string
func (*Daylight) SerializeTo ¶ added in v0.3.2
func (daylight *Daylight) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
type FreeBusyTimeType ¶
type FreeBusyTimeType string
const ( FreeBusyTimeTypeFree FreeBusyTimeType = "FREE" FreeBusyTimeTypeBusy FreeBusyTimeType = "BUSY" FreeBusyTimeTypeBusyTentative FreeBusyTimeType = "BUSY-TENTATIVE" )
type GeneralComponent ¶
type GeneralComponent struct {
ComponentBase
Token string
}
func ParseGeneralComponent ¶
func ParseGeneralComponent(cs *CalendarStream, startLine *BaseProperty) *GeneralComponent
func ParseGeneralComponentWithError ¶ added in v0.3.2
func ParseGeneralComponentWithError(cs *CalendarStream, startLine *BaseProperty) (*GeneralComponent, error)
func (*GeneralComponent) Serialize ¶
func (general *GeneralComponent) Serialize(serialConfig *SerializationConfiguration) string
func (*GeneralComponent) SerializeTo ¶ added in v0.3.2
func (general *GeneralComponent) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
type HttpClientLike ¶ added in v0.3.2
type IANAProperty ¶
type IANAProperty struct {
BaseProperty
}
type MalformedError ¶ added in v0.3.6
MalformedError reports a parse failure with optional line and character context.
func (*MalformedError) Error ¶ added in v0.3.6
func (e *MalformedError) Error() string
func (*MalformedError) Unwrap ¶ added in v0.3.6
func (e *MalformedError) Unwrap() error
type Method ¶
type Method string
Method represents the iCalendar METHOD property.
These should be used with caution when creating simple iCal (.ics) files. The iCalendar specification is defined in RFC 5545. It refers to RFC 5546, which defines the ADD method as allowing the Organizer to add one or more new instances to an existing VEVENT, VTODO, or VJOURNAL using a single iTIP message. The UID must be that of the existing event/task/journal.
If you include METHOD: ADD in your .ics file (or use SetMethod(MethodAdd)), it is required to refer to existing calendar components. If you are simply writing .ics files to import into calendaring tools, it is not likely that you will want to use this option. Notably, the Apple Calendar program will reject events in .ics files that have this set if they do not refer to existing calendar events; some other calendars (like Microsoft Outlook) have a more permissive import process and will accept them.
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(_ ...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 ParseOption ¶ added in v0.3.3
ParseOption provides functional options for ParseCalendar
func WithPropertyParser ¶ added in v0.3.6
func WithPropertyParser(f PropertyParser) ParseOption
WithPropertyParser allows custom handling of property parse errors. It is a convenience wrapper; ParseCalendarWithOptions also accepts PropertyParser directly. When a content line fails to parse (e.g. due to malformed parameter names), the parser is called with the raw content line.
The parser can:
- Return (*BaseProperty, nil) to use a recovered/replacement property
- Return (nil, nil) to skip the property silently
- Return (nil, err) to abort parsing with the error
Without this option, any property parse error aborts the entire calendar parse. This is useful for real-world ICS feeds that contain non-RFC-compliant properties (e.g. parameter names with underscores).
func WithTimezoneMapper ¶ added in v0.3.6
func WithTimezoneMapper(mapper TimezoneMapper) ParseOption
WithTimezoneMapper configures how Windows timezone identifiers are mapped during parsing.
func WithUnknownPropertyHandler ¶ added in v0.3.3
func WithUnknownPropertyHandler(f func(*Calendar, string, *BaseProperty) error) ParseOption
WithUnknownPropertyHandler allows custom handling of unknown properties
func WithWindowsTimezoneMapping ¶ added in v0.3.6
func WithWindowsTimezoneMapping() ParseOption
WithWindowsTimezoneMapping enables mapping of Windows timezone names to IANA equivalents during calendar parsing.
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(_ ...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(_ ...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" PropertySource Property = "SOURCE" )
type PropertyParameter ¶
func WithAlternativeRepresentation ¶ added in v0.3.2
func WithAlternativeRepresentation(uri *url.URL) PropertyParameter
WithAlternativeRepresentation takes what must be a valid URI in quotation marks
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 WithTZID ¶ added in v0.3.2
func WithTZID(tzid string) PropertyParameter
func WithValue ¶
func WithValue(kind string) PropertyParameter
type PropertyParser ¶ added in v0.3.6
type PropertyParser func(rawLine ContentLine) (*BaseProperty, error)
PropertyParser is an optional replacement parser for malformed content lines. It receives the raw content line and can either recover, skip, or abort.
func FallbackParser ¶ added in v0.3.6
func FallbackParser(fallback PropertyParser, fallbacks ...PropertyParser) PropertyParser
FallbackParser builds an alternative to the default strict parser path used by ParseCalendar and ParseComponent. It tries the strict parser first, then each supplied fallback parser in order.
type RecurrenceRule ¶ added in v0.3.5
type RecurrenceRule struct {
Freq Frequency
Until time.Time // zero value if unset
UntilDateOnly bool // true when UNTIL was parsed from a date-only value (no time component)
Count int // 0 if unset
Interval int // defaults to 1
BySecond []int
ByMinute []int
ByHour []int
ByDay []WeekdayNum
ByMonthDay []int
ByYearDay []int
ByWeekNo []int
ByMonth []int
BySetPos []int
Wkst Weekday // empty string if unset
}
RecurrenceRule represents a parsed RRULE as defined in RFC 5545 Section 3.3.10.
func ParseRecurrenceRule ¶ added in v0.3.5
func ParseRecurrenceRule(s string) (*RecurrenceRule, error)
ParseRecurrenceRule parses an RRULE value string (without the "RRULE:" prefix) into a RecurrenceRule struct.
func (*RecurrenceRule) String ¶ added in v0.3.5
func (r *RecurrenceRule) String() string
String serializes the RecurrenceRule back to RRULE value format (without "RRULE:" prefix).
type RelationshipType ¶
type RelationshipType string
const ( RelationshipTypeChild RelationshipType = "CHILD" RelationshipTypeParent RelationshipType = "PARENT" RelationshipTypeSibling RelationshipType = "SIBLING" )
type SerializationConfiguration ¶ added in v0.3.2
type SerializationOption ¶ added in v0.3.6
type SerializationOption func(*SerializationConfiguration) error
SerializationOption provides functional options for Serialize and SerializeTo.
func WithSerializationTimezoneMapper ¶ added in v0.3.6
func WithSerializationTimezoneMapper(mapper TimezoneSerializationMapper) SerializationOption
WithSerializationTimezoneMapper configures how timezone identifiers are mapped during serialization.
func WithWindowsTimezoneMappingForSerialization ¶ added in v0.3.6
func WithWindowsTimezoneMappingForSerialization() SerializationOption
WithWindowsTimezoneMappingForSerialization enables mapping of IANA timezone names to Windows equivalents during serialization.
type SetPropertyOwner ¶ added in v0.3.3
type SetPropertyOwner interface {
SetProperty(property ComponentProperty, value string, params ...PropertyParameter)
}
type Standard ¶
type Standard struct {
ComponentBase
}
func NewStandard ¶ added in v0.3.2
func NewStandard() *Standard
func ParseStandard ¶
func ParseStandard(cs *CalendarStream, startLine *BaseProperty) *Standard
func ParseStandardWithError ¶ added in v0.3.2
func ParseStandardWithError(cs *CalendarStream, startLine *BaseProperty) (*Standard, error)
func (*Standard) Serialize ¶
func (standard *Standard) Serialize(serialConfig *SerializationConfiguration) string
func (*Standard) SerializeTo ¶ added in v0.3.2
func (standard *Standard) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
type TimeTransparency ¶
type TimeTransparency string
const ( TransparencyOpaque TimeTransparency = "OPAQUE" // default TransparencyTransparent TimeTransparency = "TRANSPARENT" )
type TimezoneMapper ¶ added in v0.3.6
TimezoneMapper maps a timezone identifier to a loaded time.Location. A nil return means the mapper did not handle the input.
type TimezoneSerializationMapper ¶ added in v0.3.6
TimezoneSerializationMapper maps a time.Location to a serialized timezone identifier.
type VAlarm ¶
type VAlarm struct {
ComponentBase
}
func NewAlarm ¶ added in v0.2.4
NewAlarm creates a new VALARM component. Note: The string parameter is unused as VALARM components do not have a UID property per RFC 5545.
func ParseVAlarm ¶
func ParseVAlarm(cs *CalendarStream, startLine *BaseProperty) *VAlarm
func ParseVAlarmWithError ¶ added in v0.3.2
func ParseVAlarmWithError(cs *CalendarStream, startLine *BaseProperty) (*VAlarm, error)
func (*VAlarm) Serialize ¶
func (c *VAlarm) Serialize(serialConfig *SerializationConfiguration) string
func (*VAlarm) SerializeTo ¶ added in v0.3.2
func (c *VAlarm) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
func (*VAlarm) SetAction ¶
func (c *VAlarm) SetAction(a Action, params ...PropertyParameter)
func (*VAlarm) SetTrigger ¶
func (c *VAlarm) SetTrigger(s string, params ...PropertyParameter)
type VBusy ¶
type VBusy struct {
ComponentBase
}
func ParseVBusy ¶
func ParseVBusy(cs *CalendarStream, startLine *BaseProperty) *VBusy
func ParseVBusyWithError ¶ added in v0.3.2
func ParseVBusyWithError(cs *CalendarStream, startLine *BaseProperty) (*VBusy, error)
func (*VBusy) Serialize ¶
func (busy *VBusy) Serialize(serialConfig *SerializationConfiguration) string
func (*VBusy) SerializeTo ¶ added in v0.3.2
func (busy *VBusy) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
type VEvent ¶
type VEvent struct {
ComponentBase
}
func ParseVEvent ¶
func ParseVEvent(cs *CalendarStream, startLine *BaseProperty) *VEvent
func ParseVEventWithError ¶ added in v0.3.2
func ParseVEventWithError(cs *CalendarStream, startLine *BaseProperty) (*VEvent, error)
func (*VEvent) GetAllDayDueAt ¶ added in v0.3.6
func (*VEvent) Serialize ¶
func (event *VEvent) Serialize(serialConfig *SerializationConfiguration) string
func (*VEvent) SerializeTo ¶ added in v0.3.2
func (event *VEvent) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
func (*VEvent) SetGeo ¶
func (event *VEvent) SetGeo(lat interface{}, lng interface{}, params ...PropertyParameter)
SetGeo sets the geo property
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, params ...PropertyParameter)
func (*VEvent) SetResources ¶ added in v0.2.4
func (event *VEvent) SetResources(r string, params ...PropertyParameter)
func (*VEvent) SetTimeTransparency ¶
func (event *VEvent) SetTimeTransparency(v TimeTransparency, params ...PropertyParameter)
type VJournal ¶
type VJournal struct {
ComponentBase
}
func NewJournal ¶ added in v0.2.4
func ParseVJournal ¶
func ParseVJournal(cs *CalendarStream, startLine *BaseProperty) *VJournal
func ParseVJournalWithError ¶ added in v0.3.2
func ParseVJournalWithError(cs *CalendarStream, startLine *BaseProperty) (*VJournal, error)
func (*VJournal) Serialize ¶
func (journal *VJournal) Serialize(serialConfig *SerializationConfiguration) string
func (*VJournal) SerializeTo ¶ added in v0.3.2
func (journal *VJournal) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
type VTimezone ¶
type VTimezone struct {
ComponentBase
}
func NewTimezone ¶ added in v0.2.4
func ParseVTimezone ¶
func ParseVTimezone(cs *CalendarStream, startLine *BaseProperty) *VTimezone
func ParseVTimezoneWithError ¶ added in v0.3.2
func ParseVTimezoneWithError(cs *CalendarStream, startLine *BaseProperty) (*VTimezone, error)
func (*VTimezone) AddStandard ¶ added in v0.3.2
func (*VTimezone) Serialize ¶
func (timezone *VTimezone) Serialize(serialConfig *SerializationConfiguration) string
func (*VTimezone) SerializeTo ¶ added in v0.3.2
func (timezone *VTimezone) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
type VTodo ¶
type VTodo struct {
ComponentBase
}
func ParseVTodo ¶
func ParseVTodo(cs *CalendarStream, startLine *BaseProperty) *VTodo
func ParseVTodoWithError ¶ added in v0.3.2
func ParseVTodoWithError(cs *CalendarStream, startLine *BaseProperty) (*VTodo, error)
func (*VTodo) GetDueAt ¶ added in v0.2.4
TODO verify that due is only relevant to VTodo if not move to ComponentBase.
func (*VTodo) Serialize ¶
func (todo *VTodo) Serialize(serialConfig *SerializationConfiguration) string
func (*VTodo) SerializeTo ¶ added in v0.3.2
func (todo *VTodo) SerializeTo(w io.Writer, serialConfig *SerializationConfiguration) error
func (*VTodo) SetAllDayCompletedAt ¶ added in v0.2.4
func (todo *VTodo) SetAllDayCompletedAt(t time.Time, params ...PropertyParameter)
func (*VTodo) SetAllDayDueAt ¶ added in v0.2.4
func (todo *VTodo) SetAllDayDueAt(t time.Time, params ...PropertyParameter)
func (*VTodo) SetCompletedAt ¶ added in v0.2.4
func (todo *VTodo) SetCompletedAt(t time.Time, params ...PropertyParameter)
func (*VTodo) SetDueAt ¶ added in v0.2.4
func (todo *VTodo) SetDueAt(t time.Time, params ...PropertyParameter)
func (*VTodo) SetDuration ¶ added in v0.2.4
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{}, params ...PropertyParameter)
SetGeo sets the geo property
func (*VTodo) SetPercentComplete ¶ added in v0.2.4
func (todo *VTodo) SetPercentComplete(p int, params ...PropertyParameter)
func (*VTodo) SetPriority ¶ added in v0.2.4
func (todo *VTodo) SetPriority(p int, params ...PropertyParameter)
func (*VTodo) SetResources ¶ added in v0.2.4
func (todo *VTodo) SetResources(r string, params ...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" )
type WeekdayNum ¶ added in v0.3.5
WeekdayNum represents a weekday with an optional ordinal (e.g., -1SU = last Sunday, 2MO = second Monday). OrdWeek of 0 means no ordinal was specified.
func (WeekdayNum) String ¶ added in v0.3.5
func (wdn WeekdayNum) String() string
type WithLineLength ¶ added in v0.3.2
type WithLineLength int
type WithNewLine ¶ added in v0.3.2
type WithNewLine string
const ( WithNewLineUnix WithNewLine = "\n" WithNewLineWindows WithNewLine = "\r\n" )