-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
668 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class BudgetRecommendations(Client): | ||
|
||
@sp_endpoint('/sp/campaigns/budgetRecommendations', method='POST') | ||
def list_campaigns_budget_recommendations(self, **kwargs) -> ApiResponse: | ||
contentType = 'application/vnd.budgetrecommendation.v3+json' | ||
headers = {'Content-Type': contentType} | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers) | ||
# return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class BudgetRules(Client): | ||
|
||
@sp_endpoint('/sp/campaigns/{}/budgetRules/budgetHistory', method='GET') | ||
def get_budget_history(self, campaignId, **kwargs) -> ApiResponse: | ||
return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs) | ||
|
||
@sp_endpoint('/sp/budgetRules', method='POST') | ||
def create_budget_rules(self, **kwargs) -> ApiResponse: | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs) | ||
|
||
@sp_endpoint('/sp/budgetRules', method='GET') | ||
def list_budget_rules(self, **kwargs) -> ApiResponse: | ||
return self._request(kwargs.pop('path'), params=kwargs) | ||
|
||
@sp_endpoint('/sp/budgetRules', method='PUT') | ||
def edit_budget_rules(self, **kwargs) -> ApiResponse: | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs) | ||
|
||
@sp_endpoint('/sp/budgetRules/{}', method='GET') | ||
def get_budget_rule(self, budgetRuleId, **kwargs) -> ApiResponse: | ||
return self._request(fill_query_params(kwargs.pop('path'), budgetRuleId), params=kwargs) | ||
|
||
@sp_endpoint('/sp/budgetRules/{}/campaigns', method='GET') | ||
def get_campaigns_budget_rule(self, budgetRuleId, **kwargs) -> ApiResponse: | ||
return self._request(fill_query_params(kwargs.pop('path'), budgetRuleId), params=kwargs) | ||
|
||
@sp_endpoint('/sp/campaigns/{}/budgetRules', method='POST') | ||
def create_campaign_budget_rules(self, campaignId, **kwargs) -> ApiResponse: | ||
return self._request(fill_query_params(kwargs.pop('path'), campaignId), data=kwargs.pop('body'), params=kwargs) | ||
|
||
@sp_endpoint('/sp/campaigns/{}/budgetRules', method='GET') | ||
def get_budget_rules_campaign(self, campaignId, **kwargs) -> ApiResponse: | ||
return self._request(fill_query_params(kwargs.pop('path'), campaignId), params=kwargs) | ||
|
||
@sp_endpoint('/sp/campaigns/{}/budgetRules/{}', method='DELETE') | ||
def delete_budget_rule_campaign(self, campaignId, budgetRuleId, **kwargs) -> ApiResponse: | ||
return self._request(fill_query_params(kwargs.pop('path'), campaignId, budgetRuleId), params=kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class BudgetRulesRecommendations(Client): | ||
|
||
@sp_endpoint('/sp/campaigns/budgetRules/recommendations', method='POST') | ||
def list_campaigns_budget_rules_recommendations(self, **kwargs) -> ApiResponse: | ||
contentType = 'application/vnd.spbudgetrulesrecommendation.v3+json' | ||
headers = {'Content-Type': contentType} | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers) | ||
# return self._request(fill_query_params(kwargs.pop('path')), data=kwargs.pop('body'), params=kwargs) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class CampaignOptimization(Client): | ||
""" | ||
Sponsored Products Targeting API. | ||
Documentation: https://advertising.amazon.com/API/docs/en-us/sponsored-products/3-0/openapi/prod#/ | ||
Specification: https://dtrnk0o2zy01c.cloudfront.net/openapi/en-us/dest/SponsoredProducts_prod_3p.json | ||
""" | ||
|
||
@sp_endpoint('/sp/rules/campaignOptimization/eligibility', method='POST') | ||
def list_campaigns_optimization_eligibility(self, **kwargs) -> ApiResponse: | ||
contentType = 'application/vnd.optimizationrules.v1+json' | ||
headers = {'Content-Type': contentType} | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers) | ||
|
||
@sp_endpoint('/sp/rules/campaignOptimization/{}', method='GET') | ||
def get_budget_campaign_optimization(self, campaignOptimizationId, **kwargs) -> ApiResponse: | ||
return self._request(fill_query_params(kwargs.pop('path'), campaignOptimizationId), params=kwargs) | ||
|
||
@sp_endpoint('/sp/rules/campaignOptimization/{}', method='DELETE') | ||
def delete_budget_campaign_optimization(self, campaignOptimizationId, **kwargs) -> ApiResponse: | ||
return self._request(fill_query_params(kwargs.pop('path'), campaignOptimizationId), params=kwargs) | ||
|
||
@sp_endpoint('/sp/rules/campaignOptimization', method='POST') | ||
def create_budget_campaign_optimization(self, **kwargs) -> ApiResponse: | ||
contentType = 'application/vnd.optimizationrules.v1+json' | ||
headers = {'Content-Type': contentType} | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers) | ||
|
||
@sp_endpoint('/sp/rules/campaignOptimization', method='PUT') | ||
def edit_budget_campaign_optimization(self, **kwargs) -> ApiResponse: | ||
contentType = 'application/vnd.optimizationrules.v1+json' | ||
headers = {'Content-Type': contentType} | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers) | ||
|
||
@sp_endpoint('/sp/rules/campaignOptimization/state', method='POST') | ||
def get_state_budget_campaign_optimization(self, **kwargs) -> ApiResponse: | ||
contentType = 'application/vnd.optimizationrules.v1+json' | ||
headers = {'Content-Type': contentType} | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class ProductRecommendations(Client): | ||
|
||
@sp_endpoint('/sp/targets/products/recommendations', method='POST') | ||
def list_products_recommendations(self, **kwargs) -> ApiResponse: | ||
contentType = 'application/vnd.spproductrecommendation.v3+json' | ||
headers = {'Content-Type': contentType} | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs, headers=headers) | ||
|
Oops, something went wrong.