/
accounts.clj
1262 lines (1086 loc) · 38.7 KB
/
accounts.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(ns happygapi.adexchangebuyer2.accounts
"Ad Exchange Buyer API II: accounts.
Accesses the latest features for managing Authorized Buyers accounts, Real-Time Bidding configurations and auction metrics, and Marketplace programmatic deals.
See: https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts"
(:require [cheshire.core :as json]
[clj-http.client :as http]
[happy.util :as util]))
(defn proposals-get$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/get
Required parameters: accountId, proposalId
Optional parameters: none
Gets a proposal given its ID. The proposal is returned at its head
revision."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:proposalId :accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals/{proposalId}"
#{:proposalId :accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-create$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/create
Required parameters: accountId
Optional parameters: none
Body:
{:isSetupComplete boolean,
:displayName string,
:billedBuyer {:accountId string},
:proposalRevision string,
:originatorRole string,
:updateTime string,
:proposalState string,
:notes [{:proposalRevision string,
:noteId string,
:createTime string,
:creatorRole string,
:note string}],
:lastUpdaterOrCommentorRole string,
:deals [{:syndicationProduct string,
:description string,
:createProductRevision string,
:isSetupComplete boolean,
:displayName string,
:creativePreApprovalPolicy string,
:createTime string,
:targetingCriterion [TargetingCriteria],
:dealServingMetadata DealServingMetadata,
:updateTime string,
:creativeSafeFrameCompatibility string,
:programmaticCreativeSource string,
:webPropertyCode string,
:createProductId string,
:buyerPrivateData PrivateData,
:externalDealId string,
:creativeRestrictions CreativeRestrictions,
:proposalId string,
:deliveryControl DeliveryControl,
:availableStartTime string,
:sellerContacts [ContactInformation],
:dealTerms DealTerms,
:dealId string,
:targeting MarketplaceTargeting,
:availableEndTime string}],
:buyerPrivateData {:referenceId string},
:buyerContacts [{:email string, :name string}],
:proposalId string,
:buyer {:accountId string},
:sellerContacts [{:email string, :name string}],
:privateAuctionId string,
:seller {:subAccountId string, :accountId string},
:isRenegotiating boolean}
Create the given proposal. Each created proposal and any deals it contains
are assigned a unique ID by the server."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals"
#{:accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-update$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/update
Required parameters: accountId, proposalId
Optional parameters: none
Body:
{:isSetupComplete boolean,
:displayName string,
:billedBuyer {:accountId string},
:proposalRevision string,
:originatorRole string,
:updateTime string,
:proposalState string,
:notes [{:proposalRevision string,
:noteId string,
:createTime string,
:creatorRole string,
:note string}],
:lastUpdaterOrCommentorRole string,
:deals [{:syndicationProduct string,
:description string,
:createProductRevision string,
:isSetupComplete boolean,
:displayName string,
:creativePreApprovalPolicy string,
:createTime string,
:targetingCriterion [TargetingCriteria],
:dealServingMetadata DealServingMetadata,
:updateTime string,
:creativeSafeFrameCompatibility string,
:programmaticCreativeSource string,
:webPropertyCode string,
:createProductId string,
:buyerPrivateData PrivateData,
:externalDealId string,
:creativeRestrictions CreativeRestrictions,
:proposalId string,
:deliveryControl DeliveryControl,
:availableStartTime string,
:sellerContacts [ContactInformation],
:dealTerms DealTerms,
:dealId string,
:targeting MarketplaceTargeting,
:availableEndTime string}],
:buyerPrivateData {:referenceId string},
:buyerContacts [{:email string, :name string}],
:proposalId string,
:buyer {:accountId string},
:sellerContacts [{:email string, :name string}],
:privateAuctionId string,
:seller {:subAccountId string, :accountId string},
:isRenegotiating boolean}
Update the given proposal at the client known revision number. If the
server revision has advanced since the passed-in
`proposal.proposal_revision`, an `ABORTED` error message will be returned.
Only the buyer-modifiable fields of the proposal will be updated.
Note that the deals in the proposal will be updated to match the passed-in
copy.
If a passed-in deal does not have a `deal_id`, the server will assign a new
unique ID and create the deal.
If passed-in deal has a `deal_id`, it will be updated to match the
passed-in copy.
Any existing deals not present in the passed-in proposal will be deleted.
It is an error to pass in a deal with a `deal_id` not present at head."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:proposalId :accountId})]}
(util/get-response
(http/put
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals/{proposalId}"
#{:proposalId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-completeSetup$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/completeSetup
Required parameters: accountId, proposalId
Optional parameters: none
Body:
{}
Update the given proposal to indicate that setup has been completed.
This method is called by the buyer when the line items have been created
on their end for a finalized proposal and all the required creatives
have been uploaded using the creatives API. This call updates the
`is_setup_completed` bit on the proposal and also notifies the seller.
The server will advance the revision number of the most recent proposal."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:proposalId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals/{proposalId}:completeSetup"
#{:proposalId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-list$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/list
Required parameters: accountId
Optional parameters: pageToken, pageSize, filterSyntax, filter
List proposals. A filter expression (PQL query) may be specified to
filter the results. To retrieve all finalized proposals, regardless if a
proposal is being renegotiated, see the FinalizedProposals resource.
Note that Bidder/ChildSeat relationships differ from the usual behavior.
A Bidder account can only see its child seats' proposals by specifying
the ChildSeat's accountId in the request path."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals"
#{:accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-addNote$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/addNote
Required parameters: accountId, proposalId
Optional parameters: none
Body:
{:note {:proposalRevision string,
:noteId string,
:createTime string,
:creatorRole string,
:note string}}
Create a new note and attach it to the proposal. The note is assigned
a unique ID by the server.
The proposal revision number will not increase when associated with a
new note."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:proposalId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals/{proposalId}:addNote"
#{:proposalId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-cancelNegotiation$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/cancelNegotiation
Required parameters: accountId, proposalId
Optional parameters: none
Body:
{}
Cancel an ongoing negotiation on a proposal. This does not cancel or end
serving for the deals if the proposal has been finalized, but only cancels
a negotiation unilaterally."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:proposalId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals/{proposalId}:cancelNegotiation"
#{:proposalId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-pause$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/pause
Required parameters: accountId, proposalId
Optional parameters: none
Body:
{:reason string}
Update the given proposal to pause serving.
This method will set the
`DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to true for all
deals in the proposal.
It is a no-op to pause an already-paused proposal.
It is an error to call PauseProposal for a proposal that is not
finalized or renegotiating."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:proposalId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals/{proposalId}:pause"
#{:proposalId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-resume$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/resume
Required parameters: accountId, proposalId
Optional parameters: none
Body:
{}
Update the given proposal to resume serving.
This method will set the
`DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to false for all
deals in the proposal.
Note that if the `has_seller_paused` bit is also set, serving will not
resume until the seller also resumes.
It is a no-op to resume an already-running proposal.
It is an error to call ResumeProposal for a proposal that is not
finalized or renegotiating."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:proposalId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals/{proposalId}:resume"
#{:proposalId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn proposals-accept$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/proposals/accept
Required parameters: accountId, proposalId
Optional parameters: none
Body:
{:proposalRevision string}
Mark the proposal as accepted at the given revision number. If the number
does not match the server's revision number an `ABORTED` error message will
be returned. This call updates the proposal_state from `PROPOSED` to
`BUYER_ACCEPTED`, or from `SELLER_ACCEPTED` to `FINALIZED`."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:proposalId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/proposals/{proposalId}:accept"
#{:proposalId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-get$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/get
Required parameters: accountId, clientAccountId
Optional parameters: none
Gets a client buyer with a given client account ID."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:clientAccountId :accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients/{clientAccountId}"
#{:clientAccountId :accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-list$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/list
Required parameters: accountId
Optional parameters: pageToken, partnerClientId, pageSize
Lists all the clients for the current sponsor buyer."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients"
#{:accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-update$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/update
Required parameters: accountId, clientAccountId
Optional parameters: none
Body:
{:role string,
:entityName string,
:partnerClientId string,
:clientAccountId string,
:visibleToSeller boolean,
:status string,
:entityId string,
:entityType string,
:clientName string}
Updates an existing client buyer."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:clientAccountId :accountId})]}
(util/get-response
(http/put
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients/{clientAccountId}"
#{:clientAccountId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-create$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/create
Required parameters: accountId
Optional parameters: none
Body:
{:role string,
:entityName string,
:partnerClientId string,
:clientAccountId string,
:visibleToSeller boolean,
:status string,
:entityId string,
:entityType string,
:clientName string}
Creates a new client buyer."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients"
#{:accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-invitations-create$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/invitations/create
Required parameters: accountId, clientAccountId
Optional parameters: none
Body:
{:email string, :clientAccountId string, :invitationId string}
Creates and sends out an email invitation to access
an Ad Exchange client buyer account."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:clientAccountId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations"
#{:clientAccountId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-invitations-get$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/invitations/get
Required parameters: accountId, clientAccountId, invitationId
Optional parameters: none
Retrieves an existing client user invitation."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys?
parameters
#{:clientAccountId :invitationId :accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations/{invitationId}"
#{:clientAccountId :invitationId :accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-invitations-list$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/invitations/list
Required parameters: accountId, clientAccountId
Optional parameters: pageToken, pageSize
Lists all the client users invitations for a client
with a given account ID."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:clientAccountId :accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients/{clientAccountId}/invitations"
#{:clientAccountId :accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-users-list$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/users/list
Required parameters: accountId, clientAccountId
Optional parameters: pageToken, pageSize
Lists all the known client users for a specified
sponsor buyer account ID."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:clientAccountId :accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients/{clientAccountId}/users"
#{:clientAccountId :accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-users-get$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/users/get
Required parameters: userId, accountId, clientAccountId
Optional parameters: none
Retrieves an existing client user."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys?
parameters
#{:clientAccountId :userId :accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients/{clientAccountId}/users/{userId}"
#{:clientAccountId :userId :accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn clients-users-update$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/clients/users/update
Required parameters: userId, accountId, clientAccountId
Optional parameters: none
Body:
{:clientAccountId string,
:status string,
:userId string,
:email string}
Updates an existing client user.
Only the user status can be changed on update."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys?
parameters
#{:clientAccountId :userId :accountId})]}
(util/get-response
(http/put
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/clients/{clientAccountId}/users/{userId}"
#{:clientAccountId :userId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn publisherProfiles-get$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/publisherProfiles/get
Required parameters: accountId, publisherProfileId
Optional parameters: none
Gets the requested publisher profile by id."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:publisherProfileId :accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/publisherProfiles/{publisherProfileId}"
#{:publisherProfileId :accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn publisherProfiles-list$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/publisherProfiles/list
Required parameters: accountId
Optional parameters: pageToken, pageSize
List all publisher profiles visible to the buyer"
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/publisherProfiles"
#{:accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn creatives-create$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/creatives/create
Required parameters: accountId
Optional parameters: duplicateIdMode
Body:
{:video {:videoUrl string, :videoVastXml string},
:detectedProductCategories [integer],
:servingRestrictions [{:status string,
:disapprovalReasons [Disapproval],
:contexts [ServingContext],
:disapproval Disapproval}],
:declaredClickThroughUrls [string],
:advertiserName string,
:adTechnologyProviders {:hasUnidentifiedProvider boolean,
:detectedProviderIds [string]},
:adChoicesDestinationUrl string,
:impressionTrackingUrls [string],
:dealsStatus string,
:apiUpdateTime string,
:detectedSensitiveCategories [integer],
:openAuctionStatus string,
:restrictedCategories [string],
:corrections [{:type string,
:contexts [ServingContext],
:details [string]}],
:detectedDomains [string],
:detectedLanguages [string],
:creativeId string,
:native {:clickLinkUrl string,
:headline string,
:starRating number,
:storeUrl string,
:logo Image,
:advertiserName string,
:appIcon Image,
:priceDisplayText string,
:callToAction string,
:clickTrackingUrl string,
:videoUrl string,
:image Image,
:body string},
:detectedAdvertiserIds [string],
:vendorIds [integer],
:agencyId string,
:version integer,
:attributes [string],
:accountId string,
:clickThroughUrls [string],
:html {:snippet string, :height integer, :width integer}}
Creates a creative."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/creatives"
#{:accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn creatives-stopWatching$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/creatives/stopWatching
Required parameters: accountId, creativeId
Optional parameters: none
Body:
{}
Stops watching a creative. Will stop push notifications being sent to the
topics when the creative changes status."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:creativeId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/creatives/{creativeId}:stopWatching"
#{:creativeId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn creatives-get$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/creatives/get
Required parameters: creativeId, accountId
Optional parameters: none
Gets a creative."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters]
{:pre [(util/has-keys? parameters #{:creativeId :accountId})]}
(util/get-response
(http/get
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/creatives/{creativeId}"
#{:creativeId :accountId}
parameters)
(merge-with
merge
{:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn creatives-watch$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/creatives/watch
Required parameters: accountId, creativeId
Optional parameters: none
Body:
{:topic string}
Watches a creative. Will result in push notifications being sent to the
topic when the creative changes status."
{:scopes ["https://www.googleapis.com/auth/adexchange.buyer"]}
[auth parameters body]
{:pre [(util/has-keys? parameters #{:creativeId :accountId})]}
(util/get-response
(http/post
(util/get-url
"https://adexchangebuyer.googleapis.com/"
"v2beta1/accounts/{accountId}/creatives/{creativeId}:watch"
#{:creativeId :accountId}
parameters)
(merge-with
merge
{:content-type :json,
:body (json/generate-string body),
:throw-exceptions false,
:query-params parameters,
:accept :json,
:as :json}
auth))))
(defn creatives-update$
"https://developers.google.com/authorized-buyers/apis/reference/rest/api/reference/rest/v2beta1/accounts/creatives/update
Required parameters: accountId, creativeId
Optional parameters: none
Body: