Gcal (gcal v1.0.1)
Gcal
helps you interact with your Google
Calendar via the API.
Link to this section Summary
Functions
create_event/3
creates a new event in the desired calendar
get_calendar_details/2
gets the details of the desired calendar.
get_calendar_list/1
gets the list of available calendars for the person.
https://developers.google.com/calendar/api/v3/reference/calendarList/list
get_event_list/3
gets the list of events of the desired calendar.
headers/1
returns the required headers for making an HTTP request.
Link to this section Functions
create_event(access_token, map, cal_name \\ "primary")
create_event/3
creates a new event in the desired calendar
Arguments:
acces_token
: the valid Google
Auth Session token.
event_details
: the details of the event to be created
cal_name
(optional): the calendar to create the event in
get_calendar_details(access_token, cal_name \\ "primary")
get_calendar_details/2
gets the details of the desired calendar.
Arguments:
access_token
: the valid Google
Auth access token
datetime
: the date and time of the day to fetch the events.
calendar
: (optional) the string name of the calendar; defaults to "primary"
Sample response:
{:ok, %{ conferenceProperties: %{"allowedConferenceSolutionTypes" => ["hangoutsMeet"]}, etag: ""oftesUJ77GfcrwCPCmctnI90Qzs"", id: "nelson@gmail.com", kind: "calendar#calendar", summary: "nelson@gmail.com", timeZone: "Europe/London" }}
get_calendar_list(access_token)
get_calendar_list/1
gets the list of available calendars for the person.
https://developers.google.com/calendar/api/v3/reference/calendarList/list
Arguments:
access_token
: the valid Google
Auth access token.
Sample response:
{:ok, %{ etag: ""p320ebocgmjpfs0g"", items: [
%{
"accessRole" => "owner",
"backgroundColor" => "#9fe1e7",
"colorId" => "14",
"conferenceProperties" => %{
"allowedConferenceSolutionTypes" => ["hangoutsMeet"]
},
"defaultReminders" => [%{"method" => "popup", "minutes" => 10}],
"etag" => ""1553070512390000"",
"foregroundColor" => "#000000",
"id" => "nelson@gmail.com",
"kind" => "calendar#calendarListEntry",
"notificationSettings" => %{
"notifications" => [
%{"method" => "email", "type" => "eventCreation"},
%{"method" => "email", "type" => "eventChange"},
%{"method" => "email", "type" => "eventCancellation"},
%{"method" => "email", "type" => "eventResponse"}
]
},
"primary" => true,
"selected" => true,
"summary" => "nelson@gmail.com",
"timeZone" => "Europe/London"
},
%{
"accessRole" => "owner",
"backgroundColor" => "#d06b64",
"colorId" => "2",
"conferenceProperties" => %{
"allowedConferenceSolutionTypes" => ["hangoutsMeet"]
},
"defaultReminders" => [],
"etag" => ""1553070512692000"",
"foregroundColor" => "#000000",
"id" => "rpia5b9frqmvvd549c1scs82mk@group.calendar.google.com",
"kind" => "calendar#calendarListEntry",
"location" => "London, UK",
"selected" => true,
"summary" => "dwyl",
"timeZone" => "Europe/London"
}
], kind: "calendar#calendarList", nextSyncToken: "CIDl4ZC08v4CEg9uZWxzb25AZHd5bC5jb20=" }}
get_event_list(access_token, datetime, cal_name \\ "primary")
get_event_list/3
gets the list of events of the desired calendar.
Arguments:
access_token
: the valid Google
Auth Session token
datetime
: the date and time of the day to fetch the events.
calendar
: (optional) the string name of the calendar; defaults to "primary"
headers(access_token)
headers/1
returns the required headers for making an HTTP request.
Arguments:
acces_token
: the valid Google
Auth Session token.