/// <summary>
        /// Runs the code example.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        /// <param name="billingSetupId">ID of the billing setup to remove.</param>
        public void Run(GoogleAdsClient client, long customerId, long billingSetupId)
        {
            // Get the BillingSetupServiceClient.
            BillingSetupServiceClient billingSetupService = client.GetService(
                Services.V1.BillingSetupService);

            // Create the billing setup resource.
            String billingSetupResource = ResourceNames.BillingSetup(customerId, billingSetupId);

            // Construct an operation that will remove the billing setup.
            BillingSetupOperation operation = new BillingSetupOperation()
            {
                Remove = billingSetupResource
            };

            try
            {
                // Send the operation in a mutate request.
                MutateBillingSetupResponse response =
                    billingSetupService.MutateBillingSetup(customerId.ToString(), operation);

                Console.WriteLine("Removed billing setup with resource name '{0}'.",
                                  response.Result.ResourceName);
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
            }
        }
Exemplo n.º 2
0
 /// <summary>Snippet for GetBillingSetup</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetBillingSetup()
 {
     // Create client
     BillingSetupServiceClient billingSetupServiceClient = BillingSetupServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER_ID]/billingSetups/[BILLING_SETUP_ID]";
     // Make the request
     BillingSetup response = billingSetupServiceClient.GetBillingSetup(resourceName);
 }
 /// <summary>Snippet for GetBillingSetup</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetBillingSetupResourceNames()
 {
     // Create client
     BillingSetupServiceClient billingSetupServiceClient = BillingSetupServiceClient.Create();
     // Initialize request argument(s)
     BillingSetupName resourceName = BillingSetupName.FromCustomerBillingSetup("[CUSTOMER_ID]", "[BILLING_SETUP_ID]");
     // Make the request
     BillingSetup response = billingSetupServiceClient.GetBillingSetup(resourceName);
 }
Exemplo n.º 4
0
 /// <summary>Snippet for MutateBillingSetup</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateBillingSetup()
 {
     // Create client
     BillingSetupServiceClient billingSetupServiceClient = BillingSetupServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     BillingSetupOperation operation = new BillingSetupOperation();
     // Make the request
     MutateBillingSetupResponse response = billingSetupServiceClient.MutateBillingSetup(customerId, operation);
 }
Exemplo n.º 5
0
        /// <summary>Snippet for GetBillingSetupAsync</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 GetBillingSetupResourceNamesAsync()
        {
            // Create client
            BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();

            // Initialize request argument(s)
            BillingSetupName resourceName = BillingSetupName.FromCustomerBillingSetup("[CUSTOMER]", "[BILLING_SETUP]");
            // Make the request
            BillingSetup response = await billingSetupServiceClient.GetBillingSetupAsync(resourceName);
        }
Exemplo n.º 6
0
        /// <summary>Snippet for GetBillingSetupAsync</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 GetBillingSetupAsync()
        {
            // Create client
            BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/billingSetups/[BILLING_SETUP]";
            // Make the request
            BillingSetup response = await billingSetupServiceClient.GetBillingSetupAsync(resourceName);
        }
Exemplo n.º 7
0
 /// <summary>Snippet for GetBillingSetup</summary>
 public void GetBillingSetup()
 {
     // Snippet: GetBillingSetup(string, CallSettings)
     // Create client
     BillingSetupServiceClient billingSetupServiceClient = BillingSetupServiceClient.Create();
     // Initialize request argument(s)
     string resourceName = "customers/[CUSTOMER]/billingSetups/[BILLING_SETUP]";
     // Make the request
     BillingSetup response = billingSetupServiceClient.GetBillingSetup(resourceName);
     // End snippet
 }
Exemplo n.º 8
0
        /// <summary>Snippet for MutateBillingSetupAsync</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 MutateBillingSetupAsync()
        {
            // Create client
            BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            BillingSetupOperation operation = new BillingSetupOperation();
            // Make the request
            MutateBillingSetupResponse response = await billingSetupServiceClient.MutateBillingSetupAsync(customerId, operation);
        }
 /// <summary>Snippet for GetBillingSetup</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void GetBillingSetupRequestObject()
 {
     // Create client
     BillingSetupServiceClient billingSetupServiceClient = BillingSetupServiceClient.Create();
     // Initialize request argument(s)
     GetBillingSetupRequest request = new GetBillingSetupRequest
     {
         ResourceNameAsBillingSetupName = BillingSetupName.FromCustomerBillingSetup("[CUSTOMER]", "[BILLING_SETUP]"),
     };
     // Make the request
     BillingSetup response = billingSetupServiceClient.GetBillingSetup(request);
 }
 /// <summary>Snippet for MutateBillingSetupAsync</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 MutateBillingSetupRequestObjectAsync()
 {
     // Create client
     BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();
     // Initialize request argument(s)
     MutateBillingSetupRequest request = new MutateBillingSetupRequest
     {
         CustomerId = "",
         Operation = new BillingSetupOperation(),
     };
     // Make the request
     MutateBillingSetupResponse response = await billingSetupServiceClient.MutateBillingSetupAsync(request);
 }
Exemplo n.º 11
0
        /// <summary>Snippet for GetBillingSetupAsync</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 GetBillingSetupRequestObjectAsync()
        {
            // Create client
            BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetBillingSetupRequest request = new GetBillingSetupRequest
            {
                ResourceNameAsBillingSetupName = BillingSetupName.FromCustomerBillingSetup("[CUSTOMER_ID]", "[BILLING_SETUP_ID]"),
            };
            // Make the request
            BillingSetup response = await billingSetupServiceClient.GetBillingSetupAsync(request);
        }
Exemplo n.º 12
0
 /// <summary>Snippet for MutateBillingSetup</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateBillingSetupRequestObject()
 {
     // Create client
     BillingSetupServiceClient billingSetupServiceClient = BillingSetupServiceClient.Create();
     // Initialize request argument(s)
     MutateBillingSetupRequest request = new MutateBillingSetupRequest
     {
         CustomerId = "",
         Operation  = new BillingSetupOperation(),
     };
     // Make the request
     MutateBillingSetupResponse response = billingSetupServiceClient.MutateBillingSetup(request);
 }
Exemplo n.º 13
0
        /// <summary>Snippet for GetBillingSetupAsync</summary>
        public async Task GetBillingSetupAsync()
        {
            // Snippet: GetBillingSetupAsync(string, CallSettings)
            // Additional: GetBillingSetupAsync(string, CancellationToken)
            // Create client
            BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();

            // Initialize request argument(s)
            string resourceName = "customers/[CUSTOMER]/billingSetups/[BILLING_SETUP]";
            // Make the request
            BillingSetup response = await billingSetupServiceClient.GetBillingSetupAsync(resourceName);

            // End snippet
        }
Exemplo n.º 14
0
        /// <summary>Snippet for GetBillingSetupAsync</summary>
        public async Task GetBillingSetupResourceNamesAsync()
        {
            // Snippet: GetBillingSetupAsync(BillingSetupName, CallSettings)
            // Additional: GetBillingSetupAsync(BillingSetupName, CancellationToken)
            // Create client
            BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();

            // Initialize request argument(s)
            BillingSetupName resourceName = BillingSetupName.FromCustomerBillingSetup("[CUSTOMER]", "[BILLING_SETUP]");
            // Make the request
            BillingSetup response = await billingSetupServiceClient.GetBillingSetupAsync(resourceName);

            // End snippet
        }
Exemplo n.º 15
0
        /// <summary>Snippet for MutateBillingSetupAsync</summary>
        public async Task MutateBillingSetupAsync()
        {
            // Snippet: MutateBillingSetupAsync(string, BillingSetupOperation, CallSettings)
            // Additional: MutateBillingSetupAsync(string, BillingSetupOperation, CancellationToken)
            // Create client
            BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();

            // Initialize request argument(s)
            string customerId = "";
            BillingSetupOperation operation = new BillingSetupOperation();
            // Make the request
            MutateBillingSetupResponse response = await billingSetupServiceClient.MutateBillingSetupAsync(customerId, operation);

            // End snippet
        }
Exemplo n.º 16
0
        /// <summary>
        /// Runs the code example. Either a payments account ID or a payments profile ID
        /// must be provided for the example to run successfully. If both are provided, only the
        /// payments account ID will be used.
        /// </summary>
        /// <param name="client">The Google Ads client.</param>
        /// <param name="customerId">The Google Ads customer ID for which the call is made.</param>
        /// <param name="paymentsAccountId">Optional payments account ID to attach to the new
        ///     billing setup. Must be formatted as "1234-5678-9012-3456".</param>
        /// <param name="paymentsProfileId">Optional payments profile ID to attach to a new payments
        ///     account and to the new billing setup. Must be formatted as "1234-5678-9012".</param>
        public void Run(GoogleAdsClient client, long customerId, string paymentsAccountId,
                        string paymentsProfileId)
        {
            // Gets the GoogleAdsServiceClient.
            GoogleAdsServiceClient googleAdsService = client.GetService(
                Services.V4.GoogleAdsService);

            // Gets the BillingSetupServiceClient.
            BillingSetupServiceClient billingSetupServiceClient =
                client.GetService(Services.V4.BillingSetupService);

            try
            {
                // Constructs a new billing setup.
                BillingSetup billingSetup =
                    CreateBillingSetup(customerId, paymentsAccountId, paymentsProfileId);

                SetBillingSetupStartDateTime(googleAdsService, customerId, billingSetup);

                // Creates the billing setup operation.
                BillingSetupOperation operation = new BillingSetupOperation()
                {
                    Create = billingSetup
                };

                // Issues a mutate request to add the billing setup.
                MutateBillingSetupResponse billingResponse =
                    billingSetupServiceClient.MutateBillingSetup(customerId.ToString(), operation);

                Console.WriteLine("Added new billing setup with resource name: " +
                                  $"{billingResponse.Result.ResourceName}");
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
            catch (Exception e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Trace: {e.StackTrace}");
            }
        }
Exemplo n.º 17
0
        /// <summary>Snippet for MutateBillingSetupAsync</summary>
        public async Task MutateBillingSetupRequestObjectAsync()
        {
            // Snippet: MutateBillingSetupAsync(MutateBillingSetupRequest, CallSettings)
            // Additional: MutateBillingSetupAsync(MutateBillingSetupRequest, CancellationToken)
            // Create client
            BillingSetupServiceClient billingSetupServiceClient = await BillingSetupServiceClient.CreateAsync();

            // Initialize request argument(s)
            MutateBillingSetupRequest request = new MutateBillingSetupRequest
            {
                CustomerId = "",
                Operation  = new BillingSetupOperation(),
            };
            // Make the request
            MutateBillingSetupResponse response = await billingSetupServiceClient.MutateBillingSetupAsync(request);

            // End snippet
        }