ics

package
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ics provides RFC 5545 iCalendar generation and parsing for mail calendar invitations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(event Event) []byte

Build generates a RFC 5545 VCALENDAR byte slice with METHOD:REQUEST. The output is suitable for use as a text/calendar MIME part.

Types

type Address

type Address struct {
	Name  string
	Email string
}

Address represents a name + email pair for ORGANIZER / ATTENDEE.

type Event

type Event struct {
	UID       string    // auto-generated if empty
	Summary   string    // SUMMARY (required)
	Location  string    // LOCATION (optional)
	Start     time.Time // DTSTART (required)
	End       time.Time // DTEND (required)
	Organizer Address   // ORGANIZER
	Attendees []Address // ATTENDEE list (To + Cc, excluding Bcc)
}

Event holds the data needed to generate an ICS VCALENDAR invitation.

type ParsedEvent

type ParsedEvent struct {
	Method       string    // VCALENDAR-level METHOD (REQUEST/REPLY/CANCEL)
	IsLarkDraft  bool      // true when VCALENDAR contains X-LARK-MAIL-DRAFT (Feishu private property indicating the event is editable)
	UID          string    // VEVENT UID
	Summary      string    // VEVENT SUMMARY, RFC 5545 TEXT unescaped
	Location     string    // VEVENT LOCATION, RFC 5545 TEXT unescaped
	Start        time.Time // VEVENT DTSTART
	End          time.Time // VEVENT DTEND
	Organizer    string    // ORGANIZER email (from MAILTO: URI or bare email)
	Attendees    []string  // ATTENDEE emails (from MAILTO: URIs or bare emails)
	OriginalTime int64     // RECURRENCE-ID as Unix seconds, 0 if not present. Used together with UID to derive the Feishu calendar event_id = UID + "_" + OriginalTime.
}

ParsedEvent holds key fields extracted from an ICS VCALENDAR.

func ParseEvent

func ParseEvent(icsText string) *ParsedEvent

ParseEvent extracts key fields from an ICS VCALENDAR string. Returns nil if no VEVENT is found.

Jump to

Keyboard shortcuts

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