Skip to content

Commit

Permalink
update to version 11.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
qitia committed Aug 7, 2017
1 parent e158176 commit 5defff7
Show file tree
Hide file tree
Showing 32 changed files with 1,552 additions and 93 deletions.
11 changes: 11 additions & 0 deletions BingAdsApiSDK/BingAdsApiSDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@
<Compile Include="V11\Bulk\Entities\Audiences\BulkAdGroupNegativeRemarketingListAssociation.cs" />
<Compile Include="V11\Bulk\Entities\Audiences\BulkCustomAudience.cs" />
<Compile Include="V11\Bulk\Entities\Audiences\BulkInMarketAudience.cs" />
<Compile Include="V11\Bulk\Entities\BulkOfflineConversion.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkLabelAssociation.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkAdGroupLabel.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkAppInstallAdLabel.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkCampaignLabel.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkDynamicSearchAdLabel.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkExpandedTextAdLabel.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkKeywordLabel.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkLabel.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkProductAdLabel.cs" />
<Compile Include="V11\Bulk\Entities\Labels\BulkTextAdLabel.cs" />
<Compile Include="V11\Bulk\Entities\TargetCriterions\BulkAdGroupAgeCriterion.cs" />
<Compile Include="V11\Bulk\Entities\TargetCriterions\BulkAdGroupDayTimeCriterion.cs" />
<Compile Include="V11\Bulk\Entities\TargetCriterions\BulkAdGroupDeviceCriterion.cs" />
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2592,7 +2592,7 @@ public System.Nullable<System.DateTime> LastModifiedTime
}

/// <summary>
/// The primary country where the customer operates. This country will be the default country for ad groups in the customer's campaigns. For a list of customer market country code values, see Ad Languages.
/// The primary country where the customer operates. For a list of customer market country code values, see Product Language.
/// </summary>
[System.Runtime.Serialization.DataMemberAttribute()]
public string MarketCountry
Expand Down Expand Up @@ -2632,7 +2632,7 @@ public string MarketCountry
}

/// <summary>
/// The primary language that the customer uses. This language will be the default language for ad groups in the customer's campaigns. For a list of customer market language code values, see Ad Languages.
/// The primary language that the customer uses. Your customer market language determines the language of the Bing Ads interface. For a list of customer market language code values, see Product Language.
/// </summary>
[System.Runtime.Serialization.DataMemberAttribute(Order=8)]
public System.Nullable<Microsoft.BingAds.V11.CustomerManagement.LanguageType> MarketLanguage
Expand Down
192 changes: 132 additions & 60 deletions BingAdsApiSDK/Proxies/V11/Reporting/ReportingServiceProxy.cs

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions BingAdsApiSDK/V10/Bulk/BulkFileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.BingAds.V10.Bulk.Entities;
using Microsoft.BingAds.V10.Internal.Bulk;
Expand Down Expand Up @@ -91,6 +92,19 @@ public BulkFileReader(string filePath, ResultFileType resultFileType, Bulk.Downl
_bulkStreamReader = new BulkStreamReader(filePath, fileFormat);
}

/// <summary>
/// Initializes a new instance of this class with the specified stream.
/// </summary>
/// <param name="stream">The stream to read.</param>
/// <param name="resultFileType">The result file type.</param>
/// <param name="fileFormat">The bulk file format.</param>
public BulkFileReader(Stream stream, ResultFileType resultFileType, Bulk.DownloadFileType fileFormat)
{
_isForFullDownload = resultFileType == ResultFileType.FullDownload;

_bulkStreamReader = new BulkStreamReader(stream, fileFormat);
}

/// <summary>
/// For unit testing
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions BingAdsApiSDK/V10/Bulk/BulkFileWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
//=====================================================================================================================================================

using System;
using System.IO;
using Microsoft.BingAds.V10.Bulk.Entities;
using Microsoft.BingAds.V10.Internal.Bulk;
using Microsoft.BingAds.V10.Internal.Bulk.Entities;
Expand Down Expand Up @@ -83,6 +84,17 @@ public BulkFileWriter(string filePath, DownloadFileType fileFormat)

}

/// <summary>
/// Initializes a new instance of this class with the specified stream.
/// </summary>
/// <param name="stream">The stream to write.</param>
/// <param name="fileFormat">The bulk file format.</param>
public BulkFileWriter(Stream stream, DownloadFileType fileFormat)
: this(new BulkObjectWriter(stream, fileFormat))
{

}

/// <summary>
/// For unit tests
/// </summary>
Expand Down
8 changes: 8 additions & 0 deletions BingAdsApiSDK/V10/Internal/Bulk/BulkObjectReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@


using System;
using System.IO;

namespace Microsoft.BingAds.V10.Internal.Bulk
{
Expand All @@ -69,6 +70,13 @@ public BulkObjectReader(string fileName, char delimiter)
_bulkObjectFactory = new BulkObjectFactory();
}

