Skip to content

Commit 1cb019d

Browse files
committed
added common resources: eligibility, invoices, metadata, profiles
1 parent 604b961 commit 1cb019d

5 files changed

Lines changed: 231 additions & 0 deletions

File tree

ad_api/api/__init__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from .profiles import Profiles
2+
from .invoices import Invoices
3+
from .eligibility import Eligibility
4+
from .metadata import Metadata
5+
__all__ = [
6+
"Profiles",
7+
"Invoices",
8+
"Eligibility",
9+
"Metadata"
10+
]

ad_api/api/eligibility.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
2+
3+
class Eligibility(Client):
4+
5+
@sp_endpoint('/eligibility/product/list', method='POST')
6+
def get_eligibility(self, **kwargs) -> ApiResponse:
7+
r"""
8+
9+
get_eligibility(self, **kwargs) -> ApiResponse
10+
11+
Gets advertising eligibility status for a list of products.
12+
13+
body: | REQUIRED
14+
15+
'**adType**': *string*, {'description': 'Set to 'sp' to check product eligibility for Sponsored Products advertisements. Set to 'sb' to check product eligibility for Sponsored Brands advertisements. default: sp. [ sp, sb ]'}
16+
17+
'**productDetailsList**': *dict*, {'asin*': 'An Amazon product identifier.', 'sku': 'A seller product identifier'}
18+
19+
'**locale**': *string*, {'description': 'Set to the locale string in the table below to specify the language in which the response is returned.'}
20+
21+
Returns:
22+
23+
ApiResponse
24+
25+
"""
26+
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs)

ad_api/api/invoices.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
2+
3+
class Invoices(Client):
4+
5+
@sp_endpoint('/invoices', method='GET')
6+
def list_invoices(self, **kwargs) -> ApiResponse:
7+
r"""
8+
9+
list_invoices(self, **kwargs) -> ApiResponse
10+
11+
Get invoices for advertiser. Requires one of these permissions: ["nemo_transactions_view","nemo_transactions_edit"]
12+
13+
query **invoiceStatuses**:*string* | Optional. Available values : ISSUED, PAID_IN_PART, PAID_IN_FULL, WRITTEN_OFF.
14+
query **count**:*string* | Optional. Number of records to include in the paged response. Defaults to 100. Cannot be combined with the cursor parameter.
15+
query **cursor**:*string* | Optional. A cursor representing how far into a result set this query should begin. In the absence of a cursor the request will default to start index of 0 and page size of 100.
16+
17+
18+
Returns:
19+
20+
ApiResponse
21+
22+
"""
23+
return self._request(kwargs.pop('path'), params=kwargs)
24+
25+
@sp_endpoint('/invoices/{}', method='GET')
26+
def get_invoice(self, invoiceId, **kwargs) -> ApiResponse:
27+
r"""
28+
29+
get_invoice(self, invoiceId, **kwargs) -> ApiResponse
30+
31+
Get invoice data by invoice ID. Requires one of these permissions: ["nemo_transactions_view","nemo_transactions_edit"]
32+
33+
path **invoiceId**:*string* | Optional. Available values : ISSUED, PAID_IN_PART, PAID_IN_FULL, WRITTEN_OFF.
34+
35+
Returns:
36+
37+
ApiResponse
38+
39+
"""
40+
return self._request(fill_query_params(kwargs.pop('path'), invoiceId), params=kwargs)

ad_api/api/metadata.py

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
2+
3+
class Metadata(Client):
4+
5+
@sp_endpoint('/product/metadata', method='POST')
6+
def get_products_metadata(self, **kwargs) -> ApiResponse:
7+
r"""
8+
9+
get_products_metadata(self, **kwargs) -> ApiResponse
10+
11+
Returns product metadata for the advertiser.
12+
13+
body: | REQUIRED
14+
15+
'**asins**': *list>string*, {'description': 'Specific asins to search for in the advertiser's inventory. Cannot use together with skus or searchStr input types.'}
16+
17+
'**checkItemDetails**': *boolean*, {'description': 'Whether item details such as name, image, and price is required. default: false'}
18+
19+
'**cursorToken**': *string*, {'description': 'Pagination token used for the suggested sort type'}
20+
21+
'**adType**': *string*, {'description': 'Program type. Required if checks advertising eligibility. Enum: [ SP, SB, SD ]'}
22+
23+
'**skus**': *list>string*, {'description': 'Specific skus to search for in the advertiser's inventory. Currently only support SP program type for sellers. Cannot use together with asins or searchStr input types'}
24+
25+
'**checkEligibility**': *boolean*, {'description': 'Whether advertising eligibility info is required. default: false'}
26+
27+
'**searchStr**': *string*, {'description': 'Specific string in the item title to search for in the advertiser's inventory. Case insensitive. Cannot use together with asins or skus input types'}
28+
29+
'**pageIndex**': *integer($int32)*, {'description*': 'Index of the page to be returned'}
30+
31+
'**sortOrder**': *string*, {'description': 'Sort order (has to be DESC for the suggested sort type). default: DESC. Enum [ ASC, DESC ]'}
32+
33+
'**pageSize**': *integer($int32)*, {'description*': 'Number of items to be returned on this page index (max 100 for author)'}
34+
35+
'**sortBy**': *string*, {'description': 'Sort option for the result. Currently only support SP program type for sellers. Enum [ SUGGESTED, CREATED_DATE ]'}
36+
37+
38+
39+
Returns:
40+
41+
ApiResponse
42+
43+
"""
44+
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs)

