gics

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 4 Imported by: 0

README ยถ

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 and RRULE
  • ๐ŸŸง 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 float64
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)
  }
}

Documentation ยถ

Index ยถ

Constants ยถ

This section is empty.

Variables ยถ

This section is empty.

Functions ยถ

This section is empty.

Types ยถ

type Calendar ยถ

type Calendar interface {
	// SerializeToICSFormat format the CalendarComponent to his RFC-5545 representation.
	// It can be print inside a file or the stdout via the "output" param
	SerializeToICSFormat(output io.Writer)

	// MandatoryProperties return the list of the mandatory properties of the Calendar
	MandatoryProperties() []registries.PropertyRegistry

	// GetProperty get a property by his registries.PropertyRegistry
	GetProperty(name registries.PropertyRegistry) properties.Property

	// AddProperty add a new property to a Calendar
	AddProperty(property properties.Property)
}

Calendar is the interface definition of a iCalendar object

func NewCalendar ยถ

func NewCalendar(
	calendarComponent components.Component,
	propertyList ...properties.Property,
) (Calendar, error)

NewCalendar create a iCalendar object You can find more information in this section of the RFC-5545 : https://datatracker.ietf.org/doc/html/rfc5545#section-3.4

Directories ยถ

Path Synopsis

Jump to

Keyboard shortcuts

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