python-amazon-ad-api 2.3.1__py3-none-any.whl → 2.4.0__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.
Files changed (38) hide show
  1. ad_api/api/__init__.py +62 -0
  2. ad_api/api/dsp_ad_group_and_campaign.py +139 -0
  3. ad_api/api/dsp_audience_create.py +53 -0
  4. ad_api/api/dsp_bid_adjustments.py +193 -0
  5. ad_api/api/dsp_campaign_flights.py +119 -0
  6. ad_api/api/dsp_campaign_insights.py +59 -0
  7. ad_api/api/dsp_combined_audiences.py +83 -0
  8. ad_api/api/dsp_conversion_tracking_products.py +92 -0
  9. ad_api/api/dsp_conversions.py +442 -0
  10. ad_api/api/dsp_creatives.py +114 -0
  11. ad_api/api/dsp_deal_permissions.py +170 -0
  12. ad_api/api/dsp_deal_proposals.py +440 -0
  13. ad_api/api/dsp_deals.py +204 -0
  14. ad_api/api/dsp_deals_management.py +66 -0
  15. ad_api/api/dsp_discovery_advertised_product_categories.py +35 -0
  16. ad_api/api/dsp_discovery_apps.py +36 -0
  17. ad_api/api/dsp_discovery_domain_lists.py +36 -0
  18. ad_api/api/dsp_discovery_geo_locations.py +42 -0
  19. ad_api/api/dsp_discovery_iab_content.py +37 -0
  20. ad_api/api/dsp_discovery_inventory_source_exchanges.py +36 -0
  21. ad_api/api/dsp_discovery_products.py +102 -0
  22. ad_api/api/dsp_discovery_third_party_target_segments.py +36 -0
  23. ad_api/api/dsp_frequency_associations.py +138 -0
  24. ad_api/api/dsp_frequency_groups.py +112 -0
  25. ad_api/api/dsp_frequency_insights.py +85 -0
  26. ad_api/api/dsp_guidance.py +111 -0
  27. ad_api/api/dsp_inherited_settings.py +133 -0
  28. ad_api/api/dsp_inventory_groups.py +209 -0
  29. ad_api/api/dsp_measurement.py +693 -0
  30. ad_api/api/dsp_seats.py +43 -0
  31. ad_api/api/dsp_target_kpi_recommendations.py +44 -0
  32. ad_api/api/dsp_targeting.py +98 -0
  33. ad_api/version.py +1 -1
  34. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/METADATA +1 -1
  35. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/RECORD +38 -7
  36. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/WHEEL +0 -0
  37. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/licenses/LICENSE +0 -0
  38. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,83 @@
