python-amazon-ad-api 2.3.1__py3-none-any.whl → 2.4.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.
Files changed (41) hide show
  1. ad_api/api/__init__.py +68 -0
  2. ad_api/api/dsp_ad_creative_association.py +147 -0
  3. ad_api/api/dsp_ad_group_and_campaign.py +139 -0
  4. ad_api/api/dsp_audience_create.py +53 -0
  5. ad_api/api/dsp_bid_adjustments.py +193 -0
  6. ad_api/api/dsp_campaign_flights.py +119 -0
  7. ad_api/api/dsp_campaign_insights.py +59 -0
  8. ad_api/api/dsp_combined_audiences.py +83 -0
  9. ad_api/api/dsp_conversion_tracking_products.py +92 -0
  10. ad_api/api/dsp_conversions.py +442 -0
  11. ad_api/api/dsp_creatives.py +114 -0
  12. ad_api/api/dsp_deal_permissions.py +170 -0
  13. ad_api/api/dsp_deal_proposals.py +440 -0
  14. ad_api/api/dsp_deals.py +204 -0
  15. ad_api/api/dsp_deals_management.py +66 -0
  16. ad_api/api/dsp_discovery_advertised_product_categories.py +35 -0
  17. ad_api/api/dsp_discovery_apps.py +36 -0
  18. ad_api/api/dsp_discovery_domain_lists.py +36 -0
  19. ad_api/api/dsp_discovery_geo_locations.py +42 -0
  20. ad_api/api/dsp_discovery_iab_content.py +37 -0
  21. ad_api/api/dsp_discovery_inventory_source_exchanges.py +36 -0
  22. ad_api/api/dsp_discovery_products.py +102 -0
  23. ad_api/api/dsp_discovery_third_party_target_segments.py +36 -0
  24. ad_api/api/dsp_frequency_associations.py +138 -0
  25. ad_api/api/dsp_frequency_groups.py +112 -0
  26. ad_api/api/dsp_frequency_insights.py +85 -0
  27. ad_api/api/dsp_guidance.py +111 -0
  28. ad_api/api/dsp_inherited_settings.py +133 -0
  29. ad_api/api/dsp_inventory_groups.py +209 -0
  30. ad_api/api/dsp_measurement.py +693 -0
  31. ad_api/api/dsp_quick_actions.py +177 -0
  32. ad_api/api/dsp_seats.py +43 -0
  33. ad_api/api/dsp_seats_management.py +84 -0
  34. ad_api/api/dsp_target_kpi_recommendations.py +44 -0
  35. ad_api/api/dsp_targeting.py +98 -0
  36. ad_api/version.py +1 -1
  37. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/METADATA +1 -1
  38. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/RECORD +41 -7
  39. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/WHEEL +0 -0
  40. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/licenses/LICENSE +0 -0
  41. {python_amazon_ad_api-2.3.1.dist-info → python_amazon_ad_api-2.4.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,138 @@
1
+ """Frequency group associations /frequencyGroups/v1.
2
+
3
+ Contract: D16GFMApiFrequencyGroupAssociationV1 3.0, the *Frequency groups
4
+ associations* entry at the first level of *Amazon DSP*. Six routes in three
5
+ pairs: associate, list the associations, and list the candidates.
6
+
7
+ The success codes differ per operation and there are four of them: **201** on the
8
+ advertiser association, **204** on the campaign association (both with **no
9
+ body**), **207** on the two association lists, and **200** on the two candidate
10
+ lists.
11
+
12
+ Plain ``application/json``, and unlike its sibling Frequency groups, here all
13
+ three headers are **required**: ``Amazon-Advertising-API-ClientId``,
14
+ ``Amazon-Advertising-API-Scope`` and ``Amazon-Ads-AccountId``.
15
+ """
16
+
17
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
18
+
19
+
20
+ class DspFrequencyAssociations(Client):
21
+ r"""Frequency group associations - /frequencyGroups/v1
22
+
23
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-frequency-group-association
24
+ """
25
+
26
+ @sp_endpoint('/frequencyGroups/v1/advertiserAssociations', method='PUT',
27
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
28
+ def associate_advertisers(self, **kwargs) -> ApiResponse:
29
+ r"""
30
+ Associates frequency groups with advertisers.
31
+
32
+ Keyword Args
33
+
34
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
35
+
36
+ Returns
37
+ ApiResponse, **201**, with **no body**. Do not read the payload.
38
+ """
39
+ headers = {'Accept': 'application/json',
40
+ 'Content-Type': 'application/json'}
41
+ body = Utils.convert_body(kwargs.pop('body'), False)
42
+ return self._request(fill_query_params(kwargs.pop('path')),
43
+ data=body, params=kwargs, headers=headers)
44
+
45
+ @sp_endpoint('/frequencyGroups/v1/advertiserAssociations/list', method='POST',
46
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
47
+ def list_advertiser_associations(self, **kwargs) -> ApiResponse:
48
+ r"""
49
+ Lists the advertiser associations. Read only.
50
+
51
+ Keyword Args
52
+
53
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
54
+
55
+ Returns
56
+ undefined
57
+ """
58
+ headers = {'Accept': 'application/json',
59
+ 'Content-Type': 'application/json'}
60
+ body = Utils.convert_body(kwargs.pop('body'), False)
61
+ return self._request(fill_query_params(kwargs.pop('path')),
62
+ data=body, params=kwargs, headers=headers)
63
+
64
+ @sp_endpoint('/frequencyGroups/v1/advertisers/list', method='POST',
65
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
66
+ def list_advertisers(self, **kwargs) -> ApiResponse:
67
+ r"""
68
+ Lists the advertisers a frequency group can be associated with. Read only.
69
+
70
+ Keyword Args
71
+
72
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
73
+
74
+ Returns
75
+ undefined
76
+ """
77
+ headers = {'Accept': 'application/json',
78
+ 'Content-Type': 'application/json'}
79
+ body = Utils.convert_body(kwargs.pop('body'), False)
80
+ return self._request(fill_query_params(kwargs.pop('path')),
81
+ data=body, params=kwargs, headers=headers)
82
+
83
+ @sp_endpoint('/frequencyGroups/v1/campaignAssociations', method='PUT',
84
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
85
+ def associate_campaigns(self, **kwargs) -> ApiResponse:
86
+ r"""
87
+ Associates frequency groups with campaigns.
88
+
89
+ Keyword Args
90
+
91
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
92
+
93
+ Returns
94
+ ApiResponse, **204**, with **no body**.
95
+ """
96
+ headers = {'Accept': 'application/json',
97
+ 'Content-Type': 'application/json'}
98
+ body = Utils.convert_body(kwargs.pop('body'), False)
99
+ return self._request(fill_query_params(kwargs.pop('path')),
100
+ data=body, params=kwargs, headers=headers)
101
+
102
+ @sp_endpoint('/frequencyGroups/v1/campaignAssociations/list', method='POST',
103
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
104
+ def list_campaign_associations(self, **kwargs) -> ApiResponse:
105
+ r"""
106
+ Lists the campaign associations. Read only.
107
+
108
+ Keyword Args
109
+
110
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
111
+
112
+ Returns
113
+ undefined
114
+ """
115
+ headers = {'Accept': 'application/json',
116
+ 'Content-Type': 'application/json'}
117
+ body = Utils.convert_body(kwargs.pop('body'), False)
118
+ return self._request(fill_query_params(kwargs.pop('path')),
119
+ data=body, params=kwargs, headers=headers)
120
+
121
+ @sp_endpoint('/frequencyGroups/v1/campaigns/list', method='POST',
122
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
123
+ def list_campaigns(self, **kwargs) -> ApiResponse:
124
+ r"""
125
+ Lists the campaigns a frequency group can be associated with. Read only.
126
+
127
+ Keyword Args
128
+
129
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
130
+
131
+ Returns
132
+ undefined
133
+ """
134
+ headers = {'Accept': 'application/json',
135
+ 'Content-Type': 'application/json'}
136
+ body = Utils.convert_body(kwargs.pop('body'), False)
137
+ return self._request(fill_query_params(kwargs.pop('path')),
138
+ data=body, params=kwargs, headers=headers)
@@ -0,0 +1,112 @@
1
+ """Frequency groups /frequencyGroups/v1.
2
+
3
+ Contract: D16GFMApiFrequencyGroupV1 3.0, the *Frequency groups* entry at the first
4
+ level of *Amazon DSP*. Four operations over three paths: create, list, read and
5
+ patch. The read and the patch share ``/frequencyGroups/v1/{frequencyGroupId}``,
6
+ which is why the vendor tree counts the entry once.
7
+
8
+ Plain ``application/json`` throughout: no ``vnd`` type and no version to build.
9
+
10
+ Headers are all optional except the client id: ``Amazon-Advertising-API-Scope``,
11
+ ``Amazon-Ads-AccountId`` and, on the list only,
12
+ ``Amazon-Ads-Manager-AccountId``. The three the client knows are declared, so
13
+ ``selector`` decides which travels.
14
+
15
+ Success codes differ per operation: ``201`` on create, ``200`` on list and read,
16
+ and ``204`` on patch, which returns no body.
17
+ """
18
+
19
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
20
+
21
+
22
+ class DspFrequencyGroups(Client):
23
+ r"""Frequency groups - /frequencyGroups/v1
24
+
25
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-frequency-group
26
+ """
27
+
28
+ @sp_endpoint('/frequencyGroups/v1', method='POST',
29
+ headers=['Amazon-Advertising-API-Scope',
30
+ 'Amazon-Ads-AccountId'])
31
+ def create_frequency_group(self, **kwargs) -> ApiResponse:
32
+ r"""
33
+ Creates a frequency group.
34
+
35
+ Request Body [Required]
36
+ The frequency group the contract publishes: its caps and the
37
+ entities it applies to.
38
+
39
+ Returns
40
+ ApiResponse, ``201`` created.
41
+ """
42
+ headers = {'Accept': 'application/json',
43
+ 'Content-Type': 'application/json'}
44
+ body = Utils.convert_body(kwargs.pop('body'), False)
45
+ return self._request(fill_query_params(kwargs.pop('path')),
46
+ data=body, params=kwargs, headers=headers)
47
+
48
+ @sp_endpoint('/frequencyGroups/v1/list', method='POST',
49
+ headers=['Amazon-Advertising-API-Scope',
50
+ 'Amazon-Ads-AccountId',
51
+ 'Amazon-Advertising-API-Manager-Account'])
52
+ def list_frequency_groups(self, **kwargs) -> ApiResponse:
53
+ r"""
54
+ Lists the frequency groups. Read only, ``POST`` because the filters go in
55
+ the body.
56
+
57
+ Request Body
58
+ The filter body the contract publishes, or empty for all.
59
+
60
+ Returns
61
+ ApiResponse, ``200``, with the list and its pagination.
62
+
63
+ Note
64
+ This is the only route of the family that also accepts
65
+ ``Amazon-Ads-Manager-AccountId``.
66
+ """
67
+ headers = {'Accept': 'application/json',
68
+ 'Content-Type': 'application/json'}
69
+ body = Utils.convert_body(kwargs.pop('body'), False)
70
+ return self._request(fill_query_params(kwargs.pop('path')),
71
+ data=body, params=kwargs, headers=headers)
72
+
73
+ @sp_endpoint('/frequencyGroups/v1/{}', method='GET',
74
+ headers=['Amazon-Advertising-API-Scope',
75
+ 'Amazon-Ads-AccountId'])
76
+ def get_frequency_group(self, frequencyGroupId, **kwargs) -> ApiResponse:
77
+ r"""
78
+ Reads one frequency group. Read only.
79
+
80
+ Path Parameters
81
+
82
+ - ``frequencyGroupId`` (str): the group. [required]
83
+
84
+ Returns
85
+ ApiResponse, ``200``.
86
+ """
87
+ headers = {'Accept': 'application/json'}
88
+ return self._request(fill_query_params(kwargs.pop('path'), frequencyGroupId),
89
+ params=kwargs, headers=headers)
90
+
91
+ @sp_endpoint('/frequencyGroups/v1/{}', method='PATCH',
92
+ headers=['Amazon-Advertising-API-Scope',
93
+ 'Amazon-Ads-AccountId'])
94
+ def update_frequency_group(self, frequencyGroupId, **kwargs) -> ApiResponse:
95
+ r"""
96
+ Updates a frequency group. A ``PATCH`` on the same path the read uses.
97
+
98
+ Path Parameters
99
+
100
+ - ``frequencyGroupId`` (str): the group. [required]
101
+
102
+ Request Body [Required]
103
+ The fields to change.
104
+
105
+ Returns
106
+ ApiResponse, **204**, with **no body**. Do not read the payload here.
107
+ """
108
+ headers = {'Accept': 'application/json',
109
+ 'Content-Type': 'application/json'}
110
+ body = Utils.convert_body(kwargs.pop('body'), False)
111
+ return self._request(fill_query_params(kwargs.pop('path'), frequencyGroupId),
112
+ data=body, params=kwargs, headers=headers)
@@ -0,0 +1,85 @@
1
+ """Frequency insights /dsp/v1.
2
+
3
+ Contract: D16GDspApiActionableInsights 3.0, the *Frequency Savings Insight* entry
4
+ at the first level of *Amazon DSP*. Two read routes, both ``POST`` because the
5
+ body carries the filters, and each with its **own** media type:
6
+
7
+ - ``/dsp/v1/frequencyDistributionInsights/list``
8
+ ``application/vnd.dspFrequencyDistributionInsight.v<n>+json``
9
+ - ``/dsp/v1/frequencySavingsInsights/list``
10
+ ``application/vnd.dspFrequencySavingsInsight.v<n>+json``
11
+
12
+ They are not interchangeable: the first counts unique users per frequency band,
13
+ the second says what an adjusted frequency would have saved.
14
+
15
+ Headers: ``Amazon-Advertising-API-ClientId``, ``Amazon-Advertising-API-Scope``
16
+ and ``Amazon-Advertising-AccountId``, all required. The client knows the third as
17
+ ``Amazon-Ads-AccountId``, so that is the one declared. Success is **200**.
18
+ """
19
+
20
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
21
+
22
+
23
+ class DspFrequencyInsights(Client):
24
+ r"""Frequency insights - /dsp/v1
25
+
26
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-freq-insight
27
+ """
28
+
29
+ @sp_endpoint('/dsp/v1/frequencyDistributionInsights/list', method='POST',
30
+ headers=['Amazon-Advertising-API-Scope',
31
+ 'Amazon-Ads-AccountId'])
32
+ def list_frequency_distribution_insights(self, version: str = "1", **kwargs) -> ApiResponse:
33
+ r"""
34
+ Lists the frequency distribution insights: how many unique users saw the
35
+ ads once, twice, and so on up to ten or more. Read only.
36
+
37
+ Request Body [Required]
38
+ | **filters** (object): what to measure, as the contract publishes.
39
+
40
+ Request Body [Optional]
41
+ | **maxResults** (int): page size.
42
+ | **nextToken** (str): token from a previous answer.
43
+
44
+ Keyword Args
45
+
46
+ - ``version`` (str): media type version. Defaults to ``1``. [optional]
47
+
48
+ Returns
49
+ ApiResponse, ``200``, with the distribution.
50
+ """
51
+ media_type = ('application/vnd.dspFrequencyDistributionInsight.v'
52
+ + version + '+json')
53
+ headers = {'Accept': media_type, 'Content-Type': media_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/v1/frequencySavingsInsights/list', method='POST',
59
+ headers=['Amazon-Advertising-API-Scope',
60
+ 'Amazon-Ads-AccountId'])
61
+ def list_frequency_savings_insights(self, version: str = "1", **kwargs) -> ApiResponse:
62
+ r"""
63
+ Lists the frequency savings insights: what a different frequency cap would
64
+ have cost or saved. Read only.
65
+
66
+ Request Body [Required]
67
+ | **filters** (object): what to measure, as the contract publishes.
68
+
69
+ Request Body [Optional]
70
+ | **maxResults** (int): page size.
71
+ | **nextToken** (str): token from a previous answer.
72
+
73
+ Keyword Args
74
+
75
+ - ``version`` (str): media type version. Defaults to ``1``. [optional]
76
+
77
+ Returns
78
+ ApiResponse, ``200``, with the savings.
79
+ """
80
+ media_type = ('application/vnd.dspFrequencySavingsInsight.v'
81
+ + version + '+json')
82
+ headers = {'Accept': media_type, 'Content-Type': media_type}
83
+ body = Utils.convert_body(kwargs.pop('body'), False)
84
+ return self._request(fill_query_params(kwargs.pop('path')),
85
+ data=body, params=kwargs, headers=headers)
@@ -0,0 +1,111 @@
1
+ """Guidance /dsp/v1/guidance.
2
+
3
+ Contract: DSP Guidance 3.0, the *Guidance* entry at the first level of
4
+ *Amazon DSP*. Three read routes, one per scope: ad groups, advertisers and
5
+ campaigns.
6
+
7
+ Each route has its own request media type naming the scope, and all three share
8
+ one response type. The version appears twice in the name, as V1 and as .v1.0,
9
+ and both come from the one ``version`` argument.
10
+
11
+ Headers: Amazon-Advertising-API-ClientId and Amazon-Ads-AccountId are required,
12
+ and Amazon-Advertising-API-Scope and Accept-Language are optional. The language
13
+ goes through accept_language=.
14
+ """
15
+
16
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
17
+
18
+
19
+ class DspGuidance(Client):
20
+ r"""Guidance - /dsp/v1/guidance
21
+
22
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-guidance
23
+ """
24
+
25
+ @sp_endpoint("/dsp/v1/guidance/adGroups/list", method="POST",
26
+ headers=["Amazon-Advertising-API-Scope",
27
+ "Amazon-Ads-AccountId"])
28
+ def list_ad_group_guidance(self, version: str = "1.0", **kwargs) -> ApiResponse:
29
+ r"""
30
+ Lists the guidance for ad groups. Read only, POST because the filter goes
31
+ in the body.
32
+
33
+ Keyword Args
34
+
35
+ - ``version`` (str): the version, ``1.0``. It appears twice in the
36
+ media type, as ``V1`` and as ``.v1.0``. [optional]
37
+ - ``accept_language`` (str): the ``Accept-Language`` header. [optional]
38
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
39
+
40
+ Returns
41
+ ApiResponse, ``200``.
42
+ """
43
+ media_type = ("application/vnd.dspRecommendationsListAdGroupGuidanceV"
44
+ + version.split(".")[0] + "Request.v" + version + "+json")
45
+ accept = ("application/vnd.dspRecommendationsListGuidanceV"
46
+ + version.split(".")[0] + "Response.v" + version + "+json")
47
+ headers = {"Accept": accept, "Content-Type": media_type}
48
+ language = kwargs.pop("accept_language", None)
49
+ if language:
50
+ headers["Accept-Language"] = language
51
+ body = Utils.convert_body(kwargs.pop("body"), False)
52
+ return self._request(fill_query_params(kwargs.pop("path")),
53
+ data=body, params=kwargs, headers=headers)
54
+
55
+ @sp_endpoint("/dsp/v1/guidance/advertisers/list", method="POST",
56
+ headers=["Amazon-Advertising-API-Scope",
57
+ "Amazon-Ads-AccountId"])
58
+ def list_advertiser_guidance(self, version: str = "1.0", **kwargs) -> ApiResponse:
59
+ r"""
60
+ Lists the guidance for advertisers. Read only.
61
+
62
+ Keyword Args
63
+
64
+ - ``version`` (str): the version, ``1.0``. It appears twice in the
65
+ media type, as ``V1`` and as ``.v1.0``. [optional]
66
+ - ``accept_language`` (str): the ``Accept-Language`` header. [optional]
67
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
68
+
69
+ Returns
70
+ ApiResponse, ``200``.
71
+ """
72
+ media_type = ("application/vnd.dspRecommendationsListAdvertiserGuidanceV"
73
+ + version.split(".")[0] + "Request.v" + version + "+json")
74
+ accept = ("application/vnd.dspRecommendationsListGuidanceV"
75
+ + version.split(".")[0] + "Response.v" + version + "+json")
76
+ headers = {"Accept": accept, "Content-Type": media_type}
77
+ language = kwargs.pop("accept_language", None)
78
+ if language:
79
+ headers["Accept-Language"] = language
80
+ body = Utils.convert_body(kwargs.pop("body"), False)
81
+ return self._request(fill_query_params(kwargs.pop("path")),
82
+ data=body, params=kwargs, headers=headers)
83
+
84
+ @sp_endpoint("/dsp/v1/guidance/campaigns/list", method="POST",
85
+ headers=["Amazon-Advertising-API-Scope",
86
+ "Amazon-Ads-AccountId"])
87
+ def list_campaign_guidance(self, version: str = "1.0", **kwargs) -> ApiResponse:
88
+ r"""
89
+ Lists the guidance for campaigns. Read only.
90
+
91
+ Keyword Args
92
+
93
+ - ``version`` (str): the version, ``1.0``. It appears twice in the
94
+ media type, as ``V1`` and as ``.v1.0``. [optional]
95
+ - ``accept_language`` (str): the ``Accept-Language`` header. [optional]
96
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
97
+
98
+ Returns
99
+ ApiResponse, ``200``.
100
+ """
101
+ media_type = ("application/vnd.dspRecommendationsListCampaignGuidanceV"
102
+ + version.split(".")[0] + "Request.v" + version + "+json")
103
+ accept = ("application/vnd.dspRecommendationsListGuidanceV"
104
+ + version.split(".")[0] + "Response.v" + version + "+json")
105
+ headers = {"Accept": accept, "Content-Type": media_type}
106
+ language = kwargs.pop("accept_language", None)
107
+ if language:
108
+ headers["Accept-Language"] = language
109
+ body = Utils.convert_body(kwargs.pop("body"), False)
110
+ return self._request(fill_query_params(kwargs.pop("path")),
111
+ data=body, params=kwargs, headers=headers)
@@ -0,0 +1,133 @@
1
+ """Inherited settings /dsp/v1/inheritedSettings.
2
+
3
+ Contract: Inherited Settings API - V1 3.0. Six operations over six paths: the
4
+ settings themselves, their general variant, and the matching deletes and lists.
5
+
6
+ Plain ``application/json``, no version. All three headers are required,
7
+ ``Scope`` included.
8
+
9
+ The four writes answer 207; the two lists answer 200.
10
+ """
11
+
12
+ from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse, Utils
13
+
14
+
15
+ class DspInheritedSettings(Client):
16
+ r"""Inherited settings - /dsp/v1/inheritedSettings
17
+
18
+ Documentation: https://advertising.amazon.com/API/docs/en-us/dsp-inherited-settings
19
+ """
20
+
21
+ @sp_endpoint('/dsp/v1/inheritedSettings', method='POST',
22
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
23
+ def create_inherited_settings(self, **kwargs) -> ApiResponse:
24
+ r"""
25
+ Creates inherited settings.
26
+
27
+ Keyword Args
28
+
29
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
30
+
31
+ Returns
32
+ ApiResponse, **207** multi-status.
33
+ """
34
+ headers = {'Accept': 'application/json'}
35
+ headers['Content-Type'] = 'application/json'
36
+ body = Utils.convert_body(kwargs.pop('body'), False)
37
+ return self._request(kwargs.pop('path'),
38
+ data=body, params=kwargs, headers=headers)
39
+
40
+ @sp_endpoint('/dsp/v1/inheritedSettings/delete', method='POST',
41
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
42
+ def delete_inherited_settings(self, **kwargs) -> ApiResponse:
43
+ r"""
44
+ Deletes inherited settings.
45
+
46
+ Keyword Args
47
+
48
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
49
+
50
+ Returns
51
+ ApiResponse, **207** multi-status.
52
+ """
53
+ headers = {'Accept': 'application/json'}
54
+ headers['Content-Type'] = 'application/json'
55
+ body = Utils.convert_body(kwargs.pop('body'), False)
56
+ return self._request(kwargs.pop('path'),
57
+ data=body, params=kwargs, headers=headers)
58
+
59
+ @sp_endpoint('/dsp/v1/inheritedSettings/list', method='POST',
60
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
61
+ def list_inherited_settings(self, **kwargs) -> ApiResponse:
62
+ r"""
63
+ Lists inherited settings. Read only.
64
+
65
+ Keyword Args
66
+
67
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
68
+
69
+ Returns
70
+ ApiResponse, ``200``, with the settings.
71
+ """
72
+ headers = {'Accept': 'application/json'}
73
+ headers['Content-Type'] = 'application/json'
74
+ body = Utils.convert_body(kwargs.pop('body'), False)
75
+ return self._request(kwargs.pop('path'),
76
+ data=body, params=kwargs, headers=headers)
77
+
78
+ @sp_endpoint('/dsp/v1/inheritedSettings/general', method='POST',
79
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
80
+ def create_general_settings(self, **kwargs) -> ApiResponse:
81
+ r"""
82
+ Creates the general inherited settings.
83
+
84
+ Keyword Args
85
+
86
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
87
+
88
+ Returns
89
+ ApiResponse, **207** multi-status.
90
+ """
91
+ headers = {'Accept': 'application/json'}
92
+ headers['Content-Type'] = 'application/json'
93
+ body = Utils.convert_body(kwargs.pop('body'), False)
94
+ return self._request(kwargs.pop('path'),
95
+ data=body, params=kwargs, headers=headers)
96
+
97
+ @sp_endpoint('/dsp/v1/inheritedSettings/general/delete', method='POST',
98
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
99
+ def delete_general_settings(self, **kwargs) -> ApiResponse:
100
+ r"""
101
+ Deletes the general inherited settings.
102
+
103
+ Keyword Args
104
+
105
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
106
+
107
+ Returns
108
+ ApiResponse, **207** multi-status.
109
+ """
110
+ headers = {'Accept': 'application/json'}
111
+ headers['Content-Type'] = 'application/json'
112
+ body = Utils.convert_body(kwargs.pop('body'), False)
113
+ return self._request(kwargs.pop('path'),
114
+ data=body, params=kwargs, headers=headers)
115
+
116
+ @sp_endpoint('/dsp/v1/inheritedSettings/general/list', method='POST',
117
+ headers=['Amazon-Advertising-API-Scope', 'Amazon-Ads-AccountId'])
118
+ def list_general_settings(self, **kwargs) -> ApiResponse:
119
+ r"""
120
+ Lists the general inherited settings. Read only.
121
+
122
+ Keyword Args
123
+
124
+ - ``selector`` (str): ``profile_id`` or ``account_id``. [optional]
125
+
126
+ Returns
127
+ ApiResponse, ``200``, with the settings.
128
+ """
129
+ headers = {'Accept': 'application/json'}
130
+ headers['Content-Type'] = 'application/json'
131
+ body = Utils.convert_body(kwargs.pop('body'), False)
132
+ return self._request(kwargs.pop('path'),
133
+ data=body, params=kwargs, headers=headers)