Skip to content

Go module implementing the RFC5545 standard, facilitating the creation and use of iCalendars on the Internet

License

Notifications You must be signed in to change notification settings

vareversat/gics

Repository files navigation

GICS 📅

Go badge for gics Github project Build badge for gics Github project Last release badge for gics Github project Code coverage badge for gics Github project

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)

The genesis 🧠

I decided to create this go module because existing options didn't meet my needs or were no longer maintained.

Main features 🚀

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
    • ✅ All are implemented
    • 🟧 Work needed for EXRULE, FREEBUSY, RDATE, RRULE and TRIGGER
  • 🟧 Make use of all types available
    • ✅ All are implemented
    • 🟧 Work needed for RECUR
  • 🟧 Parse an iCalendar file
    • ✅ Parsing ics files is implemented
    • 🟧 Missing the struct computation
  • ✅ Write in an iCalendar file

Installation

To install gics, use the go get command:

go get github.com/vareversat/gics@latest

Type representations

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

Example

  • 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)
  }
}

About

Go module implementing the RFC5545 standard, facilitating the creation and use of iCalendars on the Internet

Topics

Resources

License

Stars

Watchers

Forks

Languages