ad_api/api/profiles.py

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
2+
3+
class Profiles(Client):
4+
5+
@sp_endpoint('/v2/profiles', method='GET')
6+
def list_profiles(self, **kwargs) -> ApiResponse:
7+
r"""
8+
9+
list_profiles(self, **kwargs) -> ApiResponse
10+
11+
Gets a list of profiles.
12+
13+
query **apiProgram**:*string* | Optional. Filters response to include profiles that have permissions for the specified Advertising API program only. Available values : billing, campaign, paymentMethod, store, report, account, posts
14+
15+
query **accessLevel**:*string* | Optional. Filters response to include profiles that have specified permissions for the specified Advertising API program only. Available values : edit, view
16+
17+
query **profileTypeFilter**:*string* | Optional. Filters response to include profiles that are of the specified types in the comma-delimited list. Available values : seller, vendor, agency
18+
19+
query **validPaymentMethodFilter**:*string* | Optional. Filter response to include profiles that have valid payment methods. Available values : true, false
20+
21+
22+
Returns:
23+
24+
ApiResponse
25+
26+
"""
27+
return self._request(kwargs.pop('path'), params=kwargs)
28+
29+
@sp_endpoint('/v2/profiles', method='PUT')
30+
def update_profile(self, **kwargs) -> ApiResponse:
31+
r"""
32+
33+
update_profile(self, **kwargs) -> ApiResponse
34+
35+
Update the daily budget for one or more profiles. Note that this operation is only used for Sellers using Sponsored Products.
36+
37+
body: | REQUIRED {'description': 'An array of ad groups.}'
38+
39+
| '**profileId**': *integer($int64)*, {'description': 'The identifier of the profile.'}
40+
| '**countryCode**': *string*, {'description': 'The countryCode for a given country'}
41+
| '**currencyCode**': *string*, {'description': 'The currency used for all monetary values for entities under this profile.'}
42+
| '**dailyBudget**': *number*, {'description': 'Note that this field applies to Sponsored Product campaigns for seller type accounts only. Not supported for vendor type accounts.'}
43+
| '**timezone**': *string*, {'description': 'The time zone used for all date-based campaign management and reporting.'}
44+
| '**accountInfo**': *AccountInfoAccountInfo*, {}
45+
46+
Returns:
47+
48+
ApiResponse
49+
50+
"""
51+
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs)
52+
53+
@sp_endpoint('/v2/profiles/{}', method='GET')
54+
def get_profile(self, profileId, **kwargs) -> ApiResponse:
55+
r"""
56+
57+
get_profile(self, profileId, **kwargs) -> ApiResponse
58+
59+
Gets a profile specified by identifier.
60+
61+
path **profileId**:*number* | Required. The identifier of an existing profile Id.
62+
63+
64+
Returns:
65+
66+
ApiResponse
67+
68+
"""
69+
return self._request(fill_query_params(kwargs.pop('path'), profileId), params=kwargs)
70+
71+
72+
@sp_endpoint('/v2/profiles/registerBrand', method='PUT')
73+
def register_brand(self, **kwargs) -> ApiResponse:
74+
r"""
75+
76+
register_brand(self, **kwargs) -> ApiResponse
77+
78+
SANDBOX ONLY - Create a vendor profile for sandbox.
79+
80+
body: | REQUIRED
81+
82+
'**countryCode**': *string*, {'description': 'The countryCode for a given country'}
83+
'**brand**': *string*, {'description': 'The brand for the vendor account'}
84+
85+
86+
Returns:
87+
88+
ApiResponse
89+
90+
"""
91+
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs)
92+
93+
@sp_endpoint('/v2/profiles/register', method='PUT')
94+
def register(self, **kwargs) -> ApiResponse:
95+
r"""
96+
97+
register_brand(self, \*\*kwargs) -> ApiResponse
98+
99+
SANDBOX ONLY - Create a seller profile for sandbox.
100+
101+
body: REQUIRED
102+
103+
'**countryCode**': *string*, {'description': 'The countryCode for a given country'}
104+
105+
106+
Returns:
107+
108+
ApiResponse
109+
110+
"""
111+
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs)

0 commit comments

Comments
 (0)