Skip to content

Commit

Permalink
Merge pull request #289 from BingAds/v13.0.21
Browse files Browse the repository at this point in the history
v13.0.21
  • Loading branch information
xinyuwen2 authored Jul 22, 2024
2 parents 91d506f + 12beb39 commit 7ce1d17
Show file tree
Hide file tree
Showing 46 changed files with 2,420 additions and 61 deletions.
10 changes: 10 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
.. :changelog:
Release History
13.0.21(2024-07-18)
+++++++++++++++++++++++++
* Update Bing Ads API Version 13 service proxies to reflect recent interface changes. For details please see the [Bing Ads API Release Notes](https://learn.microsoft.com/en-us/advertising/guides/release-notes?view=bingads-13).
* Added bulk mappings for new AudienceType:ImpressionBasedRemarketingList i.e., BulkImpressionBasedRemarketingList, BulkAdGroupImpressionBasedRemarketingListAssociation, BulkAdGroupNegativeImpressionBasedRemarketingListAssociation, BulkCampaignImpressionBasedRemarketingListAssociation and BulkCampaignNegativeImpressionBasedRemarketingListAssociation.
* Added bulk mappings for Goals i.e., BulkAppInstallGoal, BulkDurationGoal, BulkEventGoal, BulkInStoreTransactionGoal, BulkInStoreVisitGoal, BulkOfflineConversionGoal, BulkPagesViewedPerVisitGoal, BulkProductGoal and BulkUrlGoal.
* Added bulk mappings for BulkBrandItem, BulkBrandList and BulkCampaignBrandListAssociation.
* Added bulk mappings for BulkAssetGroupSearchTheme.
* Added mappings for new field in BulkCampaign: CostPerSaleOptOut.
* Changed DeviceTypeFilter to enum list in BulkSeasonlityAdjustment and BulkDataExclusion.

13.0.19.1(2024-04-09)
+++++++++++++++++++++++++
* Update Bing Ads API Version 13 service proxies to reflect recent interface changes. For details please see the Bing Ads API Release Notes: https://learn.microsoft.com/en-us/advertising/guides/release-notes?view=bingads-13.
Expand Down
2 changes: 1 addition & 1 deletion bingads/manifest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
VERSION = '13.0.19.1'
VERSION = '13.0.21'
BULK_FORMAT_VERSION_6 = '6.0'
WORKING_NAME = 'BingAdsSDKPython'
USER_AGENT = '{0} {1} {2}'.format(WORKING_NAME, VERSION, sys.version_info[0:3])
5 changes: 5 additions & 0 deletions bingads/v13/bulk/entities/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@
from .bulk_seasonality_adjustment import *
from .bulk_data_exclusion import *
from .bulk_account_negative_keyword_list import *
from .bulk_asset_group_search_theme import *
from .bulk_campaign_brand_list_association import *
from .bulk_brand_item import *
from .bulk_brand_list import *
from .goals import *
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def image_ad_extension(self, value):
),
_SimpleBulkMapping(
header=_StringTable.TrackingTemplate,
field_to_csv=lambda c: bulk_str(c.image_ad_extension.TrackingUrlTemplate),
field_to_csv=lambda c: bulk_optional_str(c.image_ad_extension.TrackingUrlTemplate, c.image_ad_extension.Id),
csv_to_field=lambda c, v: setattr(c.image_ad_extension, 'TrackingUrlTemplate', v if v else None)
),
_SimpleBulkMapping(
Expand Down
7 changes: 6 additions & 1 deletion bingads/v13/bulk/entities/audiences/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,9 @@
from .bulk_ad_group_negative_customer_list_association import *
from .bulk_campaign_customer_list_association import *
from .bulk_campaign_negative_customer_list_association import *
from .bulk_customer_list_item import *
from .bulk_customer_list_item import *
from .bulk_ad_group_impression_based_remarketing_list_association import *
from .bulk_ad_group_negative_impression_based_remarketing_list_association import *
from .bulk_campaign_impression_based_remarketing_list_association import *
from .bulk_campaign_negative_impression_based_remarketing_list_association import *
from .bulk_impression_based_remarketing_list import *
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from bingads.v13.bulk.entities.audiences.bulk_ad_group_audience_association import BulkAdGroupAudienceAssociation

class BulkAdGroupImpressionBasedRemarketingListAssociation(BulkAdGroupAudienceAssociation):
""" Represents an Ad Group Impression Based Remarketing List Association that can be read or written in a bulk file.
For more information, see Ad Group Impression Based Remarketing List Association at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from bingads.v13.bulk.entities.audiences.bulk_ad_group_negative_audience_association import BulkAdGroupNegativeAudienceAssociation

class BulkAdGroupNegativeImpressionBasedRemarketingListAssociation(BulkAdGroupNegativeAudienceAssociation):
""" Represents an Ad Group Negative Impression Based Remarketing List Association that can be read or written in a bulk file.
For more information, see Ad Group Negative Impression Based Remarketing List Association at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from bingads.v13.bulk.entities.audiences.bulk_campaign_audience_association import BulkCampaignAudienceAssociation

class BulkCampaignImpressionBasedRemarketingListAssociation(BulkCampaignAudienceAssociation):
""" Represents a Campaign Impression Based Remarketing List Association that can be read or written in a bulk file.
For more information, see Campaign Impression Based Remarketing List Association at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from bingads.v13.bulk.entities.audiences.bulk_campaign_negative_audience_association import BulkCampaignNegativeAudienceAssociation

class BulkCampaignNegativeImpressionBasedRemarketingListAssociation(BulkCampaignNegativeAudienceAssociation):
""" Represents a Campaign Negative Impression Based Remarketing List Association that can be read or written in a bulk file.
For more information, see Campaign Negative Impression Based Remarketing List Association at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from bingads.v13.bulk.entities import *
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13
from bingads.v13.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.bulk.string_table import _StringTable
from bingads.v13.internal.extensions import *
from .bulk_audience import BulkAudience

class BulkImpressionBasedRemarketingList(BulkAudience):
""" Represents a Impression Based Remarketing List that can be read or written in a bulk file.
This class exposes the :attr:`impression_based_remarketing_list` property that can be read and written as fields of the
Impression Based Remarketing List record in a bulk file.
For more information, see Impression Based Remarketing List at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""

def __init__(self,
impression_based_remarketing_list=None,
status=None,):
super(BulkImpressionBasedRemarketingList, self).__init__(audience = impression_based_remarketing_list, status = status)

_MAPPINGS = [
_SimpleBulkMapping(
_StringTable.ImpressionCampaignId,
field_to_csv=lambda c: bulk_str(c.impression_based_remarketing_list.CampaignId),
csv_to_field=lambda c, v: setattr(c.impression_based_remarketing_list, 'CampaignId', int(v) if v else None)
),
_SimpleBulkMapping(
_StringTable.ImpressionAdGroupId,
field_to_csv=lambda c: bulk_str(c.impression_based_remarketing_list.AdGroupId),
csv_to_field=lambda c, v: setattr(c.impression_based_remarketing_list, 'AdGroupId', int(v) if v else None)
),
_SimpleBulkMapping(
header=_StringTable.EntityType,
field_to_csv=lambda c: bulk_str(c.impression_based_remarketing_list.EntityType),
csv_to_field=lambda c, v: setattr(c.impression_based_remarketing_list, 'EntityType', v)
),
]

@property
def impression_based_remarketing_list(self):
""" Defines a Impression Based Remarketing List """

return self._audience

@impression_based_remarketing_list.setter
def impression_based_remarketing_list(self, impression_based_remarketing_list):
self._audience = impression_based_remarketing_list

def process_mappings_to_row_values(self, row_values, exclude_readonly_data):
self._validate_property_not_null(self.impression_based_remarketing_list, 'impression_based_remarketing_list')
super(BulkImpressionBasedRemarketingList, self).process_mappings_to_row_values(row_values, exclude_readonly_data)
self.convert_to_values(row_values, BulkImpressionBasedRemarketingList._MAPPINGS)

def process_mappings_from_row_values(self, row_values):
self.impression_based_remarketing_list = _CAMPAIGN_OBJECT_FACTORY_V13.create('ImpressionBasedRemarketingList')
super(BulkImpressionBasedRemarketingList, self).process_mappings_from_row_values(row_values)
row_values.convert_to_entity(self, BulkImpressionBasedRemarketingList._MAPPINGS)

2 changes: 1 addition & 1 deletion bingads/v13/bulk/entities/bulk_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def business_attributes(self, v):
),
_SimpleBulkMapping(
header=_StringTable.TrackingTemplate,
field_to_csv=lambda c: bulk_str(c.tracking_url_template),
field_to_csv=lambda c: bulk_optional_str(c.tracking_url_template, c.id),
csv_to_field=lambda c, v: setattr(c, '_tracking_url_template', v)
),
_SimpleBulkMapping(
Expand Down
2 changes: 1 addition & 1 deletion bingads/v13/bulk/entities/bulk_ad_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def quality_score_data(self):
),
_SimpleBulkMapping(
header=_StringTable.TrackingTemplate,
field_to_csv=lambda c: bulk_str(c.ad_group.TrackingUrlTemplate),
field_to_csv=lambda c: bulk_optional_str(c.ad_group.TrackingUrlTemplate, c.ad_group.Id),
csv_to_field=lambda c, v: setattr(c.ad_group, 'TrackingUrlTemplate', v if v else None)
),
_SimpleBulkMapping(
Expand Down
87 changes: 87 additions & 0 deletions bingads/v13/bulk/entities/bulk_asset_group_search_theme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13

from bingads.v13.internal.bulk.string_table import _StringTable
from bingads.v13.internal.bulk.entities.single_record_bulk_entity import _SingleRecordBulkEntity
from bingads.v13.internal.bulk.mappings import _SimpleBulkMapping
from bingads.v13.internal.extensions import *

class BulkAssetGroupSearchTheme(_SingleRecordBulkEntity):
""" Represents an asset group search theme.
This class exposes the property :attr:`asset_group_search_theme` that can be read and written as fields of the asset group search theme record
in a bulk file.
For more information, see asset group search theme at https://go.microsoft.com/fwlink/?linkid=846127.
*See also:*
* :class:`.BulkServiceManager`
* :class:`.BulkOperation`
* :class:`.BulkFileReader`
* :class:`.BulkFileWriter`
"""

def __init__(self, asset_group_id=None, asset_group_search_theme=None):
super(BulkAssetGroupSearchTheme, self).__init__()

self._asset_group_search_theme = asset_group_search_theme
self._asset_group_id = asset_group_id

@property
def asset_group_search_theme(self):
""" The AssetGroupSearchTheme Data Object of the Campaign Management Service.
A subset of AssetGroupSearchTheme properties are available in the Ad Group record.
For more information, see Ad Group at https://go.microsoft.com/fwlink/?linkid=846127.
"""
return self._asset_group_search_theme

@asset_group_search_theme.setter
def asset_group_search_theme(self, asset_group_search_theme):
self._asset_group_search_theme = asset_group_search_theme

@property
def asset_group_id(self):
""" The identifier of the asset group that contains the search theme.
Corresponds to the 'Parent Id' field in the bulk file.
:rtype: int
"""

return self._asset_group_id

@asset_group_id.setter
def asset_group_id(self, asset_group_id):
self._asset_group_id = asset_group_id


_MAPPINGS = [
_SimpleBulkMapping(
header=_StringTable.Id,
field_to_csv=lambda c: bulk_str(c.asset_group_search_theme.Id),
csv_to_field=lambda c, v: setattr(c.asset_group_search_theme, 'Id', int(v) if v else None)
),
_SimpleBulkMapping(
header=_StringTable.ParentId,
field_to_csv=lambda c: bulk_str(c.asset_group_id),
csv_to_field=lambda c, v: setattr(c, 'asset_group_id', int(v) if v else None)
),
_SimpleBulkMapping(
header=_StringTable.SearchTheme,
field_to_csv=lambda c: bulk_str(c.asset_group_search_theme.SearchTheme),
csv_to_field=lambda c, v: setattr(c.asset_group_search_theme, 'SearchTheme', v)
),
]

def process_mappings_from_row_values(self, row_values):
self.asset_group_search_theme = _CAMPAIGN_OBJECT_FACTORY_V13.create('AssetGroupSearchTheme')

row_values.convert_to_entity(self, BulkAssetGroupSearchTheme._MAPPINGS)

def process_mappings_to_row_values(self, row_values, exclude_readonly_data):
self._validate_property_not_null(self._asset_group_search_theme, 'AssetGroupSearchTheme')
self.convert_to_values(row_values, BulkAssetGroupSearchTheme._MAPPINGS)

def read_additional_data(self, stream_reader):
super(BulkAssetGroupSearchTheme, self).read_additional_data(stream_reader)
Loading

0 comments on commit 7ce1d17

Please sign in to comment.