1
+ """Combined audiences /dsp/audiences/combinedAudiences.
2
+
3
+ Contract: Combined Audience API 3.0, the *Combined audiences* entry at the first
4
+ level of *Amazon DSP*. Two routes: one creates a combined audience and one reads
5
+ it back.
6
+
7
+ The media types do not match each other. The create takes
8
+ ``application/vnd.createcombinedaudiencerequestbody.v<n>+json`` and answers
9
+ ``application/vnd.createcombinedaudienceresponse.v<n>+json``; the read answers
10
+ ``application/vnd.getcombinedaudiencedetailsresponse.v<n>+json``. Each method
11
+ builds its own from a version argument.
12
+
13
+ Headers: ``Amazon-Advertising-API-ClientId`` and
14
+ ``Amazon-Advertising-API-Scope``, both required, and only those. The advertiser
15
+ goes in the query string as ``advertiserId``.
16
+ """
17
+
18
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
19
+
20
+
21
+ class DspCombinedAudiences(Client):
22
+ r"""Combined audiences - /dsp/audiences/combinedAudiences
23
+
24
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-combined-audiences
25
+ """
26
+
27
+ @sp_endpoint('/dsp/audiences/combinedAudiences', method='POST',
28
+ headers=['Amazon-Advertising-API-Scope'])
29
+ def create_combined_audience(self, version: str = "1", **kwargs) -> ApiResponse:
30
+ r"""
31
+ Creates a combined audience from the ones it is built on.
32
+
33
+ Query [Required]
34
+
35
+ - ``advertiserId`` (str): the DSP advertiser. [required]
36
+
37
+ Request Body [Required]
38
+ The body the contract publishes for a combined audience: its name
39
+ and the audiences or expressions it combines.
40
+
41
+ Keyword Args
42
+
43
+ - ``version`` (str): media type version, used for the body and for the
44
+ answer. Defaults to ``1``. [optional]
45
+
46
+ Returns
47
+ ApiResponse, ``200``, with the created audience.
48
+ """
49
+ request_type = ('application/vnd.createcombinedaudiencerequestbody.v'
50
+ + version + '+json')
51
+ accept = ('application/vnd.createcombinedaudienceresponse.v'
52
+ + version + '+json')
53
+ headers = {'Accept': accept, 'Content-Type': request_type}
54
+ body = Utils.convert_body(kwargs.pop('body'), False)
55
+ return self._request(fill_query_params(kwargs.pop('path')),
56
+ data=body, params=kwargs, headers=headers)
57
+
58
+ @sp_endpoint('/dsp/audiences/combinedAudiences/{}', method='GET',
59
+ headers=['Amazon-Advertising-API-Scope'])
60
+ def get_combined_audience(self, audienceId, version: str = "1", **kwargs) -> ApiResponse:
61
+ r"""
62
+ Reads one combined audience. Read only.
63
+
64
+ Path Parameters
65
+
66
+ - ``audienceId`` (str): the combined audience. [required]
67
+
68
+ Query [Required]
69
+
70
+ - ``advertiserId`` (str): the DSP advertiser. [required]
71
+
72
+ Keyword Args
73
+
74
+ - ``version`` (str): media type version. Defaults to ``1``. [optional]
75
+
76
+ Returns
77
+ ApiResponse, ``200``, with the audiences the combination holds.
78
+ """
79
+ accept = ('application/vnd.getcombinedaudiencedetailsresponse.v'
80
+ + version + '+json')
81
+ headers = {'Accept': accept}
82
+ return self._request(fill_query_params(kwargs.pop('path'), audienceId),
83
+ params=kwargs, headers=headers)
@@ -0,0 +1,92 @@
1
+ """Conversion Tracking - Products /dsp/v1/campaigns/{campaignId}/conversionTracking.
2
+
3
+ Contract: Campaign Conversion Tracking - Products - V1 3.0, a child of
4
+ *Campaign management*. Which products a campaign conversion tracks, always
5
+ scoped to one campaign through the path.
6
+
7
+ Plain ``application/json``, no version. ``Amazon-Advertising-API-ClientId`` and
8
+ ``Amazon-Ads-AccountId`` are required, ``Scope`` is optional.
9
+
10
+ The read answers 200; both writes answer **207**, one result per product.
11
+ """
12
+
13
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
14
+
15
+
16
+ class DspConversionTrackingProducts(Client):
17
+ r"""Conversion Tracking - Products - /dsp/v1/campaigns/{campaignId}/conversionTracking
18
+
19
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-ad-group-cvrtracking-products
20
+ """
21
+
22
+ @sp_endpoint('/dsp/v1/campaigns/{}/conversionTracking/products', method='GET',
23
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
24
+ def list_conversion_tracking_products(self, campaignId, **kwargs) -> ApiResponse:
25
+ r"""
26
+ Lists the products a campaign conversion tracks. Read only.
27
+
28
+ Path Parameters
29
+
30
+ - ``campaignId`` (str): the campaign. [required]
31
+
32
+ Query Params
33
+
34
+ - ``maxResults``, ``nextToken``. [optional]
35
+
36
+ Keyword Args
37
+
38
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
39
+
40
+ Returns
41
+ ApiResponse, ``200``, with the products and the pagination.
42
+ """
43
+ headers = {'Accept': 'application/json'}
44
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
45
+ params=kwargs, headers=headers)
46
+
47
+ @sp_endpoint('/dsp/v1/campaigns/{}/conversionTracking/products', method='POST',
48
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
49
+ def create_conversion_tracking_products(self, campaignId, **kwargs) -> ApiResponse:
50
+ r"""
51
+ Adds products to a campaign conversion.
52
+
53
+ Path Parameters
54
+
55
+ - ``campaignId`` (str): the campaign. [required]
56
+
57
+ Keyword Args
58
+
59
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
60
+
61
+ Returns
62
+ ApiResponse, **207** multi-status, one per product.
63
+ """
64
+ headers = {'Accept': 'application/json'}
65
+ headers['Content-Type'] = 'application/json'
66
+ body = Utils.convert_body(kwargs.pop('body'), False)
67
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
68
+ data=body, params=kwargs, headers=headers)
69
+
70
+ @sp_endpoint('/dsp/v1/campaigns/{}/conversionTracking/products/delete', method='POST',
71
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
72
+ def delete_conversion_tracking_products(self, campaignId, **kwargs) -> ApiResponse:
73
+ r"""
74
+ Removes products from a campaign conversion. A POST with ``/delete``,
75
+ because the list travels in the body.
76
+
77
+ Path Parameters
78
+
79
+ - ``campaignId`` (str): the campaign. [required]
80
+
81
+ Keyword Args
82
+
83
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
84
+
85
+ Returns
86
+ ApiResponse, **207** multi-status.
87
+ """
88
+ headers = {'Accept': 'application/json'}
89
+ headers['Content-Type'] = 'application/json'
90
+ body = Utils.convert_body(kwargs.pop('body'), False)
91
+ return self._request(fill_query_params(kwargs.pop('path'), campaignId),
92
+ data=body, params=kwargs, headers=headers)
@@ -0,0 +1,442 @@
1
+ """Conversions /accounts/{accountId}/dsp.
2
+
3
+ Contract: Conversions API 3.0, the *Conversions* entry at the first level of
4
+ *Amazon DSP*. Everything lives under ``/accounts/{accountId}/dsp/``: ad tags,
5
+ conversion definitions, ad tag event associations, mobile measurement partner
6
+ registrations, and the conversion associations of orders.
7
+
8
+ Only ``Amazon-Advertising-API-ClientId`` is required here. ``Scope`` and
9
+ ``Amazon-Ads-AccountId`` are optional, and the manager header appears on some
10
+ of the routes. The account id goes **in the path**, not in a header.
11
+
12
+ **207 is the common success code**, not 200: the bulk routes answer one result
13
+ per item, which is the whole point of ``MultiStatus``. A few routes still answer
14
+ 200, and the delete of the mobile measurement partner registrations is one of
15
+ them.
16
+
17
+ Several bodies accept more than one version of the media type. ``version`` picks
18
+ it, and the answer follows the same one on the routes that echo the body.
19
+ """
20
+
21
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
22
+
23
+
24
+ class DspConversions(Client):
25
+ r"""Conversions - /accounts/{accountId}/dsp
26
+
27
+ Documentation: https://advertising.amazon.com/API/docs/en-us/conversions
28
+ """
29
+
30
+ @sp_endpoint('/accounts/{}/dsp/amazonAdTag', method='GET',
31
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
32
+ def get_amazon_ad_tag(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
33
+ r"""
34
+ Reads the Amazon ad tag of the account. Read only.
35
+
36
+ Returns
37
+ 200, `vnd.dspamazonadtags`.
38
+
39
+ Keyword Args
40
+
41
+ - ``version`` (str): the version in the media type, ``1``. [optional]
42
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
43
+
44
+ Returns
45
+ ApiResponse, ``200``, with the ad tag.
46
+ """
47
+ media_type = 'application/vnd.dspamazonadtags.v' + version + '+json'
48
+ headers = {'Accept': media_type}
49
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
50
+ params=kwargs, headers=headers)
51
+
52
+ @sp_endpoint('/accounts/{}/dsp/adTagEvents/{}/list', method='GET',
53
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
54
+ def list_ad_tag_events(self, accountId, adTagId, version: str = "1", **kwargs) -> ApiResponse:
55
+ r"""
56
+ Lists the events of an ad tag. Read only.
57
+
58
+ Query Params
59
+
60
+ - ``searchTerm``, ``startDateTime``, ``endDateTime``,
61
+ ``maxResults``, ``nextToken``. [optional]
62
+
63
+ Returns
64
+ 200, `vnd.dspamazonadtagevents`.
65
+
66
+ Keyword Args
67
+
68
+ - ``version`` (str): the version in the media type, ``1``. [optional]
69
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
70
+
71
+ Returns
72
+ ApiResponse, ``200``, with the events.
73
+ """
74
+ media_type = 'application/vnd.dspamazonadtagevents.v' + version + '+json'
75
+ headers = {'Accept': media_type}
76
+ return self._request(fill_query_params(kwargs.pop('path'), accountId, adTagId),
77
+ params=kwargs, headers=headers)
78
+
79
+ @sp_endpoint('/accounts/{}/dsp/conversionDefinitions', method='POST',
80
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
81
+ def create_conversion_definitions(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
82
+ r"""
83
+ Creates conversion definitions. There is no single-create route: the
84
+ body carries a list, which is why the answer is 207.
85
+
86
+ Returns
87
+ 207, one answer per definition.
88
+
89
+ Keyword Args
90
+
91
+ - ``version`` (str): the version in the media type, one of ``1``, ``2``. [optional]
92
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
93
+
94
+ Returns
95
+ ApiResponse, **207** multi-status, one per definition.
96
+ """
97
+ media_type = 'application/vnd.dspconversiondefinition.v' + version + '+json'
98
+ headers = {'Accept': media_type}
99
+ headers['Content-Type'] = media_type
100
+ body = Utils.convert_body(kwargs.pop('body'), False)
101
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
102
+ data=body, params=kwargs, headers=headers)
103
+
104
+ @sp_endpoint('/accounts/{}/dsp/conversionDefinitions', method='PUT',
105
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
106
+ def update_conversion_definitions(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
107
+ r"""
108
+ Updates conversion definitions in bulk.
109
+
110
+ Returns
111
+ 207, one answer per definition.
112
+
113
+ Keyword Args
114
+
115
+ - ``version`` (str): the version in the media type, one of ``1``, ``2``. [optional]
116
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
117
+
118
+ Returns
119
+ ApiResponse, **207** multi-status.
120
+ """
121
+ media_type = 'application/vnd.dspconversiondefinition.v' + version + '+json'
122
+ headers = {'Accept': media_type}
123
+ headers['Content-Type'] = media_type
124
+ body = Utils.convert_body(kwargs.pop('body'), False)
125
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
126
+ data=body, params=kwargs, headers=headers)
127
+
128
+ @sp_endpoint('/accounts/{}/dsp/conversionDefinitions/delete', method='POST',
129
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
130
+ def delete_conversion_definitions(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
131
+ r"""
132
+ Deletes conversion definitions in bulk.
133
+
134
+ Returns
135
+ 207, one answer per definition.
136
+
137
+ Keyword Args
138
+
139
+ - ``version`` (str): the version in the media type, ``1``. [optional]
140
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
141
+
142
+ Returns
143
+ ApiResponse, **207** multi-status.
144
+ """
145
+ media_type = 'application/vnd.dspuserdeletionrequest.v' + version + '+json'
146
+ headers = {'Accept': media_type}
147
+ headers['Content-Type'] = media_type
148
+ body = Utils.convert_body(kwargs.pop('body'), False)
149
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
150
+ data=body, params=kwargs, headers=headers)
151
+
152
+ @sp_endpoint('/accounts/{}/dsp/conversionDefinitions/eventData', method='POST',
153
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
154
+ def import_conversion_event_data(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
155
+ r"""
156
+ Imports conversion event data.
157
+
158
+ Returns
159
+ 207, one answer per event.
160
+
161
+ Keyword Args
162
+
163
+ - ``version`` (str): the version in the media type, ``1``. [optional]
164
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
165
+
166
+ Returns
167
+ ApiResponse, **207** multi-status.
168
+ """
169
+ media_type = 'application/vnd.dspconversioneventimport.v' + version + '+json'
170
+ headers = {'Accept': media_type}
171
+ headers['Content-Type'] = media_type
172
+ body = Utils.convert_body(kwargs.pop('body'), False)
173
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
174
+ data=body, params=kwargs, headers=headers)
175
+
176
+ @sp_endpoint('/accounts/{}/dsp/conversionDefinitions/list', method='POST',
177
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
178
+ def list_conversion_definitions(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
179
+ r"""
180
+ Lists conversion definitions. Read only, `POST` because the filter goes in
181
+ the body. The request body and the answer use the same type.
182
+
183
+ Returns
184
+ 200, with the list.
185
+
186
+ Keyword Args
187
+
188
+ - ``version`` (str): the version in the media type, one of ``1``, ``2``. [optional]
189
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
190
+
191
+ Returns
192
+ ApiResponse, ``200``, with the definitions.
193
+ """
194
+ media_type = 'application/vnd.dspconversiondefinition.v' + version + '+json'
195
+ headers = {'Accept': media_type}
196
+ headers['Content-Type'] = media_type
197
+ body = Utils.convert_body(kwargs.pop('body'), False)
198
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
199
+ data=body, params=kwargs, headers=headers)
200
+
201
+ @sp_endpoint('/accounts/{}/dsp/conversionDefinitions/{}/adTagEventAssociations', method='GET',
202
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
203
+ def get_ad_tag_event_associations(self, accountId, conversionDefinitionId, version: str = "1", **kwargs) -> ApiResponse:
204
+ r"""
205
+ Reads the ad tag event associations of a conversion definition.
206
+
207
+ Returns
208
+ 200.
209
+
210
+ Keyword Args
211
+
212
+ - ``version`` (str): the version in the media type, ``1``. [optional]
213
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
214
+
215
+ Returns
216
+ ApiResponse, ``200``, with the associations.
217
+ """
218
+ media_type = 'application/vnd.dspconversionadtageventassociation.v' + version + '+json'
219
+ headers = {'Accept': media_type}
220
+ return self._request(fill_query_params(kwargs.pop('path'), accountId, conversionDefinitionId),
221
+ params=kwargs, headers=headers)
222
+
223
+ @sp_endpoint('/accounts/{}/dsp/conversionDefinitions/{}/adTagEventAssociations', method='POST',
224
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
225
+ def create_ad_tag_event_associations(self, accountId, conversionDefinitionId, version: str = "1", **kwargs) -> ApiResponse:
226
+ r"""
227
+ Creates ad tag event associations for a conversion definition.
228
+
229
+ Returns
230
+ 200, not 207.
231
+
232
+ Keyword Args
233
+
234
+ - ``version`` (str): the version in the media type, ``1``. [optional]
235
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
236
+
237
+ Returns
238
+ ApiResponse, ``200``.
239
+ """
240
+ media_type = 'application/vnd.dspconversionadtageventassociation.v' + version + '+json'
241
+ headers = {'Accept': media_type}
242
+ headers['Content-Type'] = media_type
243
+ body = Utils.convert_body(kwargs.pop('body'), False)
244
+ return self._request(fill_query_params(kwargs.pop('path'), accountId, conversionDefinitionId),
245
+ data=body, params=kwargs, headers=headers)
246
+
247
+ @sp_endpoint('/accounts/{}/dsp/conversionDefinitions/{}/mobileMeasurementPartnerAppRegistration', method='GET',
248
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
249
+ def get_mmp_app_registration(self, accountId, conversionDefinitionId, version: str = "1", **kwargs) -> ApiResponse:
250
+ r"""
251
+ Reads the mobile measurement partner app registration of a conversion
252
+ definition.
253
+
254
+ Returns
255
+ 200.
256
+
257
+ Keyword Args
258
+
259
+ - ``version`` (str): the version in the media type, ``1``. [optional]
260
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
261
+
262
+ Returns
263
+ ApiResponse, ``200``.
264
+ """
265
+ media_type = 'application/vnd.dspassociatedmobilemeasurementpartnerappregistration.v' + version + '+json'
266
+ headers = {'Accept': media_type}
267
+ return self._request(fill_query_params(kwargs.pop('path'), accountId, conversionDefinitionId),
268
+ params=kwargs, headers=headers)
269
+
270
+ @sp_endpoint('/accounts/{}/dsp/mobileMeasurementPartners', method='POST',
271
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
272
+ def create_mmp_registrations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
273
+ r"""
274
+ Registers mobile measurement partner apps.
275
+
276
+ Returns
277
+ 207, one answer per registration.
278
+
279
+ Keyword Args
280
+
281
+ - ``version`` (str): the version in the media type, ``1``. [optional]
282
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
283
+
284
+ Returns
285
+ ApiResponse, **207** multi-status.
286
+ """
287
+ media_type = 'application/vnd.dspmobilemeasurementpartnerappregistration.v' + version + '+json'
288
+ headers = {'Accept': media_type}
289
+ headers['Content-Type'] = media_type
290
+ body = Utils.convert_body(kwargs.pop('body'), False)
291
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
292
+ data=body, params=kwargs, headers=headers)
293
+
294
+ @sp_endpoint('/accounts/{}/dsp/mobileMeasurementPartners', method='PUT',
295
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
296
+ def update_mmp_registrations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
297
+ r"""
298
+ Updates mobile measurement partner app registrations.
299
+
300
+ Returns
301
+ 207, one answer per registration.
302
+
303
+ Keyword Args
304
+
305
+ - ``version`` (str): the version in the media type, ``1``. [optional]
306
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
307
+
308
+ Returns
309
+ ApiResponse, **207** multi-status.
310
+ """
311
+ media_type = 'application/vnd.dspmobilemeasurementpartnerappregistration.v' + version + '+json'
312
+ headers = {'Accept': media_type}
313
+ headers['Content-Type'] = media_type
314
+ body = Utils.convert_body(kwargs.pop('body'), False)
315
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
316
+ data=body, params=kwargs, headers=headers)
317
+
318
+ @sp_endpoint('/accounts/{}/dsp/mobileMeasurementPartners/delete', method='POST',
319
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
320
+ def delete_mmp_registrations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
321
+ r"""
322
+ Deletes mobile measurement partner app registrations.
323
+
324
+ Returns
325
+ 200, not 207, unlike the create and the update.
326
+
327
+ Keyword Args
328
+
329
+ - ``version`` (str): the version in the media type, ``1``. [optional]
330
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
331
+
332
+ Returns
333
+ ApiResponse, ``200``.
334
+ """
335
+ media_type = 'application/vnd.dspmobilemeasurementpartnerappregistration.v' + version + '+json'
336
+ headers = {'Accept': media_type}
337
+ headers['Content-Type'] = media_type
338
+ body = Utils.convert_body(kwargs.pop('body'), False)
339
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
340
+ data=body, params=kwargs, headers=headers)
341
+
342
+ @sp_endpoint('/accounts/{}/dsp/mobileMeasurementPartners/list', method='POST',
343
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
344
+ def list_mmp_registrations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
345
+ r"""
346
+ Lists mobile measurement partner app registrations. Read only.
347
+
348
+ Returns
349
+ 200.
350
+
351
+ Keyword Args
352
+
353
+ - ``version`` (str): the version in the media type, ``1``. [optional]
354
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
355
+
356
+ Returns
357
+ ApiResponse, ``200``, with the registrations.
358
+ """
359
+ media_type = 'application/vnd.dspmobilemeasurementpartnerappregistration.v' + version + '+json'
360
+ headers = {'Accept': media_type}
361
+ headers['Content-Type'] = media_type
362
+ body = Utils.convert_body(kwargs.pop('body'), False)
363
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
364
+ data=body, params=kwargs, headers=headers)
365
+
366
+ @sp_endpoint('/accounts/{}/dsp/orders/{}/conversionDefinitionAssociations', method='GET',
367
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
368
+ def get_order_conversion_associations(self, accountId, orderId, version: str = "1", **kwargs) -> ApiResponse:
369
+ r"""
370
+ Reads the conversion definition associations of an order. Read only.
371
+
372
+ Query Params
373
+
374
+ - ``maxResults``, ``nextToken``. [optional]
375
+
376
+ Returns
377
+ 200. Version 3 is the campaign shape, 1 and 2 the order shape.
378
+
379
+ Keyword Args
380
+
381
+ - ``version`` (str): the version in the media type, one of ``1``, ``2``, ``3``. [optional]
382
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
383
+
384
+ Returns
385
+ ApiResponse, ``200``, with the associations.
386
+ """
387
+ media_type = ('application/vnd.dspcampaignconversionassociation.v' + version
388
+ if version >= '3'
389
+ else 'application/vnd.dsporderconversionassociation.v' + version)
390
+ media_type += '+json'
391
+ headers = {'Accept': media_type}
392
+ return self._request(fill_query_params(kwargs.pop('path'), accountId, orderId),
393
+ params=kwargs, headers=headers)
394
+
395
+ @sp_endpoint('/accounts/{}/dsp/orders/{}/conversionDefinitionAssociations', method='POST',
396
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
397
+ def create_order_conversion_associations(self, accountId, orderId, version: str = "1", **kwargs) -> ApiResponse:
398
+ r"""
399
+ Associates conversion definitions with an order.
400
+
401
+ Returns
402
+ 207, one answer per association.
403
+
404
+ Keyword Args
405
+
406
+ - ``version`` (str): the version in the media type, one of ``1``, ``2``. [optional]
407
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
408
+
409
+ Returns
410
+ ApiResponse, **207** multi-status.
411
+ """
412
+ media_type = 'application/vnd.dsporderconversionassociation.v' + version + '+json'
413
+ headers = {'Accept': media_type}
414
+ headers['Content-Type'] = media_type
415
+ body = Utils.convert_body(kwargs.pop('body'), False)
416
+ return self._request(fill_query_params(kwargs.pop('path'), accountId, orderId),
417
+ data=body, params=kwargs, headers=headers)
418
+
419
+ @sp_endpoint('/accounts/{}/dsp/batchOrders/conversionDefinitionAssociations', method='POST',
420
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
421
+ def batch_get_conversion_associations(self, accountId, version: str = "1", **kwargs) -> ApiResponse:
422
+ r"""
423
+ Reads the conversion definition associations of many orders at once. Read
424
+ only despite the POST: the order ids go in the body.
425
+
426
+ Returns
427
+ 200.
428
+
429
+ Keyword Args
430
+
431
+ - ``version`` (str): the version in the media type, ``1``. [optional]
432
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
433
+
434
+ Returns
435
+ ApiResponse, ``200``.
436
+ """
437
+ media_type = 'application/vnd.dspbatchgetconversiondefinitions.v' + version + '+json'
438
+ headers = {'Accept': media_type}
439
+ headers['Content-Type'] = media_type
440
+ body = Utils.convert_body(kwargs.pop('body'), False)
441
+ return self._request(fill_query_params(kwargs.pop('path'), accountId),
442
+ data=body, params=kwargs, headers=headers)