Skip to content

arran4/golang-ical

Folders and files

NameName
Last commit message
Last commit date
Sep 29, 2024
Oct 15, 2024
Oct 15, 2024
Aug 25, 2021
Feb 9, 2022
May 30, 2024
May 21, 2024
Aug 25, 2021
Jan 25, 2020
Sep 23, 2023
Jan 27, 2025
Jan 28, 2024
Oct 15, 2024
Jan 28, 2025
Jan 27, 2025
Oct 15, 2024
Sep 22, 2024
Sep 26, 2024
May 21, 2024
Oct 15, 2024
Oct 15, 2024
Oct 15, 2024
Jan 27, 2025
Oct 15, 2024

Repository files navigation

golang-ical

A ICS / ICal parser and serialiser for Golang.

GoDoc

Because the other libraries didn't quite do what I needed.

Usage, parsing:

    cal, err := ParseCalendar(strings.NewReader(input))

Usage, parsing from a URL :

    cal, err := ParseCalendar("an-ics-url")

Creating:

  cal := ics.NewCalendar()
  cal.SetMethod(ics.MethodRequest)
  event := cal.AddEvent(fmt.Sprintf("id@domain", p.SessionKey.IntID()))
  event.SetCreatedTime(time.Now())
  event.SetDtStampTime(time.Now())
  event.SetModifiedAt(time.Now())
  event.SetStartAt(time.Now())
  event.SetEndAt(time.Now())
  event.SetSummary("Summary")
  event.SetLocation("Address")
  event.SetDescription("Description")
  event.SetURL("https://URL/")
  event.AddRrule(fmt.Sprintf("FREQ=YEARLY;BYMONTH=%d;BYMONTHDAY=%d", time.Now().Month(), time.Now().Day()))
  event.SetOrganizer("sender@domain", ics.WithCN("This Machine"))
  event.AddAttendee("reciever or participant", ics.CalendarUserTypeIndividual, ics.ParticipationStatusNeedsAction, ics.ParticipationRoleReqParticipant, ics.WithRSVP(true))
  return cal.Serialize()

Helper methods created as needed feel free to send a P.R. with more.

Notice

Looking for a co-maintainer.