ics

package module
v0.0.0-...-a165de5 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: MIT Imports: 6 Imported by: 0

README

ics

ics file generator for golang

Example

event := &Event{
    Class:       Classification_PUBLIC,
    Summary:     "Meeting with John",
    Description: "About ICS",
    Status:      EventStatus_CONFIRMED,
    DtStart:     time.Date(2019, time.January, 1, 9, 0, 0, 0, time.UTC),
    DtEnd:       time.Date(2019, time.January, 1, 9, 30, 0, 0, time.UTC),
    RRule: []string{
        "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,WE,FR",
        "FREQ=WEEKLY;INTERVAL=2;BYDAY=SU",
    },
    ExRule:       []string{},
    ExDate:       []time.Time{},
    Transparency: OPAQUE,
    Attendees: []Attendee{{
        CommonName:   "John Wick",
        EmailAddress: "john.wick@gmail.com",
        Role:         REQUIRED,
        PartStatus:   AttendeeStatus_ACCEPTED,
        CuType:       INDIVIDUAL,
    }},
    Organizer: Attendee{
        CommonName:   "Anuj",
        EmailAddress: "anuj@gmail.com",
    },
}

gotIcs, err := event.Generate("com.calendar.my")
if err != nil {
	/* handle error */
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDateTime

func FormatDateTime(t time.Time) string

func Generate

func Generate(prodId string, events ...*Event) (string, error)

Types

type Attendee

type Attendee struct {
	CommonName   string
	EmailAddress string
	Role         Role
	PartStatus   AttendeeStatus
	//RSVP is by default NO
	CuType CalendarUserType
	Rsvp   Rsvp
}

type AttendeeStatus

type AttendeeStatus string
const (
	AttendeeStatus_NEEDACTION AttendeeStatus = "NEEDS-ACTION"
	AttendeeStatus_TENTATIVE  AttendeeStatus = "TENTATIVE"
	AttendeeStatus_ACCEPTED   AttendeeStatus = "ACCEPTED"
	AttendeeStatus_DECLINED   AttendeeStatus = "DECLINED"
)

type CLASS

type CLASS string
const (
	Classification_PUBLIC       CLASS = "PUBLIC"
	Classification_PRIVATE      CLASS = "PRIVATE"
	Classification_CONFIDENTIAL CLASS = "CONFIDENTIAL"
)

type CalendarUserType

type CalendarUserType string
const (
	INDIVIDUAL CalendarUserType = "INDIVIDUAL"
)

type Event

type Event struct {
	Class        CLASS
	Summary      string
	Description  string
	Status       EventStatus
	Geo          *GeoLocation
	Location     string
	DtEnd        time.Time
	DtStart      time.Time
	RRule        []string
	ExRule       []string
	ExDate       []time.Time
	Transparency Transparency
	Attendees    []Attendee
	Organizer    Attendee
	UID          string
	// contains filtered or unexported fields
}

func (*Event) Generate

func (event *Event) Generate(prodId string) (string, error)

type EventStatus

type EventStatus string
const (
	EventStatus_CONFIRMED EventStatus = "CONFIRMED"
	EventStatus_CANCELLED EventStatus = "CANCELLED"
	EventStatus_TENTATIVE EventStatus = "TENTATIVE"
)

type GeoLocation

type GeoLocation struct {
	Latitude  float32
	Longitude float32
}

type Role

type Role string
const (
	REQUIRED Role = "REQ-PARTICIPANT"
)

type Rsvp

type Rsvp string

This is related to PartStat https://datatracker.ietf.org/doc/html/rfc5545#section-3.2.12 https://datatracker.ietf.org/doc/html/rfc5545#section-3.2.17

const (
	Rsvp_False Rsvp = "FALSE"
	Rsvp_True  Rsvp = "TRUE"
)

type Transparency

type Transparency string
const (
	TRANSAPARENT Transparency = "TRANSPARENT"
	OPAQUE       Transparency = "OPAQUE"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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