public BulkObjectReader(Stream stream, char delimiter)
{
_csvReader = new CsvReader(stream, delimiter);

_bulkObjectFactory = new BulkObjectFactory();
}

/// <summary>
/// For unit tests
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions BingAdsApiSDK/V10/Internal/Bulk/BulkObjectWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ public BulkObjectWriter(string fileName, DownloadFileType fileFormat)

}

public BulkObjectWriter(Stream stream, DownloadFileType fileFormat)
: this(new StreamWriter(stream, Encoding.UTF8), new BulkObjectFactory(), new CsvTextFormatter(fileFormat))
{

}

/// <summary>
/// For unit testing
/// </summary>
Expand Down
13 changes: 12 additions & 1 deletion BingAdsApiSDK/V10/Internal/Bulk/BulkStreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
//=====================================================================================================================================================

using System;
using System.IO;
using Microsoft.BingAds.Internal;
using Microsoft.BingAds.V10.Bulk;

Expand All @@ -62,7 +63,12 @@ internal class BulkStreamReader : IBulkStreamReader

public BulkStreamReader(string fileName, DownloadFileType fileType)
{
_bulkObjectReader = new BulkObjectReader(fileName, fileType == DownloadFileType.Csv ? ',' : '\t');
_bulkObjectReader = new BulkObjectReader(fileName, GetDelimiter(fileType));
}

public BulkStreamReader(Stream stream, DownloadFileType fileType)
{
_bulkObjectReader = new BulkObjectReader(stream, GetDelimiter(fileType));
}

internal BulkStreamReader(IBulkObjectReader reader)
Expand Down Expand Up @@ -189,5 +195,10 @@ protected virtual void Dispose(bool disposing)
}
}
}

private static char GetDelimiter(DownloadFileType fileType)
{
return fileType == DownloadFileType.Csv ? ',' : '\t';
}
}
}
5 changes: 5 additions & 0 deletions BingAdsApiSDK/V10/Internal/Bulk/CsvReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public CsvReader(string fileName, char delimiter)
{
}

public CsvReader(Stream stream, char delimiter)
: base(new StreamReader(stream), delimiter)
{
}

/// <summary>
/// For unit tests
/// </summary>
Expand Down
14 changes: 14 additions & 0 deletions BingAdsApiSDK/V11/Bulk/BulkFileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.BingAds.V11.Bulk.Entities;
using Microsoft.BingAds.V11.Internal.Bulk;
Expand Down Expand Up @@ -91,6 +92,19 @@ public BulkFileReader(string filePath, ResultFileType resultFileType, Bulk.Downl
_bulkStreamReader = new BulkStreamReader(filePath, fileFormat);
}

/// <summary>
/// Initializes a new instance of this class with the specified stream.
/// </summary>
/// <param name="stream">The stream to read.</param>
/// <param name="resultFileType">The result file type.</param>
/// <param name="fileFormat">The bulk file format.</param>
public BulkFileReader(Stream stream, ResultFileType resultFileType, Bulk.DownloadFileType fileFormat)
{
_isForFullDownload = resultFileType == ResultFileType.FullDownload;

_bulkStreamReader = new BulkStreamReader(stream, fileFormat);
}

/// <summary>
/// For unit testing
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions BingAdsApiSDK/V11/Bulk/BulkFileWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
//=====================================================================================================================================================

using System;
using System.IO;
using Microsoft.BingAds.V11.Bulk.Entities;
using Microsoft.BingAds.V11.Internal.Bulk;
using Microsoft.BingAds.V11.Internal.Bulk.Entities;
Expand Down Expand Up @@ -83,6 +84,17 @@ public BulkFileWriter(string filePath, DownloadFileType fileFormat)

}

/// <summary>
/// Initializes a new instance of this class with the specified stream.
/// </summary>
/// <param name="stream">The stream to write.</param>
/// <param name="fileFormat">The bulk file format.</param>
public BulkFileWriter(Stream stream, DownloadFileType fileFormat)
: this(new BulkObjectWriter(stream, fileFormat))
{

}

/// <summary>
/// For unit tests
/// </summary>
Expand Down
56 changes: 50 additions & 6 deletions BingAdsApiSDK/V11/Bulk/Entities/BulkAdGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ public class BulkAdGroup : SingleRecordBulkEntity
{
if (v == "Expired")
{
c.AdGroup.Status = AdGroupStatus.Deleted;
c.IsExpired = true;
}
else
Expand Down Expand Up @@ -201,11 +200,8 @@ public class BulkAdGroup : SingleRecordBulkEntity
c => c.AdGroup.UrlCustomParameters.ToBulkString(),
(v, c) => c.AdGroup.UrlCustomParameters = v.ParseCustomParameters()
),

