/
sdfdownloadtasks.clj
94 lines (82 loc) · 2.85 KB
/
sdfdownloadtasks.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
(ns happygapi.displayvideo.sdfdownloadtasks
"Display & Video 360 API: sdfdownloadtasks.
Display & Video 360 API allows users to manage and create campaigns and reports.
See: https://developers.google.com/display-video/api/reference/rest/v1/sdfdownloadtasks"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn create$
"https://developers.google.com/display-video/api/reference/rest/v1/sdfdownloadtasks/create
Required parameters: none
Optional parameters: none
Body:
{:advertiserId string,
:parentEntityFilter {:fileType [string],
:filterType string,
:filterIds [string]},
:idFilter {:mediaProductIds [string],
:lineItemIds [string],
:adGroupAdIds [string],
:adGroupIds [string],
:campaignIds [string],
:insertionOrderIds [string]},
:partnerId string,
:version string,
:inventorySourceFilter {:inventorySourceIds [string]}}
Creates an SDF Download Task. Returns an
Operation.
An SDF Download Task is a long-running, asynchronous operation. The
metadata type of this operation is
SdfDownloadTaskMetadata. If the request is successful, the
response type of the operation is
SdfDownloadTask. The response will not include the download files,
which must be retrieved with
media.download. The state of
operation can be retrieved with
sdfdownloadtask.operations.get.
Any errors can be found in the
error.message. Note
that error.details is expected to be
empty."
{:scopes ["https://www.googleapis.com/auth/display-video"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{})]}
(util/get-response
(http/post
(util/get-url
"https://displayvideo.googleapis.com/"
"v1/sdfdownloadtasks"
#{}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn operations-get$
"https://developers.google.com/display-video/api/reference/rest/v1/sdfdownloadtasks/operations/get
Required parameters: name
Optional parameters: none
Gets the latest state of an asynchronous SDF download task operation. Clients should poll this method at intervals of 30 seconds."
{:scopes ["https://www.googleapis.com/auth/display-video"
"https://www.googleapis.com/auth/doubleclickbidmanager"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:name})]}
(util/get-response
(http/get
(util/get-url
"https://displayvideo.googleapis.com/"
"v1/{+name}"
#{:name}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))