-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added common resources: eligibility, invoices, metadata, profiles
- Loading branch information
Showing
5 changed files
with
231 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from .profiles import Profiles | ||
from .invoices import Invoices | ||
from .eligibility import Eligibility | ||
from .metadata import Metadata | ||
__all__ = [ | ||
"Profiles", | ||
"Invoices", | ||
"Eligibility", | ||
"Metadata" | ||
] |
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,26 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class Eligibility(Client): | ||
|
||
@sp_endpoint('/eligibility/product/list', method='POST') | ||
def get_eligibility(self, **kwargs) -> ApiResponse: | ||
r""" | ||
get_eligibility(self, **kwargs) -> ApiResponse | ||
Gets advertising eligibility status for a list of products. | ||
body: | REQUIRED | ||
'**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 ]'} | ||
'**productDetailsList**': *dict*, {'asin*': 'An Amazon product identifier.', 'sku': 'A seller product identifier'} | ||
'**locale**': *string*, {'description': 'Set to the locale string in the table below to specify the language in which the response is returned.'} | ||
Returns: | ||
ApiResponse | ||
""" | ||
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,40 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class Invoices(Client): | ||
|
||
@sp_endpoint('/invoices', method='GET') | ||
def list_invoices(self, **kwargs) -> ApiResponse: | ||
r""" | ||
list_invoices(self, **kwargs) -> ApiResponse | ||
Get invoices for advertiser. Requires one of these permissions: ["nemo_transactions_view","nemo_transactions_edit"] | ||
query **invoiceStatuses**:*string* | Optional. Available values : ISSUED, PAID_IN_PART, PAID_IN_FULL, WRITTEN_OFF. | ||
query **count**:*string* | Optional. Number of records to include in the paged response. Defaults to 100. Cannot be combined with the cursor parameter. | ||
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. | ||
Returns: | ||
ApiResponse | ||
""" | ||
return self._request(kwargs.pop('path'), params=kwargs) | ||
|
||
@sp_endpoint('/invoices/{}', method='GET') | ||
def get_invoice(self, invoiceId, **kwargs) -> ApiResponse: | ||
r""" | ||
get_invoice(self, invoiceId, **kwargs) -> ApiResponse | ||
Get invoice data by invoice ID. Requires one of these permissions: ["nemo_transactions_view","nemo_transactions_edit"] | ||
path **invoiceId**:*string* | Optional. Available values : ISSUED, PAID_IN_PART, PAID_IN_FULL, WRITTEN_OFF. | ||
Returns: | ||
ApiResponse | ||
""" | ||
return self._request(fill_query_params(kwargs.pop('path'), invoiceId), 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,44 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class Metadata(Client): | ||
|
||
@sp_endpoint('/product/metadata', method='POST') | ||
def get_products_metadata(self, **kwargs) -> ApiResponse: | ||
r""" | ||
get_products_metadata(self, **kwargs) -> ApiResponse | ||
Returns product metadata for the advertiser. | ||
body: | REQUIRED | ||
'**asins**': *list>string*, {'description': 'Specific asins to search for in the advertiser's inventory. Cannot use together with skus or searchStr input types.'} | ||
'**checkItemDetails**': *boolean*, {'description': 'Whether item details such as name, image, and price is required. default: false'} | ||
'**cursorToken**': *string*, {'description': 'Pagination token used for the suggested sort type'} | ||
'**adType**': *string*, {'description': 'Program type. Required if checks advertising eligibility. Enum: [ SP, SB, SD ]'} | ||
'**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'} | ||
'**checkEligibility**': *boolean*, {'description': 'Whether advertising eligibility info is required. default: false'} | ||
'**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'} | ||
'**pageIndex**': *integer($int32)*, {'description*': 'Index of the page to be returned'} | ||
'**sortOrder**': *string*, {'description': 'Sort order (has to be DESC for the suggested sort type). default: DESC. Enum [ ASC, DESC ]'} | ||
'**pageSize**': *integer($int32)*, {'description*': 'Number of items to be returned on this page index (max 100 for author)'} | ||
'**sortBy**': *string*, {'description': 'Sort option for the result. Currently only support SP program type for sellers. Enum [ SUGGESTED, CREATED_DATE ]'} | ||
Returns: | ||
ApiResponse | ||
""" | ||
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,111 @@ | ||
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse | ||
|
||
class Profiles(Client): | ||
|
||
@sp_endpoint('/v2/profiles', method='GET') | ||
def list_profiles(self, **kwargs) -> ApiResponse: | ||
r""" | ||
list_profiles(self, **kwargs) -> ApiResponse | ||
Gets a list of profiles. | ||
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 | ||
query **accessLevel**:*string* | Optional. Filters response to include profiles that have specified permissions for the specified Advertising API program only. Available values : edit, view | ||
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 | ||
query **validPaymentMethodFilter**:*string* | Optional. Filter response to include profiles that have valid payment methods. Available values : true, false | ||
Returns: | ||
ApiResponse | ||
""" | ||
return self._request(kwargs.pop('path'), params=kwargs) | ||
|
||
@sp_endpoint('/v2/profiles', method='PUT') | ||
def update_profile(self, **kwargs) -> ApiResponse: | ||
r""" | ||
update_profile(self, **kwargs) -> ApiResponse | ||
Update the daily budget for one or more profiles. Note that this operation is only used for Sellers using Sponsored Products. | ||
body: | REQUIRED {'description': 'An array of ad groups.}' | ||
| '**profileId**': *integer($int64)*, {'description': 'The identifier of the profile.'} | ||
| '**countryCode**': *string*, {'description': 'The countryCode for a given country'} | ||
| '**currencyCode**': *string*, {'description': 'The currency used for all monetary values for entities under this profile.'} | ||
| '**dailyBudget**': *number*, {'description': 'Note that this field applies to Sponsored Product campaigns for seller type accounts only. Not supported for vendor type accounts.'} | ||
| '**timezone**': *string*, {'description': 'The time zone used for all date-based campaign management and reporting.'} | ||
| '**accountInfo**': *AccountInfoAccountInfo*, {} | ||
Returns: | ||
ApiResponse | ||
""" | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs) | ||
|
||
@sp_endpoint('/v2/profiles/{}', method='GET') | ||
def get_profile(self, profileId, **kwargs) -> ApiResponse: | ||
r""" | ||
get_profile(self, profileId, **kwargs) -> ApiResponse | ||
Gets a profile specified by identifier. | ||
path **profileId**:*number* | Required. The identifier of an existing profile Id. | ||
Returns: | ||
ApiResponse | ||
""" | ||
return self._request(fill_query_params(kwargs.pop('path'), profileId), params=kwargs) | ||
|
||
|
||
@sp_endpoint('/v2/profiles/registerBrand', method='PUT') | ||
def register_brand(self, **kwargs) -> ApiResponse: | ||
r""" | ||
register_brand(self, **kwargs) -> ApiResponse | ||
SANDBOX ONLY - Create a vendor profile for sandbox. | ||
body: | REQUIRED | ||
'**countryCode**': *string*, {'description': 'The countryCode for a given country'} | ||
'**brand**': *string*, {'description': 'The brand for the vendor account'} | ||
Returns: | ||
ApiResponse | ||
""" | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs) | ||
|
||
@sp_endpoint('/v2/profiles/register', method='PUT') | ||
def register(self, **kwargs) -> ApiResponse: | ||
r""" | ||
register_brand(self, \*\*kwargs) -> ApiResponse | ||
SANDBOX ONLY - Create a seller profile for sandbox. | ||
body: REQUIRED | ||
'**countryCode**': *string*, {'description': 'The countryCode for a given country'} | ||
Returns: | ||
ApiResponse | ||
""" | ||
return self._request(kwargs.pop('path'), data=kwargs.pop('body'), params=kwargs) |