new SimpleBulkMapping<BulkAdGroup>(StringTable.BidStrategyType,
c => c.AdGroup.BiddingScheme.ToBiddingSchemeBulkString(),
(v, c) => c.AdGroup.BiddingScheme = v.ParseBiddingScheme()
),

new ComplexBulkMapping<BulkAdGroup>(BiddingSchemeToCsv, CsvToBiddingScheme),

new SimpleBulkMapping<BulkAdGroup>(StringTable.RemarketingTargetingSetting,
c => c.AdGroup.RemarketingTargetingSetting.ToBulkString(),
Expand Down Expand Up @@ -238,5 +234,53 @@ internal override void ProcessMappingsToRowValues(RowValues values, bool exclude
PerformanceData.WriteToRowValuesIfNotNull(PerformanceData, values);
}
}

private static void CsvToBiddingScheme(RowValues values, BulkAdGroup c)
{
string bidStrategyTypeRowValue;

BiddingScheme biddingScheme;

if (!values.TryGetValue(StringTable.BidStrategyType, out bidStrategyTypeRowValue) || (biddingScheme = bidStrategyTypeRowValue.ParseBiddingScheme()) == null)
{
return;
}

string inheritedBidStrategyTypeRowValue;

values.TryGetValue(StringTable.InheritedBidStrategyType, out inheritedBidStrategyTypeRowValue);

var inheritFromParentBiddingScheme = biddingScheme as InheritFromParentBiddingScheme;
if (inheritFromParentBiddingScheme != null)
{
c.AdGroup.BiddingScheme = new InheritFromParentBiddingScheme
{
InheritedBidStrategyType = inheritedBidStrategyTypeRowValue,
Type = "InheritFromParent",
};
}
else
{
c.AdGroup.BiddingScheme = biddingScheme;
}
}

private static void BiddingSchemeToCsv(BulkAdGroup c, RowValues values)
{
var biddingScheme = c.AdGroup.BiddingScheme;

if (biddingScheme == null)
{
return;
}

values[StringTable.BidStrategyType] = biddingScheme.ToBiddingSchemeBulkString();

var inheritFromParentBiddingScheme = biddingScheme as InheritFromParentBiddingScheme;
if (inheritFromParentBiddingScheme != null)
{
values[StringTable.InheritedBidStrategyType] = inheritFromParentBiddingScheme.InheritedBidStrategyType;
}
}
}
}
54 changes: 50 additions & 4 deletions BingAdsApiSDK/V11/Bulk/Entities/BulkKeyword.cs
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,8 @@ internal override void WriteAdditionalData(IBulkObjectWriter writer)
(v, c) => c.Keyword.UrlCustomParameters = v.ParseCustomParameters()
),

new SimpleBulkMapping<BulkKeyword>(StringTable.BidStrategyType,
c => c.Keyword.BiddingScheme.ToBiddingSchemeBulkString(),
(v, c) => c.Keyword.BiddingScheme = v.ParseBiddingScheme()
),
new ComplexBulkMapping<BulkKeyword>(BiddingSchemeToCsv, CsvToBiddingScheme),

};

internal override void ProcessMappingsFromRowValues(RowValues values)
Expand All @@ -270,5 +268,53 @@ internal override void ProcessMappingsToRowValues(RowValues values, bool exclude
PerformanceData.WriteToRowValuesIfNotNull(PerformanceData, values);
}
}

private static void CsvToBiddingScheme(RowValues values, BulkKeyword c)
{
string bidStrategyTypeRowValue;

BiddingScheme biddingScheme;

if (!values.TryGetValue(StringTable.BidStrategyType, out bidStrategyTypeRowValue) || (biddingScheme = bidStrategyTypeRowValue.ParseBiddingScheme()) == null)
{
return;
}

string inheritedBidStrategyTypeRowValue;

values.TryGetValue(StringTable.InheritedBidStrategyType, out inheritedBidStrategyTypeRowValue);

var inheritFromParentBiddingScheme = biddingScheme as InheritFromParentBiddingScheme;
if (inheritFromParentBiddingScheme != null)
{
c.Keyword.BiddingScheme = new InheritFromParentBiddingScheme
{
InheritedBidStrategyType = inheritedBidStrategyTypeRowValue,
Type = "InheritFromParent",
};
}
else
{
c.Keyword.BiddingScheme = biddingScheme;
}
}

private static void BiddingSchemeToCsv(BulkKeyword c, RowValues values)
{
var biddingScheme = c.Keyword.BiddingScheme;

if (biddingScheme == null)
{
return;
}

values[StringTable.BidStrategyType] = biddingScheme.ToBiddingSchemeBulkString();

var inheritFromParentBiddingScheme = biddingScheme as InheritFromParentBiddingScheme;
if (inheritFromParentBiddingScheme != null)
{
values[StringTable.InheritedBidStrategyType] = inheritFromParentBiddingScheme.InheritedBidStrategyType;
}
}
}
}

0 comments on commit 5defff7

Please sign in to comment.