Settings:
;; Get from Google Developer Console
(setq gcal-client-id "xxxxxxxxx.apps.googleusercontent.com")
(setq gcal-client-secret "xxxx-XxxxXxxXXXxx") ;;API-KEY
Usege:
(require 'gcal)
;; list my calendars
(gcal-calendar-list-list) ;; Calendar List
;; list events
(gcal-events-list
"example@gmail.com" ;;<- calendar-id
`((timeMin . ,(gcal-datetime 2016 5 1))
(timeMax . ,(gcal-datetime 2016 6 1))))
;; insert event
(gcal-events-insert
"example@gmail.com"
`((start . ,(gcal-gtime 2016 5 27))
(end . ,(gcal-gtime 2016 5 28))
(summary . "My Special Holiday")))
;; delete event
(gcal-events-delete "example@gmail.com" "{event id}")
Usage:
(require 'gcal-org)
;; Org to Google Calendar
(gcal-org-push-file "example@gmail.com" "~/my-schedule.org") ;;use global cache file(~/.emacs.d/.gcal-org-pushed-events)
(gcal-org-push-file "example@gmail.com" "~/my-schedule.org" "~/my-schedule.gcal-cache")
Parse org & Upload
;; Org to oevent(org-mode event)
(gcal-org-parse-buffer) ;; Parse current buffer. Return a list of gcal-org-event object(including properties :id, :ord, :summary, :location, :ts-start, :ts-end, :ts-prefx, ...).
(gcal-org-parse-file "~/my-schedule.org") ;; Parse specified org file.
;; Upload oevents to Google Calendar
(gcal-org-push-oevents
"example@gmail.com"
(gcal-org-parse-file "~/my-schedule.org")
nil)
;; Upload oevents to Google Calendar (delta)
(gcal-org-push-oevents
"example@gmail.com"
(gcal-org-parse-file "~/my-schedule.org")
(gcal-org-parse-file "~/my-schedule.org.old"))
;; Delete events from Google Calendar
(gcal-org-push-oevents
"example@gmail.com"
nil
(gcal-org-parse-file "~/my-schedule.org"))
Download
;; Download oevents from Goole Calendar
(gcal-org-pull-oevents
"example@gmail.com"
`((timeMin . ,(gcal-time-format (current-time) nil)))) ;;after current time