private async Task CreateAdCustomizerMapping(long clientId, string feedResourceName, Dictionary<string, FeedAttribute> feedAttributes)
{
FeedMappingServiceClient feedMappingService = client.GetService(Services.V1.FeedMappingService);
FeedMapping feedMapping = new FeedMapping
{
Feed = feedResourceName,
PlaceholderType = PlaceholderType.DynamicCustom,
AttributeFieldMappings =
{
new AttributeFieldMapping
{
FeedAttributeId = feedAttributes[FeedAttributes.ID].Id,
AdCustomizerField = AdCustomizerPlaceholderField.String
},
new AttributeFieldMapping
{
FeedAttributeId = feedAttributes[FeedAttributes.ITEM_TITLE].Id,
AdCustomizerField = AdCustomizerPlaceholderField.String
},
new AttributeFieldMapping
{
FeedAttributeId = feedAttributes[FeedAttributes.FINAL_URL].Id,
AdCustomizerField = AdCustomizerPlaceholderField.String
},
new AttributeFieldMapping
{
FeedAttributeId = feedAttributes[FeedAttributes.ITEM_SUBTITLE].Id,
AdCustomizerField = AdCustomizerPlaceholderField.String
},
new AttributeFieldMapping
{
FeedAttributeId = feedAttributes[FeedAttributes.FORMATED_PRICE].Id,
AdCustomizerField = AdCustomizerPlaceholderField.Price
}
}
};
FeedMappingOperation operation = new FeedMappingOperation()
{
Create = feedMapping
};
MutateFeedMappingsResponse response = await feedMappingService.MutateFeedMappingsAsync(clientId.ToString(), new[] { operation }, true, false);
}