tritech / node-icalendar

iCalendar parser and generator for Node.js
MIT License
234 stars 50 forks source link

Support ORGANIZER and ATTENDEE #18

Open bachp opened 10 years ago

bachp commented 10 years ago

It would be nice to be able to have a .setAttendee() or setAttendees([]) and a setOrganizer() method for Events.

morwalz commented 10 years ago

as well as setLocation

mattcasey commented 10 years ago

I'd be willing to help push an feature update, but I'm not sure what these added methods would provide? Things like setLocation are just wrappers for addProperty. You can simply do:

var properties = {
'CN' : 'Some guy:mailto:someguy@gmail.com'
}
event.addProperty('ATTENDEE', '', properties);

(btw, setLocation is NOT in the npm version of this library, you need to use the github address in package.json if you want to get the most up-to-date code)

oliversalzburg commented 9 years ago

We're using this library to generate event invitations and I also noticed a lot of addProperty use in our code.

Having more expressive methods for this in the library would be highly appreciated. I would even go so far as to implement setters for class, priority, transparency, status and whatever else there is.

Even though these would be thin wrappers around addProperty, I think it would be a benefit simply through being more expressive with the code you write. I'd probably be able to send a PR if there is interest in merging something like that.

ismriv commented 9 years ago

+1

oathcomrade commented 9 years ago

Attendee and organizer are typed CAL-ADDRESS. It only takes value parameter. For now, it is impossible to set ROLE or PARTSTAT etc. How can this be fixed?

oliversalzburg commented 9 years ago

@oathcomrade Try this:

event.addProperty(
    "ATTENDEE", "MAILTO:" + meetingAttendee.email,
    {
        ROLE     : "REQ-PARTICIPANT",
        PARTSTAT : "NEEDS-ACTION",
        RSVP     : "TRUE",
        CN       : meetingAttendee.name.full
    } );