python-amazon-ad-api 0.9.7__py3-none-any.whl → 0.9.8__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.
@@ -10,417 +10,551 @@ class Campaigns(Client):
10
10
 
11
11
  """
12
12
 
13
- @sp_endpoint('/v2/sp/campaigns', method='PUT')
14
- @Utils.deprecated
15
- def edit_single_campaign_assistant(
16
- self,
17
- campaign_id: int,
18
- portfolio_id: int = None,
19
- campaign_name: str = None,
20
- po_number: str = None,
21
- account_manager: str = None,
22
- campaign_status: str = None,
23
- daily_budget: int = None,
24
- start_date: str = None,
25
- end_date: str = None,
26
- premium_bid_adjustment: bool = None,
27
- strategy: str = None,
28
- predicate: str or tuple = None,
29
- percentage: str or tuple = None,
30
- **kwargs,
31
- ) -> ApiResponse:
32
- r"""
33
- edit_single_campaign_assistant(campaign_id: int, portfolio_id: int = None, campaign_name: str, po_number: str = None, account_manager: str = None, campaign_status: str = None, daily_budget: int, start_date: str, end_date: str = None, premium_bid_adjustment: bool = None, strategy:str = None, predicate:str or tuple = None, percentage:int or tuple = None, **kwargs) -> ApiResponse
34
-
35
- Edit one campaigns and create the body based on the params provided, at least one of the optional params need to be set or a INVALID_ARGUMENT code is thorwn
36
-
37
- Kwargs:
38
- | **campaign_id** (number): [required] The identifier of an existing campaign to update.
39
- | **portfolio_id** (number): [optional] The identifier of an existing portfolio to which the campaign is associated
40
- | **campaign_name** (string): [optional] A name for the campaign
41
- | **po_number** (string): [optional] 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
42
- | **account_manager** (string): [optional] A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
43
- | **campaign_status**': (string): [optional] The current resource state Values: enabled, paused, archived. Default: enabled
44
- | **daily_budget** (float): [optional] A daily budget for the campaign
45
- | **start_date** (string): [optional] A starting date for the campaign to go live. The format of the date is YYYYMMDD
46
- | **end_date** (string): [optional] An ending date for the campaign to stop running. The format of the date is YYYYMMDD
47
- | **premium_bid_adjustment**' (boolean): [optional] If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information. Tip: When Campaign has been adopted to enhanced bidding premiumBidAdjustment can not be set
48
- | **strategy** (string): [optional] The bidding strategy. 'Values': legacyForSales (Dynamic bids - down only), autoForSales (Dynamic bids - up and down), manual (Fixed bid)
49
- | **predicate** (string or tuple(str)): [optional] You can enable controls to adjust your bid based on the placement location. Specify a location where you want to use bid controls. The percentage value set is the percentage of the original bid for which you want to have your bid adjustment increased. For example, a 50% adjustment on a $1.00 bid would increase the bid to $1.50 for the opportunity to win a specified placement. 'Values': placementTop (str), placementProductPage (str), ("placementTop", "placementProductPage") (tuple)
50
- | **percentage** (float or tuple(float)): [optional] The bid adjustment percentage value. Example: 15 (float), (15, 25) (tuple)
51
-
52
- Returns:
53
-
54
- ApiResponse
55
-
56
- """
57
-
58
- optional = {}
59
-
60
- if portfolio_id is not None:
61
- optional.update({'portfolioId': portfolio_id})
62
-
63
- if campaign_name is not None:
64
- optional.update({'name': campaign_name})
65
-
66
- if po_number is not None and account_manager is not None:
67
- optional.update({"tags": {'PONumber': po_number, 'accountManager': account_manager}})
68
-
69
- if campaign_status is not None:
70
- optional.update({'state': campaign_status})
71
-
72
- if daily_budget is not None:
73
- optional.update({'dailyBudget': daily_budget})
74
-
75
- if start_date is not None:
76
- optional.update({'startDate': start_date})
77
-
78
- if end_date is not None:
79
- optional.update({'endDate': end_date})
80
-
81
- if premium_bid_adjustment is not None:
82
- optional.update({'premiumBidAdjustment': premium_bid_adjustment})
83
-
84
- if strategy is not None and predicate is None and percentage is None:
85
- optional.update({'bidding': {'strategy': strategy, 'adjustments': []}})
86
-
87
- if strategy is not None and predicate is not None and percentage is not None:
88
- if isinstance(predicate, str):
89
- optional.update(
90
- {
91
- 'bidding': {
92
- 'strategy': strategy,
93
- 'adjustments': [{'predicate': predicate, 'percentage': percentage}],
94
- }
95
- }
96
- )
97
-
98
- if isinstance(predicate, tuple) and len(predicate) == 2 and len(percentage) == 2:
99
- options = []
100
- for i in range(len(predicate)):
101
- option = {"predicate": predicate[i], "percentage": percentage[i]}
102
- options.append(option)
103
-
104
- bidding = {'strategy': strategy, 'adjustments': options}
105
-
106
- dictionary = {}
107
- dictionary["bidding"] = bidding
108
-
109
- optional.update(dictionary)
110
-
111
- required = {
112
- 'campaignId': campaign_id,
113
- }
114
-
115
- if not optional:
116
- description = 'No changes submitted for entity %s' % campaign_id
117
- obj = [{'code': 'INVALID_ARGUMENT', 'description': description}]
118
- return ApiResponse(obj)
119
- else:
120
- required.update(optional)
121
- data_str = json.dumps([required])
122
- return self._request(kwargs.pop('path'), data=data_str, params=kwargs)
123
-
124
- @sp_endpoint('/v2/sp/campaigns', method='POST')
125
- @Utils.deprecated
126
- def create_single_campaign_assistant(
127
- self,
128
- campaign_name: str,
129
- targeting_type: str,
130
- daily_budget: int,
131
- start_date: str,
132
- end_date: str = None,
133
- campaign_status: str = "enabled",
134
- portfolio_id: int = None,
135
- po_number: str = None,
136
- account_manager: str = None,
137
- premium_bid_adjustment: bool = None,
138
- strategy: str = None,
139
- predicate: str or tuple = None,
140
- percentage: int or tuple = None,
141
- **kwargs,
142
- ) -> ApiResponse:
143
- r"""
144
- create_single_campaign_assistant(campaign_name: str,targeting_type: str, daily_budget: int, start_date: str, end_date: str = None, campaign_status: str = "enabled", portfolio_id: int = None, po_number: str = None, account_manager: str = None, premium_bid_adjustment: bool = False, strategy:str = None, predicate:str = None, percentage:int = None, **kwargs) -> ApiResponse
145
-
146
- Creates one campaigns and create the body based on the params provided
147
-
148
- Kwargs:
149
-
150
- | **campaign_name** (string): [required] A name for the campaign
151
- | **campaign_type** (string): [fixed] The advertising product managed by this campaign. Value: sponsoredProducts
152
- | **targeting_type** (string): [required] The type of targeting for the campaign. Values: manual, auto
153
- | **daily_budget** (float): [required] A daily budget for the campaign
154
- | **start_date** (string): [required] A starting date for the campaign to go live. The format of the date is YYYYMMDD
155
- | **end_date** (string): [optional] An ending date for the campaign to stop running. The format of the date is YYYYMMDD
156
- | **campaign_status**': (string): [optional] The current resource state Values: enabled, paused, archived. Default: enabled
157
- | **portfolio_id** (number): [optional] The identifier of an existing portfolio to which the campaign is associated
158
- | **po_number** (string): [optional] 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
159
- | **account_manager** (string): [optional] A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
160
- | **premium_bid_adjustment**' (boolean) If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.
161
- | **strategy** (string): [optional] The bidding strategy. 'Values': legacyForSales (Dynamic bids - down only), autoForSales (Dynamic bids - up and down), manual (Fixed bid)
162
- | **predicate** (string): [optional] You can enable controls to adjust your bid based on the placement location. Specify a location where you want to use bid controls. The percentage value set is the percentage of the original bid for which you want to have your bid adjustment increased. For example, a 50% adjustment on a $1.00 bid would increase the bid to $1.50 for the opportunity to win a specified placement. 'Values': placementTop, placementProductPage
163
- | **percentage** (float): [optional] The bid adjustment percentage value.
164
-
165
- Returns:
166
-
167
- ApiResponse
168
-
169
- """
170
-
171
- optional = {}
172
-
173
- if portfolio_id is not None:
174
- optional.update({'portfolioId': portfolio_id})
175
-
176
- if po_number is not None and account_manager is not None:
177
- optional.update({"tags": {'PONumber': po_number, 'accountManager': account_manager}})
178
-
179
- if end_date is not None:
180
- optional.update({'endDate': end_date})
181
-
182
- if premium_bid_adjustment is not None:
183
- optional.update({'premiumBidAdjustment': premium_bid_adjustment})
184
-
185
- if strategy is not None and predicate is not None and percentage is not None:
186
- if isinstance(predicate, str):
187
- optional.update(
188
- {
189
- 'bidding': {
190
- 'strategy': strategy,
191
- 'adjustments': [{'predicate': predicate, 'percentage': percentage}],
192
- }
193
- }
194
- )
195
-
196
- if isinstance(predicate, tuple) and len(predicate) == 2 and len(percentage) == 2:
197
- options = []
198
- for i in range(len(predicate)):
199
- option = {"predicate": predicate[i], "percentage": percentage[i]}
200
- options.append(option)
201
-
202
- bidding = {'strategy': strategy, 'adjustments': options}
203
-
204
- dictionary = {}
205
- dictionary["bidding"] = bidding
206
-
207
- optional.update(dictionary)
208
-
209
- required = {
210
- 'name': campaign_name,
211
- 'campaignType': 'sponsoredProducts',
212
- 'targetingType': targeting_type,
213
- 'state': campaign_status,
214
- 'dailyBudget': daily_budget,
215
- 'startDate': start_date,
216
- }
217
-
218
- if optional:
219
- required.update(optional)
220
-
221
- data_str = json.dumps([required])
222
- return self._request(kwargs.pop('path'), data=data_str, params=kwargs)
223
-
224
- @sp_endpoint('/v2/sp/campaigns', method='POST')
225
- @Utils.deprecated
226
- def create_campaigns(self, **kwargs) -> ApiResponse:
227
- r"""
228
- create_campaigns(body: (dict, str, list)) -> ApiResponse
229
-
230
- Creates one or more campaigns.
231
-
232
- body: | REQUIRED {'description': 'An array of campaigns.}'
233
-
234
- | '**portfolioId**': *number*, {'description': 'The identifier of an existing portfolio to which the campaign is associated'}
235
- | '**name**': *string*, {'description': 'A name for the campaign'}
236
- | '**tags**': *string*, {'description': 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers.'}
237
- | '**campaignType**': *string*, {'description': 'The advertising product managed by this campaign', 'Enum': '[ sponsoredProducts ]'}
238
- | '**targetingType**': *string*, {'description': 'The type of targeting for the campaign.', 'Enum': '[ manual, auto ]'}
239
- | '**state**': *string*, {'description': 'The current resource state.', 'Enum': '[ enabled, paused, archived ]'}
240
- | '**dailyBudget**': *number($float)*, {'description': 'A daily budget for the campaign.'}
241
- | '**startDate**': *string*, {'description': 'A starting date for the campaign to go live. The format of the date is YYYYMMDD.'}
242
- | '**endDate**': *string* nullable: true, {'description': 'An ending date for the campaign to stop running. The format of the date is YYYYMMDD.'}
243
- | '**premiumBidAdjustment**': *boolean*, {'description': 'If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.'}
244
- | '**bidding**': *Bidding*, {'strategy': 'string', 'Enum': '[ legacyForSales, autoForSales, manual ]', 'adjustments': '{...}'}
245
-
246
- Returns:
247
-
248
- ApiResponse
249
-
250
- """
251
- body = Utils.convert_body(kwargs.pop('body'))
252
- return self._request(kwargs.pop('path'), data=body, params=kwargs)
253
-
254
- @sp_endpoint('/v2/sp/campaigns', method='PUT')
255
- @Utils.deprecated
256
- def edit_campaigns(self, **kwargs) -> ApiResponse:
257
- r"""
258
- edit_campaigns(body: (dict, str, list)) -> ApiResponse
259
-
260
- Updates one or more campaigns.
261
-
262
- body: | REQUIRED {'description': 'An array of campaigns.}'
263
-
264
- | '**campaignId**': *number*, {'description': 'The identifier of an existing campaign to update.'}
265
- | '**portfolioId**': *number*, {'description': 'The identifier of an existing portfolio to which the campaign is associated'}
266
- | '**name**': *string*, {'description': 'The name for the campaign'}
267
- | '**tags**': *CampaignTags*, {'description': 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers.'}
268
- | '**state**': *string*, {'description': 'The current resource state.', 'Enum': '[ enabled, paused, archived ]'}
269
- | '**dailyBudget**': *number($float)*, {'description': 'The daily budget for the campaign.'}
270
- | '**startDate**': *string*, {'description': 'The starting date for the campaign to go live. The format of the date is YYYYMMDD.'}
271
- | '**endDate**': *string* nullable: true, {'description': 'The ending date for the campaign to stop running. The format of the date is YYYYMMDD.'}
272
- | '**premiumBidAdjustment**': *boolean*, {'description': 'If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.'}
273
- | '**bidding**': *Bidding*, {'strategy': 'string', 'Enum': '[ legacyForSales, autoForSales, manual ]', 'adjustments': '{...}'}
274
-
275
- Returns:
276
-
277
- ApiResponse
278
-
279
- """
280
- body = Utils.convert_body(kwargs.pop('body'))
281
- return self._request(kwargs.pop('path'), data=body, params=kwargs)
282
-
283
- @sp_endpoint('/v2/sp/campaigns', method='GET')
284
- @Utils.deprecated
285
- def list_campaigns(self, **kwargs) -> ApiResponse:
286
- r"""
287
- list_campaigns(**kwargs) -> ApiResponse
288
-
289
- Gets an array of campaigns.
290
-
291
- query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
292
-
293
- query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
294
-
295
- query **stateFilter**:*string* | Optional. The returned array is filtered to include only ad groups with state set to one of the values in the specified comma-delimited list. Available values : enabled, paused, archived, enabled, paused, enabled, archived, paused, archived, enabled, paused, archived Default value : enabled, paused, archived.
296
-
297
- query **name**:*string* | Optional. Restricts results to campaigns with the specified name.
298
-
299
- query **portfolioIdFilter**:*string* | Optional. A comma-delimited list of portfolio identifiers.
300
-
301
- query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
302
-
303
- Returns:
304
-
305
- ApiResponse
306
-
307
- """
308
- return self._request(kwargs.pop('path'), params=kwargs)
309
-
310
- @sp_endpoint('/v2/sp/campaigns/{}', method='GET')
311
- @Utils.deprecated
312
- def get_campaign(self, campaignId, **kwargs) -> ApiResponse:
313
- r"""
314
-
315
- get_campaign(campaignId: int) -> ApiResponse
316
-
317
- Gets a campaign specified by identifier.
318
-
319
- path **campaignId**:*number* | Required. The identifier of an existing campaign.
320
-
321
- Returns:
322
-
323
- ApiResponse
324
-
325
- """
326
- return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
327
-
328
- @sp_endpoint('/v2/sp/campaigns/{}', method='DELETE')
329
- @Utils.deprecated
330
- def delete_campaign(self, campaignId, **kwargs) -> ApiResponse:
13
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
14
+ # @sp_endpoint('/v2/sp/campaigns', method='PUT')
15
+ # @Utils.deprecated
16
+ # def edit_single_campaign_assistant(
17
+ # self,
18
+ # campaign_id: int,
19
+ # portfolio_id: int = None,
20
+ # campaign_name: str = None,
21
+ # po_number: str = None,
22
+ # account_manager: str = None,
23
+ # campaign_status: str = None,
24
+ # daily_budget: int = None,
25
+ # start_date: str = None,
26
+ # end_date: str = None,
27
+ # premium_bid_adjustment: bool = None,
28
+ # strategy: str = None,
29
+ # predicate: str or tuple = None,
30
+ # percentage: str or tuple = None,
31
+ # **kwargs,
32
+ # ) -> ApiResponse:
33
+ # r"""
34
+ # edit_single_campaign_assistant(campaign_id: int, portfolio_id: int = None, campaign_name: str, po_number: str = None, account_manager: str = None, campaign_status: str = None, daily_budget: int, start_date: str, end_date: str = None, premium_bid_adjustment: bool = None, strategy:str = None, predicate:str or tuple = None, percentage:int or tuple = None, **kwargs) -> ApiResponse
35
+ #
36
+ # Edit one campaigns and create the body based on the params provided, at least one of the optional params need to be set or a INVALID_ARGUMENT code is thorwn
37
+ #
38
+ # Kwargs:
39
+ # | **campaign_id** (number): [required] The identifier of an existing campaign to update.
40
+ # | **portfolio_id** (number): [optional] The identifier of an existing portfolio to which the campaign is associated
41
+ # | **campaign_name** (string): [optional] A name for the campaign
42
+ # | **po_number** (string): [optional] 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
43
+ # | **account_manager** (string): [optional] A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
44
+ # | **campaign_status**': (string): [optional] The current resource state Values: enabled, paused, archived. Default: enabled
45
+ # | **daily_budget** (float): [optional] A daily budget for the campaign
46
+ # | **start_date** (string): [optional] A starting date for the campaign to go live. The format of the date is YYYYMMDD
47
+ # | **end_date** (string): [optional] An ending date for the campaign to stop running. The format of the date is YYYYMMDD
48
+ # | **premium_bid_adjustment**' (boolean): [optional] If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information. Tip: When Campaign has been adopted to enhanced bidding premiumBidAdjustment can not be set
49
+ # | **strategy** (string): [optional] The bidding strategy. 'Values': legacyForSales (Dynamic bids - down only), autoForSales (Dynamic bids - up and down), manual (Fixed bid)
50
+ # | **predicate** (string or tuple(str)): [optional] You can enable controls to adjust your bid based on the placement location. Specify a location where you want to use bid controls. The percentage value set is the percentage of the original bid for which you want to have your bid adjustment increased. For example, a 50% adjustment on a $1.00 bid would increase the bid to $1.50 for the opportunity to win a specified placement. 'Values': placementTop (str), placementProductPage (str), ("placementTop", "placementProductPage") (tuple)
51
+ # | **percentage** (float or tuple(float)): [optional] The bid adjustment percentage value. Example: 15 (float), (15, 25) (tuple)
52
+ #
53
+ # Returns:
54
+ #
55
+ # ApiResponse
56
+ #
57
+ # """
58
+ #
59
+ # optional = {}
60
+ #
61
+ # if portfolio_id is not None:
62
+ # optional.update({'portfolioId': portfolio_id})
63
+ #
64
+ # if campaign_name is not None:
65
+ # optional.update({'name': campaign_name})
66
+ #
67
+ # if po_number is not None and account_manager is not None:
68
+ # optional.update({"tags": {'PONumber': po_number, 'accountManager': account_manager}})
69
+ #
70
+ # if campaign_status is not None:
71
+ # optional.update({'state': campaign_status})
72
+ #
73
+ # if daily_budget is not None:
74
+ # optional.update({'dailyBudget': daily_budget})
75
+ #
76
+ # if start_date is not None:
77
+ # optional.update({'startDate': start_date})
78
+ #
79
+ # if end_date is not None:
80
+ # optional.update({'endDate': end_date})
81
+ #
82
+ # if premium_bid_adjustment is not None:
83
+ # optional.update({'premiumBidAdjustment': premium_bid_adjustment})
84
+ #
85
+ # if strategy is not None and predicate is None and percentage is None:
86
+ # optional.update({'bidding': {'strategy': strategy, 'adjustments': []}})
87
+ #
88
+ # if strategy is not None and predicate is not None and percentage is not None:
89
+ # if isinstance(predicate, str):
90
+ # optional.update(
91
+ # {
92
+ # 'bidding': {
93
+ # 'strategy': strategy,
94
+ # 'adjustments': [{'predicate': predicate, 'percentage': percentage}],
95
+ # }
96
+ # }
97
+ # )
98
+ #
99
+ # if isinstance(predicate, tuple) and len(predicate) == 2 and len(percentage) == 2:
100
+ # options = []
101
+ # for i in range(len(predicate)):
102
+ # option = {"predicate": predicate[i], "percentage": percentage[i]}
103
+ # options.append(option)
104
+ #
105
+ # bidding = {'strategy': strategy, 'adjustments': options}
106
+ #
107
+ # dictionary = {}
108
+ # dictionary["bidding"] = bidding
109
+ #
110
+ # optional.update(dictionary)
111
+ #
112
+ # required = {
113
+ # 'campaignId': campaign_id,
114
+ # }
115
+ #
116
+ # if not optional:
117
+ # description = 'No changes submitted for entity %s' % campaign_id
118
+ # obj = [{'code': 'INVALID_ARGUMENT', 'description': description}]
119
+ # return ApiResponse(obj)
120
+ # else:
121
+ # required.update(optional)
122
+ # data_str = json.dumps([required])
123
+ # return self._request(kwargs.pop('path'), data=data_str, params=kwargs)
124
+ #
125
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
126
+ # @sp_endpoint('/v2/sp/campaigns', method='POST')
127
+ # @Utils.deprecated
128
+ # def create_single_campaign_assistant(
129
+ # self,
130
+ # campaign_name: str,
131
+ # targeting_type: str,
132
+ # daily_budget: int,
133
+ # start_date: str,
134
+ # end_date: str = None,
135
+ # campaign_status: str = "enabled",
136
+ # portfolio_id: int = None,
137
+ # po_number: str = None,
138
+ # account_manager: str = None,
139
+ # premium_bid_adjustment: bool = None,
140
+ # strategy: str = None,
141
+ # predicate: str or tuple = None,
142
+ # percentage: int or tuple = None,
143
+ # **kwargs,
144
+ # ) -> ApiResponse:
145
+ # r"""
146
+ # create_single_campaign_assistant(campaign_name: str,targeting_type: str, daily_budget: int, start_date: str, end_date: str = None, campaign_status: str = "enabled", portfolio_id: int = None, po_number: str = None, account_manager: str = None, premium_bid_adjustment: bool = False, strategy:str = None, predicate:str = None, percentage:int = None, **kwargs) -> ApiResponse
147
+ #
148
+ # Creates one campaigns and create the body based on the params provided
149
+ #
150
+ # Kwargs:
151
+ #
152
+ # | **campaign_name** (string): [required] A name for the campaign
153
+ # | **campaign_type** (string): [fixed] The advertising product managed by this campaign. Value: sponsoredProducts
154
+ # | **targeting_type** (string): [required] The type of targeting for the campaign. Values: manual, auto
155
+ # | **daily_budget** (float): [required] A daily budget for the campaign
156
+ # | **start_date** (string): [required] A starting date for the campaign to go live. The format of the date is YYYYMMDD
157
+ # | **end_date** (string): [optional] An ending date for the campaign to stop running. The format of the date is YYYYMMDD
158
+ # | **campaign_status**': (string): [optional] The current resource state Values: enabled, paused, archived. Default: enabled
159
+ # | **portfolio_id** (number): [optional] The identifier of an existing portfolio to which the campaign is associated
160
+ # | **po_number** (string): [optional] 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
161
+ # | **account_manager** (string): [optional] A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers
162
+ # | **premium_bid_adjustment**' (boolean) If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.
163
+ # | **strategy** (string): [optional] The bidding strategy. 'Values': legacyForSales (Dynamic bids - down only), autoForSales (Dynamic bids - up and down), manual (Fixed bid)
164
+ # | **predicate** (string): [optional] You can enable controls to adjust your bid based on the placement location. Specify a location where you want to use bid controls. The percentage value set is the percentage of the original bid for which you want to have your bid adjustment increased. For example, a 50% adjustment on a $1.00 bid would increase the bid to $1.50 for the opportunity to win a specified placement. 'Values': placementTop, placementProductPage
165
+ # | **percentage** (float): [optional] The bid adjustment percentage value.
166
+ #
167
+ # Returns:
168
+ #
169
+ # ApiResponse
170
+ #
171
+ # """
172
+ #
173
+ # optional = {}
174
+ #
175
+ # if portfolio_id is not None:
176
+ # optional.update({'portfolioId': portfolio_id})
177
+ #
178
+ # if po_number is not None and account_manager is not None:
179
+ # optional.update({"tags": {'PONumber': po_number, 'accountManager': account_manager}})
180
+ #
181
+ # if end_date is not None:
182
+ # optional.update({'endDate': end_date})
183
+ #
184
+ # if premium_bid_adjustment is not None:
185
+ # optional.update({'premiumBidAdjustment': premium_bid_adjustment})
186
+ #
187
+ # if strategy is not None and predicate is not None and percentage is not None:
188
+ # if isinstance(predicate, str):
189
+ # optional.update(
190
+ # {
191
+ # 'bidding': {
192
+ # 'strategy': strategy,
193
+ # 'adjustments': [{'predicate': predicate, 'percentage': percentage}],
194
+ # }
195
+ # }
196
+ # )
197
+ #
198
+ # if isinstance(predicate, tuple) and len(predicate) == 2 and len(percentage) == 2:
199
+ # options = []
200
+ # for i in range(len(predicate)):
201
+ # option = {"predicate": predicate[i], "percentage": percentage[i]}
202
+ # options.append(option)
203
+ #
204
+ # bidding = {'strategy': strategy, 'adjustments': options}
205
+ #
206
+ # dictionary = {}
207
+ # dictionary["bidding"] = bidding
208
+ #
209
+ # optional.update(dictionary)
210
+ #
211
+ # required = {
212
+ # 'name': campaign_name,
213
+ # 'campaignType': 'sponsoredProducts',
214
+ # 'targetingType': targeting_type,
215
+ # 'state': campaign_status,
216
+ # 'dailyBudget': daily_budget,
217
+ # 'startDate': start_date,
218
+ # }
219
+ #
220
+ # if optional:
221
+ # required.update(optional)
222
+ #
223
+ # data_str = json.dumps([required])
224
+ # return self._request(kwargs.pop('path'), data=data_str, params=kwargs)
225
+ #
226
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
227
+ # @sp_endpoint('/v2/sp/campaigns', method='POST')
228
+ # @Utils.deprecated
229
+ # def create_campaigns(self, **kwargs) -> ApiResponse:
230
+ # r"""
231
+ # create_campaigns(body: (dict, str, list)) -> ApiResponse
232
+ #
233
+ # Creates one or more campaigns.
234
+ #
235
+ # body: | REQUIRED {'description': 'An array of campaigns.}'
236
+ #
237
+ # | '**portfolioId**': *number*, {'description': 'The identifier of an existing portfolio to which the campaign is associated'}
238
+ # | '**name**': *string*, {'description': 'A name for the campaign'}
239
+ # | '**tags**': *string*, {'description': 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers.'}
240
+ # | '**campaignType**': *string*, {'description': 'The advertising product managed by this campaign', 'Enum': '[ sponsoredProducts ]'}
241
+ # | '**targetingType**': *string*, {'description': 'The type of targeting for the campaign.', 'Enum': '[ manual, auto ]'}
242
+ # | '**state**': *string*, {'description': 'The current resource state.', 'Enum': '[ enabled, paused, archived ]'}
243
+ # | '**dailyBudget**': *number($float)*, {'description': 'A daily budget for the campaign.'}
244
+ # | '**startDate**': *string*, {'description': 'A starting date for the campaign to go live. The format of the date is YYYYMMDD.'}
245
+ # | '**endDate**': *string* nullable: true, {'description': 'An ending date for the campaign to stop running. The format of the date is YYYYMMDD.'}
246
+ # | '**premiumBidAdjustment**': *boolean*, {'description': 'If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.'}
247
+ # | '**bidding**': *Bidding*, {'strategy': 'string', 'Enum': '[ legacyForSales, autoForSales, manual ]', 'adjustments': '{...}'}
248
+ #
249
+ # Returns:
250
+ #
251
+ # ApiResponse
252
+ #
253
+ # """
254
+ # body = Utils.convert_body(kwargs.pop('body'))
255
+ # return self._request(kwargs.pop('path'), data=body, params=kwargs)
256
+ #
257
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
258
+ # @sp_endpoint('/v2/sp/campaigns', method='PUT')
259
+ # @Utils.deprecated
260
+ # def edit_campaigns(self, **kwargs) -> ApiResponse:
261
+ # r"""
262
+ # edit_campaigns(body: (dict, str, list)) -> ApiResponse
263
+ #
264
+ # Updates one or more campaigns.
265
+ #
266
+ # body: | REQUIRED {'description': 'An array of campaigns.}'
267
+ #
268
+ # | '**campaignId**': *number*, {'description': 'The identifier of an existing campaign to update.'}
269
+ # | '**portfolioId**': *number*, {'description': 'The identifier of an existing portfolio to which the campaign is associated'}
270
+ # | '**name**': *string*, {'description': 'The name for the campaign'}
271
+ # | '**tags**': *CampaignTags*, {'description': 'A list of advertiser-specified custom identifiers for the campaign. Each customer identifier is a key-value pair. You can specify a maximum of 50 identifiers.'}
272
+ # | '**state**': *string*, {'description': 'The current resource state.', 'Enum': '[ enabled, paused, archived ]'}
273
+ # | '**dailyBudget**': *number($float)*, {'description': 'The daily budget for the campaign.'}
274
+ # | '**startDate**': *string*, {'description': 'The starting date for the campaign to go live. The format of the date is YYYYMMDD.'}
275
+ # | '**endDate**': *string* nullable: true, {'description': 'The ending date for the campaign to stop running. The format of the date is YYYYMMDD.'}
276
+ # | '**premiumBidAdjustment**': *boolean*, {'description': 'If set to true, Amazon increases the default bid for ads that are eligible to appear in this placement. See developer notes for more information.'}
277
+ # | '**bidding**': *Bidding*, {'strategy': 'string', 'Enum': '[ legacyForSales, autoForSales, manual ]', 'adjustments': '{...}'}
278
+ #
279
+ # Returns:
280
+ #
281
+ # ApiResponse
282
+ #
283
+ # """
284
+ # body = Utils.convert_body(kwargs.pop('body'))
285
+ # return self._request(kwargs.pop('path'), data=body, params=kwargs)
286
+ #
287
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
288
+ # @sp_endpoint('/v2/sp/campaigns', method='GET')
289
+ # @Utils.deprecated
290
+ # def list_campaigns(self, **kwargs) -> ApiResponse:
291
+ # r"""
292
+ # list_campaigns(**kwargs) -> ApiResponse
293
+ #
294
+ # Gets an array of campaigns.
295
+ #
296
+ # query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
297
+ #
298
+ # query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
299
+ #
300
+ # query **stateFilter**:*string* | Optional. The returned array is filtered to include only ad groups with state set to one of the values in the specified comma-delimited list. Available values : enabled, paused, archived, enabled, paused, enabled, archived, paused, archived, enabled, paused, archived Default value : enabled, paused, archived.
301
+ #
302
+ # query **name**:*string* | Optional. Restricts results to campaigns with the specified name.
303
+ #
304
+ # query **portfolioIdFilter**:*string* | Optional. A comma-delimited list of portfolio identifiers.
305
+ #
306
+ # query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
307
+ #
308
+ # Returns:
309
+ #
310
+ # ApiResponse
311
+ #
312
+ # """
313
+ # return self._request(kwargs.pop('path'), params=kwargs)
314
+ #
315
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
316
+ # @sp_endpoint('/v2/sp/campaigns/{}', method='GET')
317
+ # @Utils.deprecated
318
+ # def get_campaign(self, campaignId, **kwargs) -> ApiResponse:
319
+ # r"""
320
+ #
321
+ # get_campaign(campaignId: int) -> ApiResponse
322
+ #
323
+ # Gets a campaign specified by identifier.
324
+ #
325
+ # path **campaignId**:*number* | Required. The identifier of an existing campaign.
326
+ #
327
+ # Returns:
328
+ #
329
+ # ApiResponse
330
+ #
331
+ # """
332
+ # return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
333
+ #
334
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
335
+ # @sp_endpoint('/v2/sp/campaigns/{}', method='DELETE')
336
+ # @Utils.deprecated
337
+ # def delete_campaign(self, campaignId, **kwargs) -> ApiResponse:
338
+ # r"""
339
+ #
340
+ # delete_campaign(campaignId: int) -> ApiResponse
341
+ #
342
+ # Sets the campaign status to archived. Archived entities cannot be made active again. See developer notes for more information.
343
+ #
344
+ # path **campaignId**:*number* | Required. The identifier of an existing campaign.
345
+ #
346
+ # Returns:
347
+ #
348
+ # ApiResponse
349
+ #
350
+ # """
351
+ # return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
352
+ #
353
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
354
+ # @sp_endpoint('/v2/sp/campaigns/extended', method='GET')
355
+ # @Utils.deprecated
356
+ # def list_campaigns_extended(self, **kwargs) -> ApiResponse:
357
+ # r"""
358
+ # list_campaigns_extended(**kwargs) -> ApiResponse
359
+ #
360
+ # Gets an array of campaigns with extended data fields.
361
+ #
362
+ # query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
363
+ #
364
+ # query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
365
+ #
366
+ # query **stateFilter**:*string* | Optional. The returned array is filtered to include only ad groups with state set to one of the values in the specified comma-delimited list. Available values : enabled, paused, archived, enabled, paused, enabled, archived, paused, archived, enabled, paused, archived Default value : enabled, paused, archived.
367
+ #
368
+ # query **name**:*string* | Optional. Restricts results to campaigns with the specified name.
369
+ #
370
+ # query **portfolioIdFilter**:*string* | Optional. A comma-delimited list of portfolio identifiers.
371
+ #
372
+ # query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
373
+ #
374
+ # Returns:
375
+ #
376
+ # ApiResponse
377
+ #
378
+ # """
379
+ # return self._request(kwargs.pop('path'), params=kwargs)
380
+ #
381
+ # DEPRECATED v2 — superseded by v1 endpoints. Kept commented for reference.
382
+ # @sp_endpoint('/v2/sp/campaigns/extended/{}', method='GET')
383
+ # @Utils.deprecated
384
+ # def get_campaign_extended(self, campaignId, **kwargs) -> ApiResponse:
385
+ # r"""
386
+ # get_campaign_extended(campaignId: int) -> ApiResponse
387
+ #
388
+ # Gets an array of campaigns with extended data fields.
389
+ #
390
+ # path **campaignId**:*number* | Required. The identifier of an existing campaign.
391
+ #
392
+ # Returns:
393
+ #
394
+ # ApiResponse
395
+ #
396
+ # """
397
+ # return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
398
+ #
399
+ @sp_endpoint('/adsApi/v1/query/campaigns', method='POST')
400
+ def query_campaigns(self, **kwargs) -> ApiResponse:
331
401
  r"""
402
+ query_campaigns(body: dict) -> ApiResponse
332
403
 
333
- delete_campaign(campaignId: int) -> ApiResponse
334
-
335
- Sets the campaign status to archived. Archived entities cannot be made active again. See developer notes for more information.
404
+ Amazon Ads API v1 - Query Campaigns (operationId: QueryCampaign)
336
405
 
337
- path **campaignId**:*number* | Required. The identifier of an existing campaign.
406
+ Request Body [Required]
407
+ | **adProductFilter** (dict): [required]
408
+ | **include** (list<AdProduct>) : Enum [ AMAZON_DSP, SPONSORED_BRANDS, SPONSORED_DISPLAY, SPONSORED_PRODUCTS, SPONSORED_TELEVISION ]
409
+ | **campaignIdFilter** (dict) [optional]
410
+ | **include** (list<string>) : Campaign identifiers
411
+ | **goalFilter** (dict) [optional]
412
+ | **include** (list<Goal>) : Enum [ AWARENESS, CONSIDERATION, CONVERSIONS ]
413
+ | **marketplaceScopeFilter** (dict) [optional]
414
+ | **include** (list<MarketplaceScope>) : Enum [ GLOBAL, SINGLE_MARKETPLACE ]
415
+ | **nameFilter** (dict) [optional]
416
+ | **include** (list<string>) : Campaign names
417
+ | **queryTermMatchType** (string) : [required] Enum [ BROAD_MATCH, EXACT_MATCH ]
418
+ | **portfolioIdFilter** (dict) [optional]
419
+ | **include** (list<string>) : Portfolio identifiers
420
+ | **retailerScopeFilter** (dict) [optional]
421
+ | **include** (list<RetailerScope>) : Enum [ AMAZON, OTHER_RETAILERS ]
422
+ | **stateFilter** (dict) [optional]
423
+ | **include** (list<State>) : Enum [ ARCHIVED, DRAFT, ENABLED, PAUSED ]
424
+ | **maxResults** (int) [optional] Minimum 1, Maximum 1000
425
+ | **nextToken** (string) [optional] Token to navigate to the next page
338
426
 
339
- Returns:
427
+ Headers
428
+ | **Amazon-Ads-AccountId** (string) [optional] Advertiser account identifier
340
429
 
430
+ Returns
341
431
  ApiResponse
432
+ | **campaigns** (list), **nextToken** (string)
342
433
 
343
434
  """
344
- return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
435
+ schema_version = 'application/json'
436
+ headers = {"Accept": schema_version, "Content-Type": schema_version}
437
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
345
438
 
346
- @sp_endpoint('/v2/sp/campaigns/extended', method='GET')
347
- @Utils.deprecated
348
- def list_campaigns_extended(self, **kwargs) -> ApiResponse:
439
+ @sp_endpoint('/adsApi/v1/delete/campaigns', method='POST')
440
+ def delete_campaigns(self, **kwargs) -> ApiResponse:
349
441
  r"""
350
- list_campaigns_extended(**kwargs) -> ApiResponse
351
-
352
- Gets an array of campaigns with extended data fields.
353
-
354
- query **startIndex**:*integer* | Optional. 0-indexed record offset for the result set. Default value : 0
442
+ delete_campaigns(body: dict) -> ApiResponse
355
443
 
356
- query **count**:*integer* | Optional. Number of records to include in the paged response. Defaults to max page size.
444
+ Amazon Ads API v1 - Delete Campaigns (operationId: DeleteCampaign)
357
445
 
358
- query **stateFilter**:*string* | Optional. The returned array is filtered to include only ad groups with state set to one of the values in the specified comma-delimited list. Available values : enabled, paused, archived, enabled, paused, enabled, archived, paused, archived, enabled, paused, archived Default value : enabled, paused, archived.
359
-
360
- query **name**:*string* | Optional. Restricts results to campaigns with the specified name.
361
-
362
- query **portfolioIdFilter**:*string* | Optional. A comma-delimited list of portfolio identifiers.
363
-
364
- query **campaignIdFilter**:*string* | Optional. A comma-delimited list of campaign identifiers.
446
+ Request Body [Required]
447
+ | **campaignIds** (list<string>) : [required] Campaign identifiers to delete
365
448
 
366
- Returns:
449
+ Headers
450
+ | **Amazon-Ads-AccountId** (string) [optional] Advertiser account identifier
367
451
 
452
+ Returns
368
453
  ApiResponse
454
+ | **207** MultiStatus response with partial errors. Inspect the payload
455
+ to know which campaign ids succeeded and which failed.
369
456
 
370
457
  """
371
- return self._request(kwargs.pop('path'), params=kwargs)
458
+ schema_version = 'application/json'
459
+ headers = {"Accept": schema_version, "Content-Type": schema_version}
460
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
372
461
 
373
- @sp_endpoint('/v2/sp/campaigns/extended/{}', method='GET')
374
- @Utils.deprecated
375
- def get_campaign_extended(self, campaignId, **kwargs) -> ApiResponse:
462
+ @sp_endpoint('/adsApi/v1/update/campaigns', method='POST')
463
+ def update_campaigns(self, **kwargs) -> ApiResponse:
376
464
  r"""
377
- get_campaign_extended(campaignId: int) -> ApiResponse
465
+ update_campaigns(body: dict) -> ApiResponse
378
466
 
379
- Gets an array of campaigns with extended data fields.
467
+ Amazon Ads API v1 - Update Campaigns (operationId: UpdateCampaign)
380
468
 
381
- path **campaignId**:*number* | Required. The identifier of an existing campaign.
469
+ Request Body [Required]
470
+ | **campaigns** (list<dict>) : [required] One or more campaign objects to update.
471
+ Each object requires **campaignId** and may include any of the fields below.
472
+
473
+ Campaign fields [optional except campaignId]
474
+ | **campaignId** (string) : [required] The identifier of the campaign to update.
475
+ | **adProduct** (string) : Enum [ AMAZON_DSP, SPONSORED_BRANDS, SPONSORED_DISPLAY, SPONSORED_PRODUCTS, SPONSORED_TELEVISION ]
476
+ | **name** (string) : The name of the campaign.
477
+ | **state** (string) : Enum [ DRAFT, ENABLED, PAUSED ]
478
+ | **budgets** (list<dict>) : Budget objects for the campaign.
479
+ | **startDateTime** (string) : Campaign start date and time.
480
+ | **endDateTime** (string) : Campaign end date and time.
481
+ | **portfolioId** (string) : The identifier of the portfolio.
482
+ | **purchaseOrderNumber** (string) : Advertiser purchase order number.
483
+ | **tags** (list<dict>) : Advertiser-specified custom identifiers.
484
+ | **marketplaces** (list<dict>) : Marketplaces where the campaign runs.
485
+ | **marketplaceConfigurations** (list<dict>) : Per-marketplace overrides.
486
+ | **countries** (list<string>) : Country codes.
487
+ | **costType** (string) : Enum [ CPC, CPM, FIXED_PRICE, VCPM ]
488
+ | **fees** (list<dict>) : Fee definitions.
489
+ | **flights** (list<dict>) : Flight schedules.
490
+ | **frequencies** (list<dict>) : Frequency cap definitions.
491
+ | **optimizations** (dict) : Campaign optimization settings.
492
+ | **siteRestrictions** (list<dict>) : Site restrictions.
493
+ | **skanAppId** (string) : SKAdNetwork app id.
494
+ | **targetedPGDealId** (string) : Targeted programmatic guaranteed deal id.
495
+ | **adomains** (list<string>) : Ad domains.
382
496
 
383
- Returns:
497
+ Headers
498
+ | **Amazon-Ads-AccountId** (string) [optional] Advertiser account identifier
384
499
 
500
+ Returns
385
501
  ApiResponse
502
+ | **207** MultiStatus response with partial errors. Inspect the payload
503
+ to know which campaigns succeeded and which failed.
386
504
 
387
505
  """
388
- return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs)
506
+ schema_version = 'application/json'
507
+ headers = {"Accept": schema_version, "Content-Type": schema_version}
508
+ return self._request(kwargs.pop('path'), data=Utils.convert_body(kwargs.pop('body'), False), params=kwargs, headers=headers)
389
509
 
390
- @sp_endpoint('/adsApi/v1/query/campaigns', method='POST')
391
- def query_campaigns(self, **kwargs) -> ApiResponse:
510
+ @sp_endpoint('/adsApi/v1/create/campaigns', method='POST')
511
+ def create_campaigns(self, **kwargs) -> ApiResponse:
392
512
  r"""
393
- query_campaigns(body: dict) -> ApiResponse
513
+ create_campaigns(body: dict) -> ApiResponse
394
514
 
395
- Amazon Ads API v1 - Query Campaigns (operationId: QueryCampaign)
515
+ Amazon Ads API v1 - Create Campaigns (operationId: CreateCampaign)
396
516
 
397
517
  Request Body [Required]
398
- | **adProductFilter** (dict): [required]
399
- | **include** (list<AdProduct>) : Enum [ AMAZON_DSP, SPONSORED_BRANDS, SPONSORED_DISPLAY, SPONSORED_PRODUCTS, SPONSORED_TELEVISION ]
400
- | **campaignIdFilter** (dict) [optional]
401
- | **include** (list<string>) : Campaign identifiers
402
- | **goalFilter** (dict) [optional]
403
- | **include** (list<Goal>) : Enum [ AWARENESS, CONSIDERATION, CONVERSIONS ]
404
- | **marketplaceScopeFilter** (dict) [optional]
405
- | **include** (list<MarketplaceScope>) : Enum [ GLOBAL, SINGLE_MARKETPLACE ]
406
- | **nameFilter** (dict) [optional]
407
- | **include** (list<string>) : Campaign names
408
- | **queryTermMatchType** (string) : [required] Enum [ BROAD_MATCH, EXACT_MATCH ]
409
- | **portfolioIdFilter** (dict) [optional]
410
- | **include** (list<string>) : Portfolio identifiers
411
- | **retailerScopeFilter** (dict) [optional]
412
- | **include** (list<RetailerScope>) : Enum [ AMAZON, OTHER_RETAILERS ]
413
- | **stateFilter** (dict) [optional]
414
- | **include** (list<State>) : Enum [ ARCHIVED, DRAFT, ENABLED, PAUSED ]
415
- | **maxResults** (int) [optional] Minimum 1, Maximum 1000
416
- | **nextToken** (string) [optional] Token to navigate to the next page
518
+ | **campaigns** (list<dict>) : [required] One or more campaign objects to create.
519
+ Each object requires **adProduct**, **name** and **state**.
520
+
521
+ Campaign fields
522
+ | **adProduct** (string) : [required] Enum [ AMAZON_DSP, SPONSORED_BRANDS, SPONSORED_DISPLAY, SPONSORED_PRODUCTS, SPONSORED_TELEVISION ]
523
+ | **name** (string) : [required] The name of the campaign.
524
+ | **state** (string) : [required] Enum [ DRAFT, ENABLED, PAUSED ]
525
+ | **budgets** (list<dict>) : Budget objects for the campaign.
526
+ | **budgetType** (string) : [required] Budget type.
527
+ | **budgetValue** (dict) : [required] Budget amount.
528
+ | **recurrenceTimePeriod** (string) : [required] Recurrence period.
529
+ | **startDateTime** (string) : Campaign start date and time.
530
+ | **endDateTime** (string) : Campaign end date and time.
531
+ | **portfolioId** (string) : The identifier of the portfolio.
532
+ | **purchaseOrderNumber** (string) : Advertiser purchase order number.
533
+ | **tags** (list<dict>) : [required key+value] Advertiser-specified custom identifiers.
534
+ | **marketplaces** (list<dict>) : Marketplaces where the campaign runs.
535
+ | **marketplaceConfigurations** (list<dict>) : Per-marketplace overrides, each with
536
+ **marketplace** and **overrides** (both required).
537
+ | **countries** (list<string>) : Country codes.
538
+ | **costType** (string) : Enum [ CPC, CPM, FIXED_PRICE, VCPM ]
539
+ | **fees** (list<dict>) : [required feeType+feeValue+feeValueType] Fee definitions.
540
+ | **flights** (list<dict>) : [required budget+startDateTime+endDateTime] Flight schedules.
541
+ | **frequencies** (list<dict>) : [required eventMaxCount+frequencyTargetingSetting+
542
+ timeCount+timeUnit] Frequency cap definitions.
543
+ | **optimizations** (dict) : Campaign optimization settings.
544
+ | **siteRestrictions** (list<dict>) : Site restrictions.
545
+ | **brandId** (string) : Brand identifier.
546
+ | **skanAppId** (string) : SKAdNetwork app id.
547
+ | **targetedPGDealId** (string) : Targeted programmatic guaranteed deal id.
548
+ | **adomains** (list<string>) : Ad domains.
549
+ | **autoCreationSettings** (dict) : Automatic creation settings.
417
550
 
418
551
  Headers
419
552
  | **Amazon-Ads-AccountId** (string) [optional] Advertiser account identifier
420
553
 
421
554
  Returns
422
555
  ApiResponse
423
- | **campaigns** (list), **nextToken** (string)
556
+ | **207** MultiStatus response with partial errors. Inspect the payload
557
+ to know which campaigns were created and which failed.
424
558
 
425
559
  """
426
560
  schema_version = 'application/json'
ad_api/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.9.7"
1
+ __version__ = "0.9.8"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-amazon-ad-api
3
- Version: 0.9.7
3
+ Version: 0.9.8
4
4
  Summary: Python wrapper for the Amazon Advertising API
5
5
  Home-page: https://github.com/denisneuf/python-amazon-ad-api
6
6
  Author: Daniel Alvaro
@@ -299,6 +299,34 @@ There is a new version 3 Portfolios API, please check the [migration guide](http
299
299
  * [Get test account information](https://python-amazon-ad-api.readthedocs.io/en/latest/api/advertising_test_account.html#ad_api.api.AdvertisingTestAccount.AdvertisingTestAccount.get_test_account)
300
300
 
301
301
 
302
+ ### Sponsored Products v1 (new)
303
+
304
+ New unified endpoint generation. Campaigns are queried with a single `POST /adsApi/v1/query/campaigns` resource instead of the versioned v2/v3 endpoints.
305
+
306
+ | Method | Endpoint | Body |
307
+ |---|---|---|
308
+ | `query_campaigns` | `POST /adsApi/v1/query/campaigns` | filters + `maxResults`/`nextToken` |
309
+ | `create_campaigns` | `POST /adsApi/v1/create/campaigns` | `campaigns[]` (`adProduct`, `name`, `state` required) |
310
+ | `update_campaigns` | `POST /adsApi/v1/update/campaigns` | `campaigns[]` (`campaignId` required) |
311
+ | `delete_campaigns` | `POST /adsApi/v1/delete/campaigns` | `campaignIds[]` |
312
+
313
+ All four return a **207 MultiStatus** response (except `query_campaigns`, which returns 200), so check the payload for per-entity errors.
314
+
315
+ ```python
316
+ from ad_api.api import sponsored_products
317
+
318
+ result = sponsored_products.Campaigns(credentials=credentials, debug=True).query_campaigns(
319
+ body={
320
+ "adProductFilter": {"include": ["SPONSORED_PRODUCTS"]},
321
+ "stateFilter": {"include": ["ENABLED"]},
322
+ "maxResults": 100,
323
+ }
324
+ )
325
+
326
+ campaigns = result.payload.get("campaigns")
327
+ next_token = result.payload.get("nextToken")
328
+ ```
329
+
302
330
  ### [Modules Available Sponsored Products 2.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sp_v2.html)
303
331
 
304
332
  Warning: [PLANNED DEPRECATION 6/30/2023]
@@ -307,6 +335,8 @@ There is a new version 3 of Sponsored Product API, please check the [migration g
307
335
 
308
336
  ### [Modules Available Sponsored Products 3.0](https://python-amazon-ad-api.readthedocs.io/en/latest/sp_v3.html)
309
337
 
338
+ Warning: `list_campaigns` is deprecated. Use the v1 `query_campaigns` method instead.
339
+
310
340
 
311
341
  * [ThemeBased Bid Recommendation](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/bid_recommendations_v3.html)
312
342
  * [Keyword Recommendations](https://python-amazon-ad-api.readthedocs.io/en/latest/sp/ranked_keywords_recommendations.html)
@@ -375,7 +405,9 @@ There is a new version 3 of Sponsored Product API, please check the [migration g
375
405
 
376
406
  * [Reports](https://python-amazon-ad-api.readthedocs.io/en/latest/dsp/reports.html)
377
407
 
378
- ### Simple Example Usage Campaigns with Credentials
408
+ ### Simple Example Usage Campaigns with Credentials (v3, legacy)
409
+
410
+ Warning: this example uses `CampaignsV3.list_campaigns`, which is deprecated. See the v1 `query_campaigns` example above.
379
411
 
380
412
  ```python
381
413
  import logging
@@ -443,4 +475,4 @@ We are not affiliated with Amazon but they used our api :)
443
475
 
444
476
 
445
477
  ---
446
- *Last release: v0.8.9 (via electroduende automated release random access memory)*
478
+ *Last release: v0.9.7*
@@ -1,5 +1,5 @@
1
1
  ad_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- ad_api/version.py,sha256=RcQa7EaTs304WhxJ7lAJ_lelzmRpmed8pgcM1EYP3bo,22
2
+ ad_api/version.py,sha256=GI3Cr15wC6XhdahtMoSOf62d2gYve5G_PiR_xx_RGKc,22
3
3
  ad_api/api/__init__.py,sha256=rurlFrTJZgSGNdkEahAJGjDAVll2KyCqpLpV40ZKI6o,1487
4
4
  ad_api/api/account.py,sha256=CmOvCfHoPWaeTUJvtB0pNoNulZVSz4oMMCKIpVTpHos,2931
5
5
  ad_api/api/advertising_test_account.py,sha256=btOVbdk2tBDmyKSJaQbcIFyzNG8KFJVUmTe4p9xMhpU,1507
@@ -83,7 +83,7 @@ ad_api/api/sp/campaign_consolidated_recommendations.py,sha256=AZS8A0ZH_GRCZ5uExq
83
83
  ad_api/api/sp/campaign_negative_keywords.py,sha256=4Jj8CFt4YX36N4YhXDDVabOiPOfCtQ2kYqYoS2Xejoc,6344
84
84
  ad_api/api/sp/campaign_negative_keywords_v3.py,sha256=3y5PHA_r6GtBAFbAXiGH5q6ByWsG2alA3DCqdRiaO3w,6592
85
85
  ad_api/api/sp/campaign_negative_targets.py,sha256=5fzt3wU1omOrGELtwSs4-R1BCcaT8z5H0StjJfCuc9k,8310
86
- ad_api/api/sp/campaigns.py,sha256=wd-pymoFGTs9dY2C0GJfLUPrb6QDqot9dshOCp_Rsck,22142
86
+ ad_api/api/sp/campaigns.py,sha256=L_6lHAT3mrwyP9K4xqwgMBTzth5_oSMSNZNhpaVoH6o,30910
87
87
  ad_api/api/sp/campaigns_budget_usage.py,sha256=njn-Wd3xvbJbL5HMSNQK4RyxCgAflqUgVFo7XhlXmB8,862
88
88
  ad_api/api/sp/campaigns_v3.py,sha256=enxuRqoyBeidwR9J5VcPHFDRbiy2G6EEQqKRyaJPI5I,7831
89
89
  ad_api/api/sp/campaings_optimization.py,sha256=CrH9x-KNTsRc56tn_TCDxDTZIF9pYdqDT48LTepys2w,6673
@@ -118,8 +118,8 @@ ad_api/base/exceptions.py,sha256=9D3M40ZIlLS0fA-aQh1BTWPOW-Nvf0tRhbA85jFnDJ4,438
118
118
  ad_api/base/helpers.py,sha256=naUkDLK466x_OBCPXxMlzRc2nPC6iQ6H_vyUji0MJJ0,2282
119
119
  ad_api/base/marketplaces.py,sha256=44lvCcluXNpqTprWQ80e3weSQmQbJoWL-WDSOWVbCyQ,4657
120
120
  ad_api/base/utils.py,sha256=_qnCBOvyJTLgaZjJzUWTi38GGLHkQszXELs79133Rb4,5618
121
- python_amazon_ad_api-0.9.7.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
122
- python_amazon_ad_api-0.9.7.dist-info/METADATA,sha256=mz_J6Z90WCi6dWmxvtaoRUindIHVgmdkwhgzZgHYtCM,19168
123
- python_amazon_ad_api-0.9.7.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
124
- python_amazon_ad_api-0.9.7.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
125
- python_amazon_ad_api-0.9.7.dist-info/RECORD,,
121
+ python_amazon_ad_api-0.9.8.dist-info/licenses/LICENSE,sha256=h2rpqlmmLy-4l1tN6KpWAFxx1JEMYeEFrMrZUbx_B_o,1105
122
+ python_amazon_ad_api-0.9.8.dist-info/METADATA,sha256=9mf-kIA1iXGxcU5F7Dn7z8L8FrWEhvHnxmJRkQcaCk4,20491
123
+ python_amazon_ad_api-0.9.8.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
124
+ python_amazon_ad_api-0.9.8.dist-info/top_level.txt,sha256=nN9twUos-8pkP514ZwpvRU9YL9L2XyQyHsMQFfudGTU,7
125
+ python_amazon_ad_api-0.9.8.dist-info/RECORD,,