/
activities.clj
74 lines (64 loc) · 2.64 KB
/
activities.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
(ns happygapi.admin.activities
"Admin Reports API: activities.
Fetches reports for the administrators of G Suite customers about the usage, collaboration, security, and risk for their users.
See: /admin-sdk/reports/api/reference/rest/reports_v1/activities"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn list$
"/admin-sdk/reports/api/reference/rest/reports_v1/activities/list
Required parameters: applicationName, userKey
Optional parameters: eventName, actorIpAddress, startTime, filters, endTime, orgUnitID, pageToken, customerId, maxResults
Retrieves a list of activities for a specific customer's account and application such as the Admin console application or the Google Drive application. For more information, see the guides for administrator and Google Drive activity reports. For more information about the activity report's parameters, see the activity parameters reference guides."
{:scopes ["https://www.googleapis.com/auth/admin.reports.audit.readonly"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:applicationName :userKey})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/admin/reports/v1/"
"activity/users/{userKey}/applications/{applicationName}"
#{:applicationName :userKey}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn watch$
"/admin-sdk/reports/api/reference/rest/reports_v1/activities/watch
Required parameters: applicationName, userKey
Optional parameters: eventName, actorIpAddress, startTime, filters, endTime, orgUnitID, pageToken, customerId, maxResults
Body:
{:address string,
:resourceUri string,
:payload boolean,
:expiration string,
:params {},
:type string,
:resourceId string,
:token string,
:id string,
:kind string}
Start receiving notifications for account activities. For more information, see Receiving Push Notifications."
{:scopes ["https://www.googleapis.com/auth/admin.reports.audit.readonly"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:applicationName :userKey})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/admin/reports/v1/"
"activity/users/{userKey}/applications/{applicationName}/watch"
#{:applicationName :userKey}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))