python-amazon-ad-api 2.3.0__py3-none-any.whl → 2.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1268 @@
1
+ """Plan management /mediaPlan/v1.
2
+
3
+ Contract: Media Planning API 3.0, the *Plan management (closed beta)* family.
4
+ Thirty-five routes under ``/mediaPlan/v1``, plain ``application/json`` in body
5
+ and answer, grouped by resource.
6
+
7
+ Six resources carry a full CRUD: ``mediaPlans``, ``planningItems``, ``targets``,
8
+ ``marketingGoals``, ``audienceOpportunities`` and ``budgetAllocations``. Each has
9
+ ``POST`` to create, ``PUT`` to update, ``POST .../delete`` to delete,
10
+ ``POST .../list`` and ``GET .../{id}``.
11
+
12
+ Five are read only: ``audienceSizes``, ``behavioralInsights``,
13
+ ``demographicInsights``, ``trafficInsights`` and ``performanceForecasts``, with
14
+ ``list`` and ``get``. One more route exports media plans.
15
+
16
+ Delete is a **POST to ``/delete``**, not an HTTP ``DELETE``, and create and
17
+ update live on the **same path** with different verbs.
18
+
19
+ The contract is a **closed beta** and this account is not in it: every route
20
+ answers ``401 Unauthorized exception while handling 3P Request: Unauthorized``.
21
+ Code follows the contract route by route; no route of this family has answered
22
+ ``200`` here.
23
+
24
+ Headers: the contract lists ``Amazon-Ads-AccountId``,
25
+ ``Amazon-Ads-Manager-AccountId``, ``Amazon-Advertising-API-ClientId``,
26
+ ``Amazon-Advertising-API-Scope`` and ``editToken``, all optional. The client
27
+ sends the scope from the account. ``editToken`` is the one header a caller may
28
+ need to add, and the methods take it as ``edit_token=``.
29
+ """
30
+
31
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
32
+
33
+
34
+ class MediaPlan(Client):
35
+ r"""Plan management - /mediaPlan/v1
36
+
37
+ Documentation: https://advertising.amazon.com/API/docs/en-us/plan-management
38
+
39
+ .. deprecated:: 2.3.0
40
+
41
+ Closed beta. Not a retirement: the routes exist and answer, but only to
42
+ accounts with access.
43
+ """
44
+
45
+ @sp_endpoint('/mediaPlan/v1/mediaPlans/list', method='POST',
46
+ headers=['Amazon-Advertising-API-Scope',
47
+ 'Amazon-Ads-AccountId',
48
+ 'Amazon-Advertising-API-Manager-Account'])
49
+ def list_media_plans(self, **kwargs) -> ApiResponse:
50
+ r"""
51
+ Lists Media Plans. Read only.
52
+
53
+ Request Body
54
+ The list body the contract publishes for this resource.
55
+
56
+ Keyword Args
57
+
58
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
59
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
60
+ ``'manager_account_id'``; decides which identity header travels.
61
+ Defaults to the scope. [optional]
62
+
63
+ Returns
64
+ ApiResponse with the list.
65
+ """
66
+ headers = {'Accept': 'application/json',
67
+ 'Content-Type': 'application/json'}
68
+ edit_token = kwargs.pop('edit_token', None)
69
+ if edit_token:
70
+ headers['editToken'] = edit_token
71
+ body = Utils.convert_body(kwargs.pop('body'), False)
72
+ return self._request(fill_query_params(kwargs.pop('path')),
73
+ data=body, params=kwargs, headers=headers)
74
+
75
+ @sp_endpoint('/mediaPlan/v1/mediaPlans/{}', method='GET',
76
+ headers=['Amazon-Advertising-API-Scope',
77
+ 'Amazon-Ads-AccountId',
78
+ 'Amazon-Advertising-API-Manager-Account'])
79
+ def get_media_plan(self, mediaPlanId, **kwargs) -> ApiResponse:
80
+ r"""
81
+ Gets one of Media Plans by id. Read only.
82
+
83
+ Path Parameters
84
+
85
+ - ``mediaPlanId`` (str): the id. [required]
86
+
87
+ Keyword Args
88
+
89
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
90
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
91
+ ``'manager_account_id'``; decides which identity header travels.
92
+ Defaults to the scope. [optional]
93
+
94
+ Returns
95
+ ApiResponse with the resource.
96
+ """
97
+ headers = {'Accept': 'application/json'}
98
+ edit_token = kwargs.pop('edit_token', None)
99
+ if edit_token:
100
+ headers['editToken'] = edit_token
101
+ return self._request(fill_query_params(kwargs.pop('path'), mediaPlanId),
102
+ params=kwargs, headers=headers)
103
+
104
+ @sp_endpoint('/mediaPlan/v1/mediaPlans', method='POST',
105
+ headers=['Amazon-Advertising-API-Scope',
106
+ 'Amazon-Ads-AccountId',
107
+ 'Amazon-Advertising-API-Manager-Account'])
108
+ def create_media_plan(self, **kwargs) -> ApiResponse:
109
+ r"""
110
+ Creates Media Plans.
111
+
112
+ Request Body [Required]
113
+ The create body the contract publishes for this resource.
114
+
115
+ Keyword Args
116
+
117
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
118
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
119
+ ``'manager_account_id'``; decides which identity header travels.
120
+ Defaults to the scope. [optional]
121
+
122
+ Returns
123
+ ApiResponse with the created resource.
124
+ """
125
+ headers = {'Accept': 'application/json',
126
+ 'Content-Type': 'application/json'}
127
+ edit_token = kwargs.pop('edit_token', None)
128
+ if edit_token:
129
+ headers['editToken'] = edit_token
130
+ body = Utils.convert_body(kwargs.pop('body'), False)
131
+ return self._request(fill_query_params(kwargs.pop('path')),
132
+ data=body, params=kwargs, headers=headers)
133
+
134
+ @sp_endpoint('/mediaPlan/v1/mediaPlans', method='PUT',
135
+ headers=['Amazon-Advertising-API-Scope',
136
+ 'Amazon-Ads-AccountId',
137
+ 'Amazon-Advertising-API-Manager-Account'])
138
+ def update_media_plan(self, **kwargs) -> ApiResponse:
139
+ r"""
140
+ Updates Media Plans.
141
+
142
+ Request Body [Required]
143
+ The update body the contract publishes for this resource.
144
+
145
+ Keyword Args
146
+
147
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
148
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
149
+ ``'manager_account_id'``; decides which identity header travels.
150
+ Defaults to the scope. [optional]
151
+
152
+ Returns
153
+ ApiResponse with the updated resource.
154
+ """
155
+ headers = {'Accept': 'application/json',
156
+ 'Content-Type': 'application/json'}
157
+ edit_token = kwargs.pop('edit_token', None)
158
+ if edit_token:
159
+ headers['editToken'] = edit_token
160
+ body = Utils.convert_body(kwargs.pop('body'), False)
161
+ return self._request(fill_query_params(kwargs.pop('path')),
162
+ data=body, params=kwargs, headers=headers)
163
+
164
+ @sp_endpoint('/mediaPlan/v1/mediaPlans/delete', method='POST',
165
+ headers=['Amazon-Advertising-API-Scope',
166
+ 'Amazon-Ads-AccountId',
167
+ 'Amazon-Advertising-API-Manager-Account'])
168
+ def delete_media_plans(self, **kwargs) -> ApiResponse:
169
+ r"""
170
+ Deletes Media Plans. It is a ``POST`` to ``/delete``, not an HTTP
171
+ ``DELETE``.
172
+
173
+ Request Body [Required]
174
+ The delete body the contract publishes for this resource.
175
+
176
+ Keyword Args
177
+
178
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
179
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
180
+ ``'manager_account_id'``; decides which identity header travels.
181
+ Defaults to the scope. [optional]
182
+
183
+ Returns
184
+ ApiResponse with the outcome.
185
+ """
186
+ headers = {'Accept': 'application/json',
187
+ 'Content-Type': 'application/json'}
188
+ edit_token = kwargs.pop('edit_token', None)
189
+ if edit_token:
190
+ headers['editToken'] = edit_token
191
+ body = Utils.convert_body(kwargs.pop('body'), False)
192
+ return self._request(fill_query_params(kwargs.pop('path')),
193
+ data=body, params=kwargs, headers=headers)
194
+
195
+ @sp_endpoint('/mediaPlan/v1/planningItems/list', method='POST',
196
+ headers=['Amazon-Advertising-API-Scope',
197
+ 'Amazon-Ads-AccountId',
198
+ 'Amazon-Advertising-API-Manager-Account'])
199
+ def list_planning_items(self, **kwargs) -> ApiResponse:
200
+ r"""
201
+ Lists Planning Items. Read only.
202
+
203
+ Request Body
204
+ The list body the contract publishes for this resource.
205
+
206
+ Keyword Args
207
+
208
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
209
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
210
+ ``'manager_account_id'``; decides which identity header travels.
211
+ Defaults to the scope. [optional]
212
+
213
+ Returns
214
+ ApiResponse with the list.
215
+ """
216
+ headers = {'Accept': 'application/json',
217
+ 'Content-Type': 'application/json'}
218
+ edit_token = kwargs.pop('edit_token', None)
219
+ if edit_token:
220
+ headers['editToken'] = edit_token
221
+ body = Utils.convert_body(kwargs.pop('body'), False)
222
+ return self._request(fill_query_params(kwargs.pop('path')),
223
+ data=body, params=kwargs, headers=headers)
224
+
225
+ @sp_endpoint('/mediaPlan/v1/planningItems/{}', method='GET',
226
+ headers=['Amazon-Advertising-API-Scope',
227
+ 'Amazon-Ads-AccountId',
228
+ 'Amazon-Advertising-API-Manager-Account'])
229
+ def get_planning_item(self, planningItemId, **kwargs) -> ApiResponse:
230
+ r"""
231
+ Gets one of Planning Items by id. Read only.
232
+
233
+ Path Parameters
234
+
235
+ - ``planningItemId`` (str): the id. [required]
236
+
237
+ Keyword Args
238
+
239
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
240
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
241
+ ``'manager_account_id'``; decides which identity header travels.
242
+ Defaults to the scope. [optional]
243
+
244
+ Returns
245
+ ApiResponse with the resource.
246
+ """
247
+ headers = {'Accept': 'application/json'}
248
+ edit_token = kwargs.pop('edit_token', None)
249
+ if edit_token:
250
+ headers['editToken'] = edit_token
251
+ return self._request(fill_query_params(kwargs.pop('path'), planningItemId),
252
+ params=kwargs, headers=headers)
253
+
254
+ @sp_endpoint('/mediaPlan/v1/planningItems', method='POST',
255
+ headers=['Amazon-Advertising-API-Scope',
256
+ 'Amazon-Ads-AccountId',
257
+ 'Amazon-Advertising-API-Manager-Account'])
258
+ def create_planning_item(self, **kwargs) -> ApiResponse:
259
+ r"""
260
+ Creates Planning Items.
261
+
262
+ Request Body [Required]
263
+ The create body the contract publishes for this resource.
264
+
265
+ Keyword Args
266
+
267
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
268
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
269
+ ``'manager_account_id'``; decides which identity header travels.
270
+ Defaults to the scope. [optional]
271
+
272
+ Returns
273
+ ApiResponse with the created resource.
274
+ """
275
+ headers = {'Accept': 'application/json',
276
+ 'Content-Type': 'application/json'}
277
+ edit_token = kwargs.pop('edit_token', None)
278
+ if edit_token:
279
+ headers['editToken'] = edit_token
280
+ body = Utils.convert_body(kwargs.pop('body'), False)
281
+ return self._request(fill_query_params(kwargs.pop('path')),
282
+ data=body, params=kwargs, headers=headers)
283
+
284
+ @sp_endpoint('/mediaPlan/v1/planningItems', method='PUT',
285
+ headers=['Amazon-Advertising-API-Scope',
286
+ 'Amazon-Ads-AccountId',
287
+ 'Amazon-Advertising-API-Manager-Account'])
288
+ def update_planning_item(self, **kwargs) -> ApiResponse:
289
+ r"""
290
+ Updates Planning Items.
291
+
292
+ Request Body [Required]
293
+ The update body the contract publishes for this resource.
294
+
295
+ Keyword Args
296
+
297
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
298
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
299
+ ``'manager_account_id'``; decides which identity header travels.
300
+ Defaults to the scope. [optional]
301
+
302
+ Returns
303
+ ApiResponse with the updated resource.
304
+ """
305
+ headers = {'Accept': 'application/json',
306
+ 'Content-Type': 'application/json'}
307
+ edit_token = kwargs.pop('edit_token', None)
308
+ if edit_token:
309
+ headers['editToken'] = edit_token
310
+ body = Utils.convert_body(kwargs.pop('body'), False)
311
+ return self._request(fill_query_params(kwargs.pop('path')),
312
+ data=body, params=kwargs, headers=headers)
313
+
314
+ @sp_endpoint('/mediaPlan/v1/planningItems/delete', method='POST',
315
+ headers=['Amazon-Advertising-API-Scope',
316
+ 'Amazon-Ads-AccountId',
317
+ 'Amazon-Advertising-API-Manager-Account'])
318
+ def delete_planning_items(self, **kwargs) -> ApiResponse:
319
+ r"""
320
+ Deletes Planning Items. It is a ``POST`` to ``/delete``, not an HTTP
321
+ ``DELETE``.
322
+
323
+ Request Body [Required]
324
+ The delete body the contract publishes for this resource.
325
+
326
+ Keyword Args
327
+
328
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
329
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
330
+ ``'manager_account_id'``; decides which identity header travels.
331
+ Defaults to the scope. [optional]
332
+
333
+ Returns
334
+ ApiResponse with the outcome.
335
+ """
336
+ headers = {'Accept': 'application/json',
337
+ 'Content-Type': 'application/json'}
338
+ edit_token = kwargs.pop('edit_token', None)
339
+ if edit_token:
340
+ headers['editToken'] = edit_token
341
+ body = Utils.convert_body(kwargs.pop('body'), False)
342
+ return self._request(fill_query_params(kwargs.pop('path')),
343
+ data=body, params=kwargs, headers=headers)
344
+
345
+ @sp_endpoint('/mediaPlan/v1/targets/list', method='POST',
346
+ headers=['Amazon-Advertising-API-Scope',
347
+ 'Amazon-Ads-AccountId',
348
+ 'Amazon-Advertising-API-Manager-Account'])
349
+ def list_targets(self, **kwargs) -> ApiResponse:
350
+ r"""
351
+ Lists Targets. Read only.
352
+
353
+ Request Body
354
+ The list body the contract publishes for this resource.
355
+
356
+ Keyword Args
357
+
358
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
359
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
360
+ ``'manager_account_id'``; decides which identity header travels.
361
+ Defaults to the scope. [optional]
362
+
363
+ Returns
364
+ ApiResponse with the list.
365
+ """
366
+ headers = {'Accept': 'application/json',
367
+ 'Content-Type': 'application/json'}
368
+ edit_token = kwargs.pop('edit_token', None)
369
+ if edit_token:
370
+ headers['editToken'] = edit_token
371
+ body = Utils.convert_body(kwargs.pop('body'), False)
372
+ return self._request(fill_query_params(kwargs.pop('path')),
373
+ data=body, params=kwargs, headers=headers)
374
+
375
+ @sp_endpoint('/mediaPlan/v1/targets/{}', method='GET',
376
+ headers=['Amazon-Advertising-API-Scope',
377
+ 'Amazon-Ads-AccountId',
378
+ 'Amazon-Advertising-API-Manager-Account'])
379
+ def get_target(self, targetId, **kwargs) -> ApiResponse:
380
+ r"""
381
+ Gets one of Targets by id. Read only.
382
+
383
+ Path Parameters
384
+
385
+ - ``targetId`` (str): the id. [required]
386
+
387
+ Keyword Args
388
+
389
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
390
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
391
+ ``'manager_account_id'``; decides which identity header travels.
392
+ Defaults to the scope. [optional]
393
+
394
+ Returns
395
+ ApiResponse with the resource.
396
+ """
397
+ headers = {'Accept': 'application/json'}
398
+ edit_token = kwargs.pop('edit_token', None)
399
+ if edit_token:
400
+ headers['editToken'] = edit_token
401
+ return self._request(fill_query_params(kwargs.pop('path'), targetId),
402
+ params=kwargs, headers=headers)
403
+
404
+ @sp_endpoint('/mediaPlan/v1/targets', method='POST',
405
+ headers=['Amazon-Advertising-API-Scope',
406
+ 'Amazon-Ads-AccountId',
407
+ 'Amazon-Advertising-API-Manager-Account'])
408
+ def create_target(self, **kwargs) -> ApiResponse:
409
+ r"""
410
+ Creates Targets.
411
+
412
+ Request Body [Required]
413
+ The create body the contract publishes for this resource.
414
+
415
+ Keyword Args
416
+
417
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
418
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
419
+ ``'manager_account_id'``; decides which identity header travels.
420
+ Defaults to the scope. [optional]
421
+
422
+ Returns
423
+ ApiResponse with the created resource.
424
+ """
425
+ headers = {'Accept': 'application/json',
426
+ 'Content-Type': 'application/json'}
427
+ edit_token = kwargs.pop('edit_token', None)
428
+ if edit_token:
429
+ headers['editToken'] = edit_token
430
+ body = Utils.convert_body(kwargs.pop('body'), False)
431
+ return self._request(fill_query_params(kwargs.pop('path')),
432
+ data=body, params=kwargs, headers=headers)
433
+
434
+ @sp_endpoint('/mediaPlan/v1/targets', method='PUT',
435
+ headers=['Amazon-Advertising-API-Scope',
436
+ 'Amazon-Ads-AccountId',
437
+ 'Amazon-Advertising-API-Manager-Account'])
438
+ def update_target(self, **kwargs) -> ApiResponse:
439
+ r"""
440
+ Updates Targets.
441
+
442
+ Request Body [Required]
443
+ The update body the contract publishes for this resource.
444
+
445
+ Keyword Args
446
+
447
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
448
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
449
+ ``'manager_account_id'``; decides which identity header travels.
450
+ Defaults to the scope. [optional]
451
+
452
+ Returns
453
+ ApiResponse with the updated resource.
454
+ """
455
+ headers = {'Accept': 'application/json',
456
+ 'Content-Type': 'application/json'}
457
+ edit_token = kwargs.pop('edit_token', None)
458
+ if edit_token:
459
+ headers['editToken'] = edit_token
460
+ body = Utils.convert_body(kwargs.pop('body'), False)
461
+ return self._request(fill_query_params(kwargs.pop('path')),
462
+ data=body, params=kwargs, headers=headers)
463
+
464
+ @sp_endpoint('/mediaPlan/v1/targets/delete', method='POST',
465
+ headers=['Amazon-Advertising-API-Scope',
466
+ 'Amazon-Ads-AccountId',
467
+ 'Amazon-Advertising-API-Manager-Account'])
468
+ def delete_targets(self, **kwargs) -> ApiResponse:
469
+ r"""
470
+ Deletes Targets. It is a ``POST`` to ``/delete``, not an HTTP
471
+ ``DELETE``.
472
+
473
+ Request Body [Required]
474
+ The delete body the contract publishes for this resource.
475
+
476
+ Keyword Args
477
+
478
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
479
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
480
+ ``'manager_account_id'``; decides which identity header travels.
481
+ Defaults to the scope. [optional]
482
+
483
+ Returns
484
+ ApiResponse with the outcome.
485
+ """
486
+ headers = {'Accept': 'application/json',
487
+ 'Content-Type': 'application/json'}
488
+ edit_token = kwargs.pop('edit_token', None)
489
+ if edit_token:
490
+ headers['editToken'] = edit_token
491
+ body = Utils.convert_body(kwargs.pop('body'), False)
492
+ return self._request(fill_query_params(kwargs.pop('path')),
493
+ data=body, params=kwargs, headers=headers)
494
+
495
+ @sp_endpoint('/mediaPlan/v1/marketingGoals/list', method='POST',
496
+ headers=['Amazon-Advertising-API-Scope',
497
+ 'Amazon-Ads-AccountId',
498
+ 'Amazon-Advertising-API-Manager-Account'])
499
+ def list_marketing_goals(self, **kwargs) -> ApiResponse:
500
+ r"""
501
+ Lists Marketing Goals. Read only.
502
+
503
+ Request Body
504
+ The list body the contract publishes for this resource.
505
+
506
+ Keyword Args
507
+
508
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
509
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
510
+ ``'manager_account_id'``; decides which identity header travels.
511
+ Defaults to the scope. [optional]
512
+
513
+ Returns
514
+ ApiResponse with the list.
515
+ """
516
+ headers = {'Accept': 'application/json',
517
+ 'Content-Type': 'application/json'}
518
+ edit_token = kwargs.pop('edit_token', None)
519
+ if edit_token:
520
+ headers['editToken'] = edit_token
521
+ body = Utils.convert_body(kwargs.pop('body'), False)
522
+ return self._request(fill_query_params(kwargs.pop('path')),
523
+ data=body, params=kwargs, headers=headers)
524
+
525
+ @sp_endpoint('/mediaPlan/v1/marketingGoals/{}', method='GET',
526
+ headers=['Amazon-Advertising-API-Scope',
527
+ 'Amazon-Ads-AccountId',
528
+ 'Amazon-Advertising-API-Manager-Account'])
529
+ def get_marketing_goal(self, marketingGoalId, **kwargs) -> ApiResponse:
530
+ r"""
531
+ Gets one of Marketing Goals by id. Read only.
532
+
533
+ Path Parameters
534
+
535
+ - ``marketingGoalId`` (str): the id. [required]
536
+
537
+ Keyword Args
538
+
539
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
540
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
541
+ ``'manager_account_id'``; decides which identity header travels.
542
+ Defaults to the scope. [optional]
543
+
544
+ Returns
545
+ ApiResponse with the resource.
546
+ """
547
+ headers = {'Accept': 'application/json'}
548
+ edit_token = kwargs.pop('edit_token', None)
549
+ if edit_token:
550
+ headers['editToken'] = edit_token
551
+ return self._request(fill_query_params(kwargs.pop('path'), marketingGoalId),
552
+ params=kwargs, headers=headers)
553
+
554
+ @sp_endpoint('/mediaPlan/v1/marketingGoals', method='POST',
555
+ headers=['Amazon-Advertising-API-Scope',
556
+ 'Amazon-Ads-AccountId',
557
+ 'Amazon-Advertising-API-Manager-Account'])
558
+ def create_marketing_goal(self, **kwargs) -> ApiResponse:
559
+ r"""
560
+ Creates Marketing Goals.
561
+
562
+ Request Body [Required]
563
+ The create body the contract publishes for this resource.
564
+
565
+ Keyword Args
566
+
567
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
568
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
569
+ ``'manager_account_id'``; decides which identity header travels.
570
+ Defaults to the scope. [optional]
571
+
572
+ Returns
573
+ ApiResponse with the created resource.
574
+ """
575
+ headers = {'Accept': 'application/json',
576
+ 'Content-Type': 'application/json'}
577
+ edit_token = kwargs.pop('edit_token', None)
578
+ if edit_token:
579
+ headers['editToken'] = edit_token
580
+ body = Utils.convert_body(kwargs.pop('body'), False)
581
+ return self._request(fill_query_params(kwargs.pop('path')),
582
+ data=body, params=kwargs, headers=headers)
583
+
584
+ @sp_endpoint('/mediaPlan/v1/marketingGoals', method='PUT',
585
+ headers=['Amazon-Advertising-API-Scope',
586
+ 'Amazon-Ads-AccountId',
587
+ 'Amazon-Advertising-API-Manager-Account'])
588
+ def update_marketing_goal(self, **kwargs) -> ApiResponse:
589
+ r"""
590
+ Updates Marketing Goals.
591
+
592
+ Request Body [Required]
593
+ The update body the contract publishes for this resource.
594
+
595
+ Keyword Args
596
+
597
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
598
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
599
+ ``'manager_account_id'``; decides which identity header travels.
600
+ Defaults to the scope. [optional]
601
+
602
+ Returns
603
+ ApiResponse with the updated resource.
604
+ """
605
+ headers = {'Accept': 'application/json',
606
+ 'Content-Type': 'application/json'}
607
+ edit_token = kwargs.pop('edit_token', None)
608
+ if edit_token:
609
+ headers['editToken'] = edit_token
610
+ body = Utils.convert_body(kwargs.pop('body'), False)
611
+ return self._request(fill_query_params(kwargs.pop('path')),
612
+ data=body, params=kwargs, headers=headers)
613
+
614
+ @sp_endpoint('/mediaPlan/v1/marketingGoals/delete', method='POST',
615
+ headers=['Amazon-Advertising-API-Scope',
616
+ 'Amazon-Ads-AccountId',
617
+ 'Amazon-Advertising-API-Manager-Account'])
618
+ def delete_marketing_goals(self, **kwargs) -> ApiResponse:
619
+ r"""
620
+ Deletes Marketing Goals. It is a ``POST`` to ``/delete``, not an HTTP
621
+ ``DELETE``.
622
+
623
+ Request Body [Required]
624
+ The delete body the contract publishes for this resource.
625
+
626
+ Keyword Args
627
+
628
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
629
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
630
+ ``'manager_account_id'``; decides which identity header travels.
631
+ Defaults to the scope. [optional]
632
+
633
+ Returns
634
+ ApiResponse with the outcome.
635
+ """
636
+ headers = {'Accept': 'application/json',
637
+ 'Content-Type': 'application/json'}
638
+ edit_token = kwargs.pop('edit_token', None)
639
+ if edit_token:
640
+ headers['editToken'] = edit_token
641
+ body = Utils.convert_body(kwargs.pop('body'), False)
642
+ return self._request(fill_query_params(kwargs.pop('path')),
643
+ data=body, params=kwargs, headers=headers)
644
+
645
+ @sp_endpoint('/mediaPlan/v1/audienceOpportunities/list', method='POST',
646
+ headers=['Amazon-Advertising-API-Scope',
647
+ 'Amazon-Ads-AccountId',
648
+ 'Amazon-Advertising-API-Manager-Account'])
649
+ def list_audience_opportunities(self, **kwargs) -> ApiResponse:
650
+ r"""
651
+ Lists Audience Opportunities. Read only.
652
+
653
+ Request Body
654
+ The list body the contract publishes for this resource.
655
+
656
+ Keyword Args
657
+
658
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
659
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
660
+ ``'manager_account_id'``; decides which identity header travels.
661
+ Defaults to the scope. [optional]
662
+
663
+ Returns
664
+ ApiResponse with the list.
665
+ """
666
+ headers = {'Accept': 'application/json',
667
+ 'Content-Type': 'application/json'}
668
+ edit_token = kwargs.pop('edit_token', None)
669
+ if edit_token:
670
+ headers['editToken'] = edit_token
671
+ body = Utils.convert_body(kwargs.pop('body'), False)
672
+ return self._request(fill_query_params(kwargs.pop('path')),
673
+ data=body, params=kwargs, headers=headers)
674
+
675
+ @sp_endpoint('/mediaPlan/v1/audienceOpportunities/{}', method='GET',
676
+ headers=['Amazon-Advertising-API-Scope',
677
+ 'Amazon-Ads-AccountId',
678
+ 'Amazon-Advertising-API-Manager-Account'])
679
+ def get_audience_opportunity(self, audienceOpportunityId, **kwargs) -> ApiResponse:
680
+ r"""
681
+ Gets one of Audience Opportunities by id. Read only.
682
+
683
+ Path Parameters
684
+
685
+ - ``audienceOpportunityId`` (str): the id. [required]
686
+
687
+ Keyword Args
688
+
689
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
690
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
691
+ ``'manager_account_id'``; decides which identity header travels.
692
+ Defaults to the scope. [optional]
693
+
694
+ Returns
695
+ ApiResponse with the resource.
696
+ """
697
+ headers = {'Accept': 'application/json'}
698
+ edit_token = kwargs.pop('edit_token', None)
699
+ if edit_token:
700
+ headers['editToken'] = edit_token
701
+ return self._request(fill_query_params(kwargs.pop('path'), audienceOpportunityId),
702
+ params=kwargs, headers=headers)
703
+
704
+ @sp_endpoint('/mediaPlan/v1/audienceOpportunities', method='POST',
705
+ headers=['Amazon-Advertising-API-Scope',
706
+ 'Amazon-Ads-AccountId',
707
+ 'Amazon-Advertising-API-Manager-Account'])
708
+ def create_audience_opportunity(self, **kwargs) -> ApiResponse:
709
+ r"""
710
+ Creates Audience Opportunities.
711
+
712
+ Request Body [Required]
713
+ The create body the contract publishes for this resource.
714
+
715
+ Keyword Args
716
+
717
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
718
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
719
+ ``'manager_account_id'``; decides which identity header travels.
720
+ Defaults to the scope. [optional]
721
+
722
+ Returns
723
+ ApiResponse with the created resource.
724
+ """
725
+ headers = {'Accept': 'application/json',
726
+ 'Content-Type': 'application/json'}
727
+ edit_token = kwargs.pop('edit_token', None)
728
+ if edit_token:
729
+ headers['editToken'] = edit_token
730
+ body = Utils.convert_body(kwargs.pop('body'), False)
731
+ return self._request(fill_query_params(kwargs.pop('path')),
732
+ data=body, params=kwargs, headers=headers)
733
+
734
+ @sp_endpoint('/mediaPlan/v1/audienceOpportunities', method='PUT',
735
+ headers=['Amazon-Advertising-API-Scope',
736
+ 'Amazon-Ads-AccountId',
737
+ 'Amazon-Advertising-API-Manager-Account'])
738
+ def update_audience_opportunity(self, **kwargs) -> ApiResponse:
739
+ r"""
740
+ Updates Audience Opportunities.
741
+
742
+ Request Body [Required]
743
+ The update body the contract publishes for this resource.
744
+
745
+ Keyword Args
746
+
747
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
748
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
749
+ ``'manager_account_id'``; decides which identity header travels.
750
+ Defaults to the scope. [optional]
751
+
752
+ Returns
753
+ ApiResponse with the updated resource.
754
+ """
755
+ headers = {'Accept': 'application/json',
756
+ 'Content-Type': 'application/json'}
757
+ edit_token = kwargs.pop('edit_token', None)
758
+ if edit_token:
759
+ headers['editToken'] = edit_token
760
+ body = Utils.convert_body(kwargs.pop('body'), False)
761
+ return self._request(fill_query_params(kwargs.pop('path')),
762
+ data=body, params=kwargs, headers=headers)
763
+
764
+ @sp_endpoint('/mediaPlan/v1/audienceOpportunities/delete', method='POST',
765
+ headers=['Amazon-Advertising-API-Scope',
766
+ 'Amazon-Ads-AccountId',
767
+ 'Amazon-Advertising-API-Manager-Account'])
768
+ def delete_audience_opportunities(self, **kwargs) -> ApiResponse:
769
+ r"""
770
+ Deletes Audience Opportunities. It is a ``POST`` to ``/delete``, not an HTTP
771
+ ``DELETE``.
772
+
773
+ Request Body [Required]
774
+ The delete body the contract publishes for this resource.
775
+
776
+ Keyword Args
777
+
778
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
779
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
780
+ ``'manager_account_id'``; decides which identity header travels.
781
+ Defaults to the scope. [optional]
782
+
783
+ Returns
784
+ ApiResponse with the outcome.
785
+ """
786
+ headers = {'Accept': 'application/json',
787
+ 'Content-Type': 'application/json'}
788
+ edit_token = kwargs.pop('edit_token', None)
789
+ if edit_token:
790
+ headers['editToken'] = edit_token
791
+ body = Utils.convert_body(kwargs.pop('body'), False)
792
+ return self._request(fill_query_params(kwargs.pop('path')),
793
+ data=body, params=kwargs, headers=headers)
794
+
795
+ @sp_endpoint('/mediaPlan/v1/budgetAllocations/list', method='POST',
796
+ headers=['Amazon-Advertising-API-Scope',
797
+ 'Amazon-Ads-AccountId',
798
+ 'Amazon-Advertising-API-Manager-Account'])
799
+ def list_budget_allocations(self, **kwargs) -> ApiResponse:
800
+ r"""
801
+ Lists Budget Allocations. Read only.
802
+
803
+ Request Body
804
+ The list body the contract publishes for this resource.
805
+
806
+ Keyword Args
807
+
808
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
809
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
810
+ ``'manager_account_id'``; decides which identity header travels.
811
+ Defaults to the scope. [optional]
812
+
813
+ Returns
814
+ ApiResponse with the list.
815
+ """
816
+ headers = {'Accept': 'application/json',
817
+ 'Content-Type': 'application/json'}
818
+ edit_token = kwargs.pop('edit_token', None)
819
+ if edit_token:
820
+ headers['editToken'] = edit_token
821
+ body = Utils.convert_body(kwargs.pop('body'), False)
822
+ return self._request(fill_query_params(kwargs.pop('path')),
823
+ data=body, params=kwargs, headers=headers)
824
+
825
+ @sp_endpoint('/mediaPlan/v1/budgetAllocations/{}', method='GET',
826
+ headers=['Amazon-Advertising-API-Scope',
827
+ 'Amazon-Ads-AccountId',
828
+ 'Amazon-Advertising-API-Manager-Account'])
829
+ def get_budget_allocation(self, budgetAllocationId, **kwargs) -> ApiResponse:
830
+ r"""
831
+ Gets one of Budget Allocations by id. Read only.
832
+
833
+ Path Parameters
834
+
835
+ - ``budgetAllocationId`` (str): the id. [required]
836
+
837
+ Keyword Args
838
+
839
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
840
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
841
+ ``'manager_account_id'``; decides which identity header travels.
842
+ Defaults to the scope. [optional]
843
+
844
+ Returns
845
+ ApiResponse with the resource.
846
+ """
847
+ headers = {'Accept': 'application/json'}
848
+ edit_token = kwargs.pop('edit_token', None)
849
+ if edit_token:
850
+ headers['editToken'] = edit_token
851
+ return self._request(fill_query_params(kwargs.pop('path'), budgetAllocationId),
852
+ params=kwargs, headers=headers)
853
+
854
+ @sp_endpoint('/mediaPlan/v1/budgetAllocations', method='POST',
855
+ headers=['Amazon-Advertising-API-Scope',
856
+ 'Amazon-Ads-AccountId',
857
+ 'Amazon-Advertising-API-Manager-Account'])
858
+ def create_budget_allocation(self, **kwargs) -> ApiResponse:
859
+ r"""
860
+ Creates Budget Allocations.
861
+
862
+ Request Body [Required]
863
+ The create body the contract publishes for this resource.
864
+
865
+ Keyword Args
866
+
867
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
868
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
869
+ ``'manager_account_id'``; decides which identity header travels.
870
+ Defaults to the scope. [optional]
871
+
872
+ Returns
873
+ ApiResponse with the created resource.
874
+ """
875
+ headers = {'Accept': 'application/json',
876
+ 'Content-Type': 'application/json'}
877
+ edit_token = kwargs.pop('edit_token', None)
878
+ if edit_token:
879
+ headers['editToken'] = edit_token
880
+ body = Utils.convert_body(kwargs.pop('body'), False)
881
+ return self._request(fill_query_params(kwargs.pop('path')),
882
+ data=body, params=kwargs, headers=headers)
883
+
884
+ @sp_endpoint('/mediaPlan/v1/budgetAllocations', method='PUT',
885
+ headers=['Amazon-Advertising-API-Scope',
886
+ 'Amazon-Ads-AccountId',
887
+ 'Amazon-Advertising-API-Manager-Account'])
888
+ def update_budget_allocation(self, **kwargs) -> ApiResponse:
889
+ r"""
890
+ Updates Budget Allocations.
891
+
892
+ Request Body [Required]
893
+ The update body the contract publishes for this resource.
894
+
895
+ Keyword Args
896
+
897
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
898
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
899
+ ``'manager_account_id'``; decides which identity header travels.
900
+ Defaults to the scope. [optional]
901
+
902
+ Returns
903
+ ApiResponse with the updated resource.
904
+ """
905
+ headers = {'Accept': 'application/json',
906
+ 'Content-Type': 'application/json'}
907
+ edit_token = kwargs.pop('edit_token', None)
908
+ if edit_token:
909
+ headers['editToken'] = edit_token
910
+ body = Utils.convert_body(kwargs.pop('body'), False)
911
+ return self._request(fill_query_params(kwargs.pop('path')),
912
+ data=body, params=kwargs, headers=headers)
913
+
914
+ @sp_endpoint('/mediaPlan/v1/budgetAllocations/delete', method='POST',
915
+ headers=['Amazon-Advertising-API-Scope',
916
+ 'Amazon-Ads-AccountId',
917
+ 'Amazon-Advertising-API-Manager-Account'])
918
+ def delete_budget_allocations(self, **kwargs) -> ApiResponse:
919
+ r"""
920
+ Deletes Budget Allocations. It is a ``POST`` to ``/delete``, not an HTTP
921
+ ``DELETE``.
922
+
923
+ Request Body [Required]
924
+ The delete body the contract publishes for this resource.
925
+
926
+ Keyword Args
927
+
928
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
929
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
930
+ ``'manager_account_id'``; decides which identity header travels.
931
+ Defaults to the scope. [optional]
932
+
933
+ Returns
934
+ ApiResponse with the outcome.
935
+ """
936
+ headers = {'Accept': 'application/json',
937
+ 'Content-Type': 'application/json'}
938
+ edit_token = kwargs.pop('edit_token', None)
939
+ if edit_token:
940
+ headers['editToken'] = edit_token
941
+ body = Utils.convert_body(kwargs.pop('body'), False)
942
+ return self._request(fill_query_params(kwargs.pop('path')),
943
+ data=body, params=kwargs, headers=headers)
944
+
945
+ @sp_endpoint('/mediaPlan/v1/audienceSizes/list', method='POST',
946
+ headers=['Amazon-Advertising-API-Scope',
947
+ 'Amazon-Ads-AccountId',
948
+ 'Amazon-Advertising-API-Manager-Account'])
949
+ def list_audience_sizes(self, **kwargs) -> ApiResponse:
950
+ r"""
951
+ Lists Audience Sizes. Read only.
952
+
953
+ Request Body
954
+ The list body the contract publishes for this resource.
955
+
956
+ Keyword Args
957
+
958
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
959
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
960
+ ``'manager_account_id'``; decides which identity header travels.
961
+ Defaults to the scope. [optional]
962
+
963
+ Returns
964
+ ApiResponse with the list.
965
+ """
966
+ headers = {'Accept': 'application/json',
967
+ 'Content-Type': 'application/json'}
968
+ edit_token = kwargs.pop('edit_token', None)
969
+ if edit_token:
970
+ headers['editToken'] = edit_token
971
+ body = Utils.convert_body(kwargs.pop('body'), False)
972
+ return self._request(fill_query_params(kwargs.pop('path')),
973
+ data=body, params=kwargs, headers=headers)
974
+
975
+ @sp_endpoint('/mediaPlan/v1/audienceSizes/{}', method='GET',
976
+ headers=['Amazon-Advertising-API-Scope',
977
+ 'Amazon-Ads-AccountId',
978
+ 'Amazon-Advertising-API-Manager-Account'])
979
+ def get_audience_size(self, audienceSizeId, **kwargs) -> ApiResponse:
980
+ r"""
981
+ Gets one of Audience Sizes by id. Read only.
982
+
983
+ Path Parameters
984
+
985
+ - ``audienceSizeId`` (str): the id. [required]
986
+
987
+ Keyword Args
988
+
989
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
990
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
991
+ ``'manager_account_id'``; decides which identity header travels.
992
+ Defaults to the scope. [optional]
993
+
994
+ Returns
995
+ ApiResponse with the resource.
996
+ """
997
+ headers = {'Accept': 'application/json'}
998
+ edit_token = kwargs.pop('edit_token', None)
999
+ if edit_token:
1000
+ headers['editToken'] = edit_token
1001
+ return self._request(fill_query_params(kwargs.pop('path'), audienceSizeId),
1002
+ params=kwargs, headers=headers)
1003
+
1004
+ @sp_endpoint('/mediaPlan/v1/behavioralInsights/list', method='POST',
1005
+ headers=['Amazon-Advertising-API-Scope',
1006
+ 'Amazon-Ads-AccountId',
1007
+ 'Amazon-Advertising-API-Manager-Account'])
1008
+ def list_behavioral_insights(self, **kwargs) -> ApiResponse:
1009
+ r"""
1010
+ Lists Behavioral Insights. Read only.
1011
+
1012
+ Request Body
1013
+ The list body the contract publishes for this resource.
1014
+
1015
+ Keyword Args
1016
+
1017
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1018
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1019
+ ``'manager_account_id'``; decides which identity header travels.
1020
+ Defaults to the scope. [optional]
1021
+
1022
+ Returns
1023
+ ApiResponse with the list.
1024
+ """
1025
+ headers = {'Accept': 'application/json',
1026
+ 'Content-Type': 'application/json'}
1027
+ edit_token = kwargs.pop('edit_token', None)
1028
+ if edit_token:
1029
+ headers['editToken'] = edit_token
1030
+ body = Utils.convert_body(kwargs.pop('body'), False)
1031
+ return self._request(fill_query_params(kwargs.pop('path')),
1032
+ data=body, params=kwargs, headers=headers)
1033
+
1034
+ @sp_endpoint('/mediaPlan/v1/behavioralInsights/{}', method='GET',
1035
+ headers=['Amazon-Advertising-API-Scope',
1036
+ 'Amazon-Ads-AccountId',
1037
+ 'Amazon-Advertising-API-Manager-Account'])
1038
+ def get_behavioral_insight(self, behavioralInsightId, **kwargs) -> ApiResponse:
1039
+ r"""
1040
+ Gets one of Behavioral Insights by id. Read only.
1041
+
1042
+ Path Parameters
1043
+
1044
+ - ``behavioralInsightId`` (str): the id. [required]
1045
+
1046
+ Keyword Args
1047
+
1048
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1049
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1050
+ ``'manager_account_id'``; decides which identity header travels.
1051
+ Defaults to the scope. [optional]
1052
+
1053
+ Returns
1054
+ ApiResponse with the resource.
1055
+ """
1056
+ headers = {'Accept': 'application/json'}
1057
+ edit_token = kwargs.pop('edit_token', None)
1058
+ if edit_token:
1059
+ headers['editToken'] = edit_token
1060
+ return self._request(fill_query_params(kwargs.pop('path'), behavioralInsightId),
1061
+ params=kwargs, headers=headers)
1062
+
1063
+ @sp_endpoint('/mediaPlan/v1/demographicInsights/list', method='POST',
1064
+ headers=['Amazon-Advertising-API-Scope',
1065
+ 'Amazon-Ads-AccountId',
1066
+ 'Amazon-Advertising-API-Manager-Account'])
1067
+ def list_demographic_insights(self, **kwargs) -> ApiResponse:
1068
+ r"""
1069
+ Lists Demographic Insights. Read only.
1070
+
1071
+ Request Body
1072
+ The list body the contract publishes for this resource.
1073
+
1074
+ Keyword Args
1075
+
1076
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1077
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1078
+ ``'manager_account_id'``; decides which identity header travels.
1079
+ Defaults to the scope. [optional]
1080
+
1081
+ Returns
1082
+ ApiResponse with the list.
1083
+ """
1084
+ headers = {'Accept': 'application/json',
1085
+ 'Content-Type': 'application/json'}
1086
+ edit_token = kwargs.pop('edit_token', None)
1087
+ if edit_token:
1088
+ headers['editToken'] = edit_token
1089
+ body = Utils.convert_body(kwargs.pop('body'), False)
1090
+ return self._request(fill_query_params(kwargs.pop('path')),
1091
+ data=body, params=kwargs, headers=headers)
1092
+
1093
+ @sp_endpoint('/mediaPlan/v1/demographicInsights/{}', method='GET',
1094
+ headers=['Amazon-Advertising-API-Scope',
1095
+ 'Amazon-Ads-AccountId',
1096
+ 'Amazon-Advertising-API-Manager-Account'])
1097
+ def get_demographic_insight(self, demographicInsightId, **kwargs) -> ApiResponse:
1098
+ r"""
1099
+ Gets one of Demographic Insights by id. Read only.
1100
+
1101
+ Path Parameters
1102
+
1103
+ - ``demographicInsightId`` (str): the id. [required]
1104
+
1105
+ Keyword Args
1106
+
1107
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1108
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1109
+ ``'manager_account_id'``; decides which identity header travels.
1110
+ Defaults to the scope. [optional]
1111
+
1112
+ Returns
1113
+ ApiResponse with the resource.
1114
+ """
1115
+ headers = {'Accept': 'application/json'}
1116
+ edit_token = kwargs.pop('edit_token', None)
1117
+ if edit_token:
1118
+ headers['editToken'] = edit_token
1119
+ return self._request(fill_query_params(kwargs.pop('path'), demographicInsightId),
1120
+ params=kwargs, headers=headers)
1121
+
1122
+ @sp_endpoint('/mediaPlan/v1/trafficInsights/list', method='POST',
1123
+ headers=['Amazon-Advertising-API-Scope',
1124
+ 'Amazon-Ads-AccountId',
1125
+ 'Amazon-Advertising-API-Manager-Account'])
1126
+ def list_traffic_insights(self, **kwargs) -> ApiResponse:
1127
+ r"""
1128
+ Lists Traffic Insights. Read only.
1129
+
1130
+ Request Body
1131
+ The list body the contract publishes for this resource.
1132
+
1133
+ Keyword Args
1134
+
1135
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1136
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1137
+ ``'manager_account_id'``; decides which identity header travels.
1138
+ Defaults to the scope. [optional]
1139
+
1140
+ Returns
1141
+ ApiResponse with the list.
1142
+ """
1143
+ headers = {'Accept': 'application/json',
1144
+ 'Content-Type': 'application/json'}
1145
+ edit_token = kwargs.pop('edit_token', None)
1146
+ if edit_token:
1147
+ headers['editToken'] = edit_token
1148
+ body = Utils.convert_body(kwargs.pop('body'), False)
1149
+ return self._request(fill_query_params(kwargs.pop('path')),
1150
+ data=body, params=kwargs, headers=headers)
1151
+
1152
+ @sp_endpoint('/mediaPlan/v1/trafficInsights/{}', method='GET',
1153
+ headers=['Amazon-Advertising-API-Scope',
1154
+ 'Amazon-Ads-AccountId',
1155
+ 'Amazon-Advertising-API-Manager-Account'])
1156
+ def get_traffic_insight(self, trafficInsightId, **kwargs) -> ApiResponse:
1157
+ r"""
1158
+ Gets one of Traffic Insights by id. Read only.
1159
+
1160
+ Path Parameters
1161
+
1162
+ - ``trafficInsightId`` (str): the id. [required]
1163
+
1164
+ Keyword Args
1165
+
1166
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1167
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1168
+ ``'manager_account_id'``; decides which identity header travels.
1169
+ Defaults to the scope. [optional]
1170
+
1171
+ Returns
1172
+ ApiResponse with the resource.
1173
+ """
1174
+ headers = {'Accept': 'application/json'}
1175
+ edit_token = kwargs.pop('edit_token', None)
1176
+ if edit_token:
1177
+ headers['editToken'] = edit_token
1178
+ return self._request(fill_query_params(kwargs.pop('path'), trafficInsightId),
1179
+ params=kwargs, headers=headers)
1180
+
1181
+ @sp_endpoint('/mediaPlan/v1/performanceForecasts/list', method='POST',
1182
+ headers=['Amazon-Advertising-API-Scope',
1183
+ 'Amazon-Ads-AccountId',
1184
+ 'Amazon-Advertising-API-Manager-Account'])
1185
+ def list_performance_forecasts(self, **kwargs) -> ApiResponse:
1186
+ r"""
1187
+ Lists Performance Forecasts. Read only.
1188
+
1189
+ Request Body
1190
+ The list body the contract publishes for this resource.
1191
+
1192
+ Keyword Args
1193
+
1194
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1195
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1196
+ ``'manager_account_id'``; decides which identity header travels.
1197
+ Defaults to the scope. [optional]
1198
+
1199
+ Returns
1200
+ ApiResponse with the list.
1201
+ """
1202
+ headers = {'Accept': 'application/json',
1203
+ 'Content-Type': 'application/json'}
1204
+ edit_token = kwargs.pop('edit_token', None)
1205
+ if edit_token:
1206
+ headers['editToken'] = edit_token
1207
+ body = Utils.convert_body(kwargs.pop('body'), False)
1208
+ return self._request(fill_query_params(kwargs.pop('path')),
1209
+ data=body, params=kwargs, headers=headers)
1210
+
1211
+ @sp_endpoint('/mediaPlan/v1/performanceForecasts/{}', method='GET',
1212
+ headers=['Amazon-Advertising-API-Scope',
1213
+ 'Amazon-Ads-AccountId',
1214
+ 'Amazon-Advertising-API-Manager-Account'])
1215
+ def get_performance_forecast(self, performanceForecastId, **kwargs) -> ApiResponse:
1216
+ r"""
1217
+ Gets one of Performance Forecasts by id. Read only.
1218
+
1219
+ Path Parameters
1220
+
1221
+ - ``performanceForecastId`` (str): the id. [required]
1222
+
1223
+ Keyword Args
1224
+
1225
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1226
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1227
+ ``'manager_account_id'``; decides which identity header travels.
1228
+ Defaults to the scope. [optional]
1229
+
1230
+ Returns
1231
+ ApiResponse with the resource.
1232
+ """
1233
+ headers = {'Accept': 'application/json'}
1234
+ edit_token = kwargs.pop('edit_token', None)
1235
+ if edit_token:
1236
+ headers['editToken'] = edit_token
1237
+ return self._request(fill_query_params(kwargs.pop('path'), performanceForecastId),
1238
+ params=kwargs, headers=headers)
1239
+
1240
+ @sp_endpoint('/mediaPlan/v1/exports/mediaPlans', method='POST',
1241
+ headers=['Amazon-Advertising-API-Scope',
1242
+ 'Amazon-Ads-AccountId',
1243
+ 'Amazon-Advertising-API-Manager-Account'])
1244
+ def export_media_plans(self, **kwargs) -> ApiResponse:
1245
+ r"""
1246
+ Asks for an export of media plans as a file.
1247
+
1248
+ Request Body [Required]
1249
+ The export body the contract publishes.
1250
+
1251
+ Keyword Args
1252
+
1253
+ - ``edit_token`` (str): value for the ``editToken`` header. [optional]
1254
+ - ``selector`` (str): ``'profile_id'``, ``'account_id'`` or
1255
+ ``'manager_account_id'``; decides which identity header travels.
1256
+ Defaults to the scope. [optional]
1257
+
1258
+ Returns
1259
+ ApiResponse with the export job.
1260
+ """
1261
+ headers = {'Accept': 'application/json',
1262
+ 'Content-Type': 'application/json'}
1263
+ edit_token = kwargs.pop('edit_token', None)
1264
+ if edit_token:
1265
+ headers['editToken'] = edit_token
1266
+ body = Utils.convert_body(kwargs.pop('body'), False)
1267
+ return self._request(fill_query_params(kwargs.pop('path')),
1268
+ data=body, params=kwargs, headers=headers)