-
Notifications
You must be signed in to change notification settings - Fork 4
/
freebusy.clj
45 lines (39 loc) · 1.23 KB
/
freebusy.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(ns happygapi.calendar.freebusy
"Calendar API: freebusy.
Manipulates events and other calendar data.
See: https://developers.google.com/google-apps/calendar/firstappapi/reference/rest/v3/freebusy"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn query$
"https://developers.google.com/google-apps/calendar/firstappapi/reference/rest/v3/freebusy/query
Required parameters: none
Optional parameters: none
Body:
{:calendarExpansionMax integer,
:groupExpansionMax integer,
:items [{:id string}],
:timeMax string,
:timeMin string,
:timeZone string}
Returns free/busy information for a set of calendars."
{:scopes ["https://www.googleapis.com/auth/calendar"
"https://www.googleapis.com/auth/calendar.readonly"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/calendar/v3/"
"freeBusy"
#{}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))