-
Notifications
You must be signed in to change notification settings - Fork 4
/
sizes.clj
93 lines (81 loc) · 2.63 KB
/
sizes.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
(ns happygapi.dfareporting.sizes
"DCM/DFA Reporting And Trafficking API: sizes.
Manages your DoubleClick Campaign Manager ad campaigns and reports.
See: https://developers.google.com/doubleclick-advertisers/api/reference/rest/v3.4/sizes"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn get$
"https://developers.google.com/doubleclick-advertisers/api/reference/rest/v3.4/sizes/get
Required parameters: id, profileId
Optional parameters: none
Gets one size by ID."
{:scopes ["https://www.googleapis.com/auth/dfatrafficking"]}
[auth args]
{:pre [(util/has-keys? args #{:id :profileId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/dfareporting/v3.4/"
"userprofiles/{profileId}/sizes/{id}"
#{:id :profileId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn insert$
"https://developers.google.com/doubleclick-advertisers/api/reference/rest/v3.4/sizes/insert
Required parameters: profileId
Optional parameters: none
Body:
{:height integer,
:iab boolean,
:id string,
:kind string,
:width integer}
Inserts a new size."
{:scopes ["https://www.googleapis.com/auth/dfatrafficking"]}
[auth args body]
{:pre [(util/has-keys? args #{:profileId})]}
(util/get-response
(http/post
(util/get-url
"https://www.googleapis.com/dfareporting/v3.4/"
"userprofiles/{profileId}/sizes"
#{:profileId}
args)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))
(defn list$
"https://developers.google.com/doubleclick-advertisers/api/reference/rest/v3.4/sizes/list
Required parameters: profileId
Optional parameters: height, iabStandard, ids, width
Retrieves a list of sizes, possibly filtered. Retrieved sizes are globally unique and may include values not currently in use by your account. Due to this, the list of sizes returned by this method may differ from the list seen in the Trafficking UI."
{:scopes ["https://www.googleapis.com/auth/dfatrafficking"]}
[auth args]
{:pre [(util/has-keys? args #{:profileId})]}
(util/get-response
(http/get
(util/get-url
"https://www.googleapis.com/dfareporting/v3.4/"
"userprofiles/{profileId}/sizes"
#{:profileId}
args)
(merge-with
merge
{:throw-exceptions false,
:query-params args,
:accept :json,
:as :json}
auth))))