Skip to content

Commit

Permalink
Changes for version v12-1-0 (googleads#413)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnashOommen authored Jun 10, 2022
1 parent 15a8dd5 commit 2f8a841
Show file tree
Hide file tree
Showing 1,527 changed files with 712,837 additions and 4,480 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
12.1.0
======

- Added support for version v11 of the Google Ads API.
- Added new code examples:
- CampaignManagement\CreateExperiment.cs
- Recommendations\DetectAndApplyRecommendations.cs
- Removed some code examples:
- CampaignManagement\CreateCampaignExperiment.cs
- CampaignManagement\GraduateCampaignExperiment.cs
- Updated some code examples
- Fixed the AddSmartCampaign.cs example to use BusinessProfileLocation instead of BusinessProfileId
- Fixed the protobuf key name in the user agent header.
- Updated all code examples to remove INSERT_XXX_ placeholders from the Main() method.
- Added an additional test case to ensure that FieldMask handles empty messages correctly.
- Made more changes related to the Google.Ads.Gax refactoring.
- Deleted an orphaned file.
- Fixed some incorrect namespaces.
- Fixed the internal visibility of Google.Ads.Gax assembly to a bunch of additional assemblies.
- Extract some common test utilities into a separate assembly.
- Added a THIRD-PARTY-LICENSE.txt that captures the licenses of all the third_party transitive
dependencies into a single file. This file will also be embedded into the nupkg distribution.
- Fixed an NPE when initalizing GoogleAdsException without metadata. Fixes https://github.com/googleads/google-ads-dotnet/issues/402

12.0.0
======
- The project was split into two assemblies -- Google.Ads.Gax and Google.Ads.GoogleAds. This was
Expand Down
2 changes: 2 additions & 0 deletions Google.Ads.Gax/src/AssemblySettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Google.Ads.AudiencePartner, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d7868e7a8774639a82ed60eb9d2a34ae6394813170bd3c11f2bb3dcc929e30b99792a3a3de193c42dee2b753dde1516f519d3141eab6e64f05c4fd74bf3139e3349e722ffe26fae45ca822ad0e4a86167e0417e0fbe5594eb69dcc35f49da965b3456a86283fde4f5c7ea273df3b57a1f267131393644c677a1b7d1f7ddfdaaa")]
[assembly: InternalsVisibleTo("Google.Ads.AudiencePartner.Core, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d7868e7a8774639a82ed60eb9d2a34ae6394813170bd3c11f2bb3dcc929e30b99792a3a3de193c42dee2b753dde1516f519d3141eab6e64f05c4fd74bf3139e3349e722ffe26fae45ca822ad0e4a86167e0417e0fbe5594eb69dcc35f49da965b3456a86283fde4f5c7ea273df3b57a1f267131393644c677a1b7d1f7ddfdaaa")]
[assembly: InternalsVisibleTo("Google.Ads.AudiencePartner.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d7868e7a8774639a82ed60eb9d2a34ae6394813170bd3c11f2bb3dcc929e30b99792a3a3de193c42dee2b753dde1516f519d3141eab6e64f05c4fd74bf3139e3349e722ffe26fae45ca822ad0e4a86167e0417e0fbe5594eb69dcc35f49da965b3456a86283fde4f5c7ea273df3b57a1f267131393644c677a1b7d1f7ddfdaaa")]
[assembly: InternalsVisibleTo("Google.Ads.AudiencePartner.Core.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d7868e7a8774639a82ed60eb9d2a34ae6394813170bd3c11f2bb3dcc929e30b99792a3a3de193c42dee2b753dde1516f519d3141eab6e64f05c4fd74bf3139e3349e722ffe26fae45ca822ad0e4a86167e0417e0fbe5594eb69dcc35f49da965b3456a86283fde4f5c7ea273df3b57a1f267131393644c677a1b7d1f7ddfdaaa")]
[assembly: InternalsVisibleTo("Google.Ads.GoogleAds, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d7868e7a8774639a82ed60eb9d2a34ae6394813170bd3c11f2bb3dcc929e30b99792a3a3de193c42dee2b753dde1516f519d3141eab6e64f05c4fd74bf3139e3349e722ffe26fae45ca822ad0e4a86167e0417e0fbe5594eb69dcc35f49da965b3456a86283fde4f5c7ea273df3b57a1f267131393644c677a1b7d1f7ddfdaaa")]
[assembly: InternalsVisibleTo("Google.Ads.GoogleAds.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d7868e7a8774639a82ed60eb9d2a34ae6394813170bd3c11f2bb3dcc929e30b99792a3a3de193c42dee2b753dde1516f519d3141eab6e64f05c4fd74bf3139e3349e722ffe26fae45ca822ad0e4a86167e0417e0fbe5594eb69dcc35f49da965b3456a86283fde4f5c7ea273df3b57a1f267131393644c677a1b7d1f7ddfdaaa")]
[assembly: InternalsVisibleTo("Google.Ads.GoogleAds.Benchmarks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d7868e7a8774639a82ed60eb9d2a34ae6394813170bd3c11f2bb3dcc929e30b99792a3a3de193c42dee2b753dde1516f519d3141eab6e64f05c4fd74bf3139e3349e722ffe26fae45ca822ad0e4a86167e0417e0fbe5594eb69dcc35f49da965b3456a86283fde4f5c7ea273df3b57a1f267131393644c677a1b7d1f7ddfdaaa")]
Expand Down
8 changes: 5 additions & 3 deletions Google.Ads.Gax/src/Google.Ads.Gax.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Title>Google Ads GAPIC Extensions Dotnet Client Library</Title>
<PackageId>Google.Ads.Gax</PackageId>
<Version>1.0.1</Version>
<Description>This library provides functionality that makes it easiser to work with Generated
<Description>This library provides functionality that makes it easier to work with Generated
API Client GAPIC client libraries for Google's Ads APIs.</Description>
<PackageReleaseNotes>https://github.com/googleads/google-ads-dotnet/blob/main/ChangeLog</PackageReleaseNotes>
<PackageTags>GoogleAds Google Gax</PackageTags>
Expand All @@ -16,7 +16,7 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/googleads/google-ads-dotnet</RepositoryUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<NoWarn>$(NoWarn);SYSLIB0014</NoWarn>
</PropertyGroup>
<!-- build properties -->
Expand All @@ -37,7 +37,9 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<None Include="logo.png" Pack="true" PackagePath="\" />
<None Include="..\..\THIRD-PARTY-LICENSE.txt" Pack="true" PackagePath="" />
<None Include="..\..\LICENSE" Pack="true" PackagePath=""/>
<None Include="..\..\logo.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
Expand Down
43 changes: 43 additions & 0 deletions Google.Ads.Gax/src/Util/Examples/ExampleUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

using System;
using System.Collections.Generic;
using System.IO;
using CommandLine;

namespace Google.Ads.Gax.Examples
{
Expand Down Expand Up @@ -61,5 +63,46 @@ public static string FormatException(Exception ex)
}
return String.Join("\nCaused by\n\n", messages.ToArray());
}

/// <summary>
/// Parses the command line.
/// </summary>
/// <typeparam name="T">The type of options.</typeparam>
/// <param name="args">The command line arguments.</param>
/// <returns>The parsed options.</returns>
public static T ParseCommandLine<T>(string[] args) where T : OptionsBase, new()
{
T options = new T();
StringWriter memStream = new StringWriter();
Parser parser = new Parser(settings =>
{
settings.CaseInsensitiveEnumValues = true;
settings.AutoHelp = true;
settings.HelpWriter = memStream;
});
bool hasErrors = false;
parser.ParseArguments<T>(args).MapResult(
delegate (T o)
{
options = o;
return 0;
}, delegate (IEnumerable<Error> errors)
{
// We do not process the errors here, we just flip a flag to mark that
// the error help content in memStream should be inspected and an exception
// should be raised.
hasErrors = true;
return 0;
});

if (hasErrors)
{
throw new ArgumentException($"Invalid command line parameters\n {memStream}");
}
else
{
return options;
}
}
}
}
3 changes: 1 addition & 2 deletions Google.Ads.Gax/tests/Util/FieldMasksTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Google.Ads.Gax.Tests.Util;
using Google.Ads.Gax.Util;
using Google.Protobuf.WellKnownTypes;
using NUnit.Framework;
Expand All @@ -22,7 +21,7 @@
using System.IO;
using System.Linq;

namespace Google.Ads.GoogleAds.Tests.Util
namespace Google.Ads.Gax.Tests.Util
{
/// <summary>
/// Tests for <see cref="FieldMasks"/> class.
Expand Down
11 changes: 11 additions & 0 deletions Google.Ads.Gax/tests/Util/field_mask_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@
}
},
"expectedMask": "foo.baz"
},
{
"description": "Empty message field 2",
"originalResource": {
},
"modifiedResource": {
"foo": {
"bar": {}
}
},
"expectedMask": "foo.bar"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
using Google.Ads.Gax.Examples;
using Google.Ads.Gax.Util;
using Google.Ads.GoogleAds.Lib;
using Google.Ads.GoogleAds.V10.Errors;
using Google.Ads.GoogleAds.V10.Resources;
using Google.Ads.GoogleAds.V10.Services;
using Google.Ads.GoogleAds.V11.Errors;
using Google.Ads.GoogleAds.V11.Resources;
using Google.Ads.GoogleAds.V11.Services;
using System;
using System.Collections.Generic;
using static Google.Ads.GoogleAds.V10.Enums.MerchantCenterLinkStatusEnum.Types;
using static Google.Ads.GoogleAds.V11.Enums.MerchantCenterLinkStatusEnum.Types;

namespace Google.Ads.GoogleAds.Examples.V10
namespace Google.Ads.GoogleAds.Examples.V11
{
/// <summary>
/// This code example demonstrates how to approve a Merchant Center link request.
Expand Down Expand Up @@ -63,23 +63,7 @@ public class Options : OptionsBase
/// <param name="args">The command line arguments.</param>
public static void Main(string[] args)
{
Options options = new Options();
CommandLine.Parser.Default.ParseArguments<Options>(args).MapResult(
delegate (Options o)
{
options = o;
return 0;
}, delegate (IEnumerable<Error> errors)
{
// The Google Ads customer ID for which the call is made.
options.CustomerId = long.Parse("INSERT_CUSTOMER_ID_HERE");

// ID of the Merchant center whose link request is to be approved.
options.MerchantCenterAccountId =
long.Parse("INSERT_MERCHANT_CENTER_ACCOUNT_ID_HERE");

return 0;
});
Options options = ExampleUtilities.ParseCommandLine<Options>(args);

ApproveMerchantCenterLink codeExample = new ApproveMerchantCenterLink();
Console.WriteLine(codeExample.Description);
Expand Down Expand Up @@ -110,7 +94,7 @@ public void Run(GoogleAdsClient client, long customerId, long merchantCenterAcco
{
// Get the MerchantCenterLink.
MerchantCenterLinkServiceClient merchantCenterLinkService = client.GetService(
Services.V10.MerchantCenterLinkService);
Services.V11.MerchantCenterLinkService);

try
{
Expand Down
24 changes: 6 additions & 18 deletions Google.Ads.GoogleAds/examples/AccountManagement/CreateCustomer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
using CommandLine;
using Google.Ads.Gax.Examples;
using Google.Ads.GoogleAds.Lib;
using Google.Ads.GoogleAds.V10.Errors;
using Google.Ads.GoogleAds.V10.Resources;
using Google.Ads.GoogleAds.V10.Services;
using Google.Ads.GoogleAds.V11.Errors;
using Google.Ads.GoogleAds.V11.Resources;
using Google.Ads.GoogleAds.V11.Services;
using System;
using System.Collections.Generic;

namespace Google.Ads.GoogleAds.Examples.V10
namespace Google.Ads.GoogleAds.Examples.V11
{
/// <summary>
/// This code example illustrates how to create a new customer under a given manager account.
Expand Down Expand Up @@ -50,19 +50,7 @@ public class Options : OptionsBase
/// <param name="args">The command line arguments.</param>
public static void Main(string[] args)
{
Options options = new Options();
CommandLine.Parser.Default.ParseArguments<Options>(args).MapResult(
delegate (Options o)
{
options = o;
return 0;
}, delegate (IEnumerable<Error> errors)
{
// The manager customer ID.
options.ManagerCustomerId = long.Parse("INSERT_MANAGER_CUSTOMER_ID_HERE");

return 0;
});
Options options = ExampleUtilities.ParseCommandLine<Options>(args);

CreateCustomer codeExample = new CreateCustomer();
Console.WriteLine(codeExample.Description);
Expand All @@ -88,7 +76,7 @@ public static void Main(string[] args)
public void Run(GoogleAdsClient client, long managerCustomerId)
{
// Get the CustomerService.
CustomerServiceClient customerService = client.GetService(Services.V10.CustomerService);
CustomerServiceClient customerService = client.GetService(Services.V11.CustomerService);

Customer customer = new Customer()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
using CommandLine;
using Google.Ads.Gax.Examples;
using Google.Ads.GoogleAds.Lib;
using Google.Ads.GoogleAds.V10.Resources;
using Google.Ads.GoogleAds.V10.Services;
using Google.Ads.GoogleAds.V11.Resources;
using Google.Ads.GoogleAds.V11.Services;
using Google.Api.Gax;
using System;
using System.Collections.Generic;

namespace Google.Ads.GoogleAds.Examples.V10
namespace Google.Ads.GoogleAds.Examples.V11
{
/// <summary>
/// This example gets the account hierarchy of the specified manager account. If you don't
Expand Down Expand Up @@ -61,23 +61,7 @@ public class Options : OptionsBase
/// <param name="args">The command line arguments.</param>
public static void Main(string[] args)
{
Options options = new Options();
CommandLine.Parser.Default.ParseArguments<Options>(args).MapResult(
delegate (Options o)
{
options = o;
return 0;
}, delegate (IEnumerable<Error> errors)
{
// Optional manager account ID. If none provided, this method will instead
// list the accounts accessible from the authenticated Google Ads account.
options.ManagerCustomerId = long.Parse("INSERT_MANAGER_CUSTOMER_ID_HERE");

// The login customer ID used to create the GoogleAdsClient.
options.LoginCustomerId = long.Parse("INSERT_LOGIN_CUSTOMER_ID_HERE");

return 0;
});
Options options = ExampleUtilities.ParseCommandLine<Options>(args);

GetAccountHierarchy codeExample = new GetAccountHierarchy();
Console.WriteLine(codeExample.Description);
Expand Down Expand Up @@ -115,10 +99,10 @@ public void Run(GoogleAdsClient googleAdsClient, long? managerCustomerId = null,
}

GoogleAdsServiceClient googleAdsServiceClient =
googleAdsClient.GetService(Services.V10.GoogleAdsService);
googleAdsClient.GetService(Services.V11.GoogleAdsService);

CustomerServiceClient customerServiceClient =
googleAdsClient.GetService(Services.V10.CustomerService);
googleAdsClient.GetService(Services.V11.CustomerService);

// List of Customer IDs to handle.
List<long> seedCustomerIds = new List<long>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
using CommandLine;
using Google.Ads.Gax.Examples;
using Google.Ads.GoogleAds.Lib;
using Google.Ads.GoogleAds.V10.Errors;
using Google.Ads.GoogleAds.V10.Resources;
using Google.Ads.GoogleAds.V10.Services;
using Google.Ads.GoogleAds.V11.Errors;
using Google.Ads.GoogleAds.V11.Resources;
using Google.Ads.GoogleAds.V11.Services;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Google.Ads.GoogleAds.Examples.V10
namespace Google.Ads.GoogleAds.Examples.V11
{
/// <summary>
/// This code example lists basic information about an advertising account, like the name,
Expand All @@ -49,19 +49,7 @@ public class Options : OptionsBase
/// <param name="args">The command line arguments.</param>
public static void Main(string[] args)
{
Options options = new Options();
CommandLine.Parser.Default.ParseArguments<Options>(args).MapResult(
delegate (Options o)
{
options = o;
return 0;
}, delegate (IEnumerable<Error> errors)
{
// The Google Ads customer ID for which the call is made.
options.CustomerId = long.Parse("INSERT_CUSTOMER_ID_HERE");

return 0;
});
Options options = ExampleUtilities.ParseCommandLine<Options>(args);

GetAccountInformation codeExample = new GetAccountInformation();
Console.WriteLine(codeExample.Description);
Expand All @@ -85,7 +73,7 @@ public void Run(GoogleAdsClient client, long customerId)
{
// Get the GoogleAdsService.
GoogleAdsServiceClient googleAdsService = client.GetService(
Services.V10.GoogleAdsService);
Services.V11.GoogleAdsService);

// Construct a query to retrieve the customer.
// Add a limit of 1 row to clarify that selecting from the customer resource
Expand Down
Loading

0 comments on commit 2f8a841

Please sign in to comment.