|
| 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