-
Notifications
You must be signed in to change notification settings - Fork 4
/
reports.clj
225 lines (207 loc) · 7.22 KB
/
reports.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
(ns happygapi.doubleclicksearch.reports
"Search Ads 360 API: reports.
Reports and modifies your advertising data in DoubleClick Search (for example, campaigns, ad groups, keywords, and conversions).
See: https://developers.google.com/doubleclick-search/api/reference/rest/v2/reports"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn generate$
"https://developers.google.com/doubleclick-search/api/reference/rest/v2/reports/generate
Required parameters: none
Optional parameters: none
Body:
{:timeRange {:changedAttributesSinceTimestamp string,
:changedMetricsSinceTimestamp string,
:endDate string,
:startDate string},
:filters [{:column {:productReportPerspective string,
:customMetricName string,
:startDate string,
:headerText string,
:endDate string,
:groupByColumn boolean,
:platformSource string,
:customDimensionName string,
:savedColumnName string,
:columnName string},
:operator string,
:values [any]}],
:columns [{:productReportPerspective string,
:customMetricName string,
:startDate string,
:headerText string,
:endDate string,
:groupByColumn boolean,
:platformSource string,
:customDimensionName string,
:savedColumnName string,
:columnName string}],
:includeRemovedEntities boolean,
:verifySingleTimeZone boolean,
:includeDeletedEntities boolean,
:statisticsCurrency string,
:reportScope {:adGroupId string,
:adId string,
:advertiserId string,
:agencyId string,
:campaignId string,
:engineAccountId string,
:keywordId string},
:reportType string,
:startRow integer,
:maxRowsPerFile integer,
:rowCount integer,
:downloadFormat string,
:orderBy [{:column {:productReportPerspective string,
:customMetricName string,
:startDate string,
:headerText string,
:endDate string,
:groupByColumn boolean,
:platformSource string,
:customDimensionName string,
:savedColumnName string,
:columnName string},
:sortOrder string}]}
Generates and returns a report immediately."
{:scopes ["https://www.googleapis.com/auth/doubleclicksearch"]}
[auth args body]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/doubleclicksearch/v2/"
"reports/generate"
#{}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn get$
"https://developers.google.com/doubleclick-search/api/reference/rest/v2/reports/get
Required parameters: reportId
Optional parameters: none
Polls for the status of a report request."
{:scopes ["https://www.googleapis.com/auth/doubleclicksearch"]}
[auth args]
{:pre [(util/has-keys? args #{:reportId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/doubleclicksearch/v2/"
"reports/{reportId}"
#{:reportId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn getFile$
"https://developers.google.com/doubleclick-search/api/reference/rest/v2/reports/getFile
Required parameters: reportFragment, reportId
Optional parameters: none
Downloads a report file encoded in UTF-8."
{:scopes ["https://www.googleapis.com/auth/doubleclicksearch"]}
[auth args]
{:pre [(util/has-keys? args #{:reportFragment :reportId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/doubleclicksearch/v2/"
"reports/{reportId}/files/{reportFragment}"
#{:reportFragment :reportId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn request$
"https://developers.google.com/doubleclick-search/api/reference/rest/v2/reports/request
Required parameters: none
Optional parameters: none
Body:
{:timeRange {:changedAttributesSinceTimestamp string,
:changedMetricsSinceTimestamp string,
:endDate string,
:startDate string},
:filters [{:column {:productReportPerspective string,
:customMetricName string,
:startDate string,
:headerText string,
:endDate string,
:groupByColumn boolean,
:platformSource string,
:customDimensionName string,
:savedColumnName string,
:columnName string},
:operator string,
:values [any]}],
:columns [{:productReportPerspective string,
:customMetricName string,
:startDate string,
:headerText string,
:endDate string,
:groupByColumn boolean,
:platformSource string,
:customDimensionName string,
:savedColumnName string,
:columnName string}],
:includeRemovedEntities boolean,
:verifySingleTimeZone boolean,
:includeDeletedEntities boolean,
:statisticsCurrency string,
:reportScope {:adGroupId string,
:adId string,
:advertiserId string,
:agencyId string,
:campaignId string,
:engineAccountId string,
:keywordId string},
:reportType string,
:startRow integer,
:maxRowsPerFile integer,
:rowCount integer,
:downloadFormat string,
:orderBy [{:column {:productReportPerspective string,
:customMetricName string,
:startDate string,
:headerText string,
:endDate string,
:groupByColumn boolean,
:platformSource string,
:customDimensionName string,
:savedColumnName string,
:columnName string},
:sortOrder string}]}
Inserts a report request into the reporting system."
{:scopes ["https://www.googleapis.com/auth/doubleclicksearch"]}
[auth args body]
{:pre [(util/has-keys? args #{})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/doubleclicksearch/v2/"
"reports"
#{}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))