Warning
There is still plenty work to do on this project. This package may be uses in a production environment at your own risks !
This project is intended to implement the RFC5545 - Internet Calendaring and Scheduling Core Object Specification ( you can find the Request Of Comments here)
I decided to create this go module because existing options didn't meet my needs or were no longer maintained.
Here the main features this module offers (some are already available โ and some are still in WIP state ๐ง)
- โ
Create an iCalendar object
- โ With VEVENT components
- โ With VALARM components
- โ With VJOURNAL components
- โ With VFREEBUSY components
- โ With VTIMEZONE components
- โ With VTODO components
- ๐ง Make use of all properties available
- ๐ง Make use of all types available
- ๐ง Parse an iCalendar file
- โ Write in an iCalendar file
To install gics, use the go get
command:
go get github.com/vareversat/gics
Type name | Go type |
---|---|
BINARY | string (base64 representation) |
BOOLEAN | bool |
CAL-ADDRESS | uri.URL |
DATE | time.Time |
DATE-TIME | time.Time |
DURATION | string |
FLOAT | float32 |
INTEGER | int32 |
PERIOD | time.Time / time.Time |
RECUR | complex |
TEXT | string |
TIME | time.Time |
URI | uri.URL |
UTC-OFFSET | string |
- Create and display an iCalendar
package main
import (
"github.com/vareversat/gics"
"github.com/vareversat/gics/components"
"github.com/vareversat/gics/properties"
"github.com/vareversat/gics/types"
"os"
"time"
)
func main() {
// Create an array of VEVENT component
calendarComponents := components.CalendarComponents{}
// Create a VEVENT component
c := components.NewEventCalendarComponent(
properties.NewUidProperty("My_EVENT"),
properties.NewDateTimeStampProperty(time.Now().UTC()),
[]components.AlarmCalendarComponent{}, // Empty VALARM
properties.NewDateTimeStartProperty(time.Now(), types.WithUtcTime),
properties.NewDescriptionProperty("This is an event of my calendar !"))
calendarComponents = append(calendarComponents, c)
// Create an iCalendar with the previously created VEVENT
calendar, err := gics.NewCalendar(calendarComponents,
"-//Valentin REVERSAT//https://github.com/vareversat/gics//FR",
"PUBLISH",
"2.0")
if err != nil {
panic(err)
} else {
// Print the iCalendar in the stdout
calendar.SerializeToICSFormat(os.Stdout)
}
}