/// <summary>Snippet for GetGeoTargetConstant</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGeoTargetConstantResourceNames()
 {
     // Create client
     GeoTargetConstantServiceClient geoTargetConstantServiceClient = GeoTargetConstantServiceClient.Create();
     // Initialize request argument(s)
     GeoTargetConstantName resourceName = GeoTargetConstantName.FromCriterion("[CRITERION_ID]");
     // Make the request
     GeoTargetConstant response = geoTargetConstantServiceClient.GetGeoTargetConstant(resourceName);
 }
 /// <summary>Snippet for GetGeoTargetConstant</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGeoTargetConstant()
 {
     // Create client
     GeoTargetConstantServiceClient geoTargetConstantServiceClient = GeoTargetConstantServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "geoTargetConstants/[GEO_TARGET_CONSTANT]";
     // Make the request
     GeoTargetConstant response = geoTargetConstantServiceClient.GetGeoTargetConstant(resourceName);
 }
Ejemplo n.º 3
0
 /// <summary>Snippet for GetGeoTargetConstant</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetGeoTargetConstantResourceNames()
 {
     // Create client
     GeoTargetConstantServiceClient geoTargetConstantServiceClient = GeoTargetConstantServiceClient.Create();
     // Initialize request argument(s)
     GeoTargetConstantName resourceName = GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]");
     // Make the request
     GeoTargetConstant response = geoTargetConstantServiceClient.GetGeoTargetConstant(resourceName);
 }
Ejemplo n.º 4
0
        /// <summary>Snippet for GetGeoTargetConstantAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetGeoTargetConstantAsync()
        {
            // Create client
            GeoTargetConstantServiceClient geoTargetConstantServiceClient = await GeoTargetConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "geoTargetConstants/[CRITERION_ID]";
            // Make the request
            GeoTargetConstant response = await geoTargetConstantServiceClient.GetGeoTargetConstantAsync(resourceName);
        }
        /// <summary>Snippet for GetGeoTargetConstantAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetGeoTargetConstantResourceNamesAsync()
        {
            // Create client
            GeoTargetConstantServiceClient geoTargetConstantServiceClient = await GeoTargetConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            GeoTargetConstantName resourceName = GeoTargetConstantName.FromCriterion("[CRITERION_ID]");
            // Make the request
            GeoTargetConstant response = await geoTargetConstantServiceClient.GetGeoTargetConstantAsync(resourceName);
        }
Ejemplo n.º 6
0
        /// <summary>Snippet for GetGeoTargetConstantAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetGeoTargetConstantResourceNamesAsync()
        {
            // Create client
            GeoTargetConstantServiceClient geoTargetConstantServiceClient = await GeoTargetConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            GeoTargetConstantName resourceName = GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]");
            // Make the request
            GeoTargetConstant response = await geoTargetConstantServiceClient.GetGeoTargetConstantAsync(resourceName);
        }
Ejemplo n.º 7
0
 /// <summary>Snippet for GetGeoTargetConstant</summary>
 public void GetGeoTargetConstant()
 {
     // Snippet: GetGeoTargetConstant(string, CallSettings)
     // Create client
     GeoTargetConstantServiceClient geoTargetConstantServiceClient = GeoTargetConstantServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "geoTargetConstants/[CRITERION_ID]";
     // Make the request
     GeoTargetConstant response = geoTargetConstantServiceClient.GetGeoTargetConstant(resourceName);
     // End snippet
 }
        /// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        public void Run(GoogleAdsClient client)
        {
            // Get the GeoTargetConstantServiceClient.
            GeoTargetConstantServiceClient geoService =
                client.GetService(Services.V5.GeoTargetConstantService);

            // Locale is using ISO 639-1 format. If an invalid locale is given,
            // 'en' is used by default.
            string locale = "en";

            // A list of country codes can be referenced here:
            // https://developers.google.com/adwords/api/docs/appendix/geotargeting
            string countryCode = "FR";

            String[] locations = { "Paris", "Quebec", "Spain", "Deutschland" };

            SuggestGeoTargetConstantsRequest request = new SuggestGeoTargetConstantsRequest()
            {
                Locale        = locale,
                CountryCode   = countryCode,
                LocationNames = new SuggestGeoTargetConstantsRequest.Types.LocationNames()
            };

            request.LocationNames.Names.AddRange(locations);

            try
            {
                SuggestGeoTargetConstantsResponse response =
                    geoService.SuggestGeoTargetConstants(request);

                foreach (GeoTargetConstantSuggestion suggestion
                         in response.GeoTargetConstantSuggestions)
                {
                    Console.WriteLine(
                        $"{suggestion.GeoTargetConstant.ResourceName} " +
                        $"({suggestion.GeoTargetConstant.Name}, " +
                        $"{suggestion.GeoTargetConstant.CountryCode}, " +
                        $"{suggestion.GeoTargetConstant.TargetType}, " +
                        $"{suggestion.GeoTargetConstant.Status}) is found in locale " +
                        $"({suggestion.Locale}) with reach ({suggestion.Reach}) " +
                        $"for search term ({suggestion.SearchTerm}).");
                }
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
        }
Ejemplo n.º 9
0
        /// <summary>Snippet for GetGeoTargetConstantAsync</summary>
        public async Task GetGeoTargetConstantAsync()
        {
            // Snippet: GetGeoTargetConstantAsync(string, CallSettings)
            // Additional: GetGeoTargetConstantAsync(string, CancellationToken)
            // Create client
            GeoTargetConstantServiceClient geoTargetConstantServiceClient = await GeoTargetConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "geoTargetConstants/[CRITERION_ID]";
            // Make the request
            GeoTargetConstant response = await geoTargetConstantServiceClient.GetGeoTargetConstantAsync(resourceName);

            // End snippet
        }
Ejemplo n.º 10
0
 /// <summary>Snippet for GetGeoTargetConstant</summary>
 public void GetGeoTargetConstantRequestObject()
 {
     // Snippet: GetGeoTargetConstant(GetGeoTargetConstantRequest, CallSettings)
     // Create client
     GeoTargetConstantServiceClient geoTargetConstantServiceClient = GeoTargetConstantServiceClient.Create();
     // Initialize request argument(s)
     GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
     {
         ResourceNameAsGeoTargetConstantName = GeoTargetConstantName.FromCriterion("[CRITERION_ID]"),
     };
     // Make the request
     GeoTargetConstant response = geoTargetConstantServiceClient.GetGeoTargetConstant(request);
     // End snippet
 }
Ejemplo n.º 11
0
        /// <summary>Snippet for GetGeoTargetConstantAsync</summary>
        public async Task GetGeoTargetConstantResourceNamesAsync()
        {
            // Snippet: GetGeoTargetConstantAsync(GeoTargetConstantName, CallSettings)
            // Additional: GetGeoTargetConstantAsync(GeoTargetConstantName, CancellationToken)
            // Create client
            GeoTargetConstantServiceClient geoTargetConstantServiceClient = await GeoTargetConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            GeoTargetConstantName resourceName = GeoTargetConstantName.FromCriterion("[CRITERION_ID]");
            // Make the request
            GeoTargetConstant response = await geoTargetConstantServiceClient.GetGeoTargetConstantAsync(resourceName);

            // End snippet
        }
 /// <summary>Snippet for SuggestGeoTargetConstants</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void SuggestGeoTargetConstantsRequestObject()
 {
     // Create client
     GeoTargetConstantServiceClient geoTargetConstantServiceClient = GeoTargetConstantServiceClient.Create();
     // Initialize request argument(s)
     SuggestGeoTargetConstantsRequest request = new SuggestGeoTargetConstantsRequest
     {
         LocationNames = new SuggestGeoTargetConstantsRequest.Types.LocationNames(),
         Locale        = "",
         CountryCode   = "",
     };
     // Make the request
     SuggestGeoTargetConstantsResponse response = geoTargetConstantServiceClient.SuggestGeoTargetConstants(request);
 }
Ejemplo n.º 13
0
        /// <summary>Snippet for GetGeoTargetConstantAsync</summary>
        public async Task GetGeoTargetConstantRequestObjectAsync()
        {
            // Snippet: GetGeoTargetConstantAsync(GetGeoTargetConstantRequest, CallSettings)
            // Additional: GetGeoTargetConstantAsync(GetGeoTargetConstantRequest, CancellationToken)
            // Create client
            GeoTargetConstantServiceClient geoTargetConstantServiceClient = await GeoTargetConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetGeoTargetConstantRequest request = new GetGeoTargetConstantRequest
            {
                ResourceNameAsGeoTargetConstantName = GeoTargetConstantName.FromGeoTargetConstant("[GEO_TARGET_CONSTANT]"),
            };
            // Make the request
            GeoTargetConstant response = await geoTargetConstantServiceClient.GetGeoTargetConstantAsync(request);

            // End snippet
        }
Ejemplo n.º 14
0
        /// <summary>Snippet for SuggestGeoTargetConstantsAsync</summary>
        public async Task SuggestGeoTargetConstantsRequestObjectAsync()
        {
            // Snippet: SuggestGeoTargetConstantsAsync(SuggestGeoTargetConstantsRequest, CallSettings)
            // Additional: SuggestGeoTargetConstantsAsync(SuggestGeoTargetConstantsRequest, CancellationToken)
            // Create client
            GeoTargetConstantServiceClient geoTargetConstantServiceClient = await GeoTargetConstantServiceClient.CreateAsync();

            // Initialize request argument(s)
            SuggestGeoTargetConstantsRequest request = new SuggestGeoTargetConstantsRequest
            {
                LocationNames = new SuggestGeoTargetConstantsRequest.Types.LocationNames(),
                Locale        = "",
                CountryCode   = "",
            };
            // Make the request
            SuggestGeoTargetConstantsResponse response = await geoTargetConstantServiceClient.SuggestGeoTargetConstantsAsync(request);

            // End snippet
        }