-
Notifications
You must be signed in to change notification settings - Fork 4
/
changes.clj
116 lines (104 loc) · 3.91 KB
/
changes.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
(ns happygapi.drive.changes
"Drive API: changes.
Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.
See: https://developers.google.com/drive/api/reference/rest/v3/changes"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn getStartPageToken$
"https://developers.google.com/drive/api/reference/rest/v3/changes/getStartPageToken
Required parameters: none
Optional parameters: driveId, supportsAllDrives, supportsTeamDrives, teamDriveId
Gets the starting pageToken for listing future changes."
{:scopes ["https://www.googleapis.com/auth/drive"
"https://www.googleapis.com/auth/drive.appdata"
"https://www.googleapis.com/auth/drive.file"
"https://www.googleapis.com/auth/drive.metadata"
"https://www.googleapis.com/auth/drive.metadata.readonly"
"https://www.googleapis.com/auth/drive.photos.readonly"
"https://www.googleapis.com/auth/drive.readonly"]}
[auth args]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/drive/v3/"
"changes/startPageToken"
#{}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/drive/api/reference/rest/v3/changes/list
Required parameters: pageToken
Optional parameters: includeRemoved, restrictToMyDrive, includeCorpusRemovals, includeItemsFromAllDrives, supportsAllDrives, teamDriveId, pageSize, spaces, includeTeamDriveItems, driveId, supportsTeamDrives
Lists the changes for a user or shared drive."
{:scopes ["https://www.googleapis.com/auth/drive"
"https://www.googleapis.com/auth/drive.appdata"
"https://www.googleapis.com/auth/drive.file"
"https://www.googleapis.com/auth/drive.metadata"
"https://www.googleapis.com/auth/drive.metadata.readonly"
"https://www.googleapis.com/auth/drive.photos.readonly"
"https://www.googleapis.com/auth/drive.readonly"]}
[auth args]
{:pre [(util/has-keys? args #{:pageToken})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/drive/v3/"
"changes"
#{:pageToken}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn watch$
"https://developers.google.com/drive/api/reference/rest/v3/changes/watch
Required parameters: pageToken
Optional parameters: includeRemoved, restrictToMyDrive, includeCorpusRemovals, includeItemsFromAllDrives, supportsAllDrives, teamDriveId, pageSize, spaces, includeTeamDriveItems, driveId, supportsTeamDrives
Body:
{:address string,
:resourceUri string,
:payload boolean,
:expiration string,
:params {},
:type string,
:resourceId string,
:token string,
:id string,
:kind string}
Subscribes to changes for a user."
{:scopes ["https://www.googleapis.com/auth/drive"
"https://www.googleapis.com/auth/drive.appdata"
"https://www.googleapis.com/auth/drive.file"
"https://www.googleapis.com/auth/drive.metadata"
"https://www.googleapis.com/auth/drive.metadata.readonly"
"https://www.googleapis.com/auth/drive.photos.readonly"
"https://www.googleapis.com/auth/drive.readonly"]}
[auth args body]
{:pre [(util/has-keys? args #{:pageToken})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/drive/v3/"
"changes/watch"
#{:pageToken}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))