Skip to content

Commit 3097f3c

Browse files
authored
chore: add extra field for attendee status (#6)
1 parent 72ee8b8 commit 3097f3c

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

generator.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ func Generate(prodId string, events ...*Event) (string, error) {
2020
return "", err
2121
}
2222
for _, event := range events {
23+
24+
for idx := range event.Attendees {
25+
if event.Attendees[idx].Rsvp == "" {
26+
event.Attendees[idx].Rsvp = Rsvp_False
27+
}
28+
}
29+
2330
e := &vEvent{
2431
Event: event,
2532
DtStamp: FormatDateTime(time.Now()),
@@ -60,6 +67,12 @@ func (event *Event) Generate(prodId string) (string, error) {
6067
Events: []string{},
6168
}
6269

70+
for idx := range event.Attendees {
71+
if event.Attendees[idx].Rsvp == "" {
72+
event.Attendees[idx].Rsvp = Rsvp_False
73+
}
74+
}
75+
6376
e := &vEvent{
6477
Event: event,
6578
DtStamp: FormatDateTime(time.Now()),

objects.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ type Attendee struct {
5959
PartStatus AttendeeStatus
6060
//RSVP is by default NO
6161
CuType CalendarUserType
62+
Rsvp RSVP
6263
}
6364

6465
type Role string
@@ -70,13 +71,24 @@ const (
7071
type AttendeeStatus string
7172

7273
const (
73-
AttendeeStatus_TENTATIVE AttendeeStatus = "TENTATIVE"
74-
AttendeeStatus_ACCEPTED AttendeeStatus = "ACCEPTED"
75-
AttendeeStatus_DECLINED AttendeeStatus = "DECLINED"
74+
AttendeeStatus_NeedAction AttendeeStatus = "NEEDS-ACTION"
75+
AttendeeStatus_TENTATIVE AttendeeStatus = "TENTATIVE"
76+
AttendeeStatus_ACCEPTED AttendeeStatus = "ACCEPTED"
77+
AttendeeStatus_DECLINED AttendeeStatus = "DECLINED"
7678
)
7779

7880
type CalendarUserType string
7981

8082
const (
8183
INDIVIDUAL CalendarUserType = "INDIVIDUAL"
8284
)
85+
86+
// This is related to PartStat
87+
// https://datatracker.ietf.org/doc/html/rfc5545#section-3.2.12
88+
// https://datatracker.ietf.org/doc/html/rfc5545#section-3.2.17
89+
type RSVP string
90+
91+
const (
92+
Rsvp_False RSVP = "FALSE"
93+
Rsvp_True RSVP = "TRUE"
94+
)

0 commit comments

Comments
 (0)