== Task Overview ==
We'd like to add to Calendar the ability to support external Calendar sources. Ideally this would both read and write both ways. So if I create an event in Phabricator, it would update my Google Calendar and vise versa. The overall goal is many small companies use Google to manage their work calendar, and that information automatically synced to Phabricator is handy.
For this task you will need a Google account if you do not have one::
https://accounts.google.com/SignUp
You will then need to register with Google APIs:
https://code.google.com/apis/console/b/0/?pli=1#access
Go to Services in API Project and turn on Calendar API.
Getting started on implementation:
https://developers.google.com/google-apps/calendar/
https://developers.google.com/google-apps/calendar/firstapp
https://code.google.com/p/google-api-php-client/
https://developers.google.com/google-apps/calendar/instantiate
Google provides both a REST API and PHP Client Library
@epriestley to confirm which approach.
==Authenticating==
Similiar to Settings:
https://secure.phabricator.com/settings/
We want to add 'Linked Accounts' to the side nav in Calendar. It should for now just list Google and have a similar workflow to linking external profile accounts. My poor understanding is you will just use OAuth 2 by Google, which we should have existing infrastructure for. More details: https://developers.google.com/google-apps/calendar/auth
==Design==
Google Calendar uses multiple Calendars to display data. 'Home', 'Work', 'Holidays', etc. To keep this task simple, I'd lean towards having the user pick one Calendar to sync to. If they have multiple, they need to select which Calendar. When they've selected a Calendar from Google to sync with, we should import all their Calendar data on Google into their Phabricator Calendar.
==Recurring Events==
I think this will likely be a pre-requisite task I will attach. We'll need to add recurring event support into Phabricator, and do it in a standard way so that it is compatible with other Calendars. The spec is a good place to start. PHP iCalendar also has a recurring event parser.
http://googleappsdeveloper.blogspot.com/2011/12/calendar-v3-best-practices-recurring.html
http://tools.ietf.org/html/rfc5545
http://sourceforge.net/projects/phpicalendar/