/// <summary>Snippet for MutateAccountBudgetProposal</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateAccountBudgetProposal()
 {
     // Create client
     AccountBudgetProposalServiceClient accountBudgetProposalServiceClient = AccountBudgetProposalServiceClient.Create();
     // Initialize request argument(s)
     string customerId = "";
     AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation();
     // Make the request
     MutateAccountBudgetProposalResponse response = accountBudgetProposalServiceClient.MutateAccountBudgetProposal(customerId, operation);
 }
Exemple #2
0
 /// <summary>Snippet for MutateAccountBudgetProposal</summary>
 /// <remarks>
 /// This snippet has been automatically generated for illustrative purposes only.
 /// It may require modifications to work in your environment.
 /// </remarks>
 public void MutateAccountBudgetProposalRequestObject()
 {
     // Create client
     AccountBudgetProposalServiceClient accountBudgetProposalServiceClient = AccountBudgetProposalServiceClient.Create();
     // Initialize request argument(s)
     MutateAccountBudgetProposalRequest request = new MutateAccountBudgetProposalRequest
     {
         CustomerId   = "",
         Operation    = new AccountBudgetProposalOperation(),
         ValidateOnly = false,
     };
     // Make the request
     MutateAccountBudgetProposalResponse response = accountBudgetProposalServiceClient.MutateAccountBudgetProposal(request);
 }
        /// <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">The Billing Setup ID for which the call is made.</param>
        public void Run(GoogleAdsClient client, long customerId, long billingSetupId)
        {
            // Get the AccountBudgetProposalServiceClient.
            AccountBudgetProposalServiceClient proposalService =
                client.GetService(Services.V4.AccountBudgetProposalService);

            // Create an AccountBudgetProposal.
            // The proposal will be reviewed offline by Google Ads, and if approved will
            // become an AccountBudget.
            AccountBudgetProposal proposal = new AccountBudgetProposal()
            {
                BillingSetup = ResourceNames.BillingSetup(customerId, billingSetupId),
                ProposalType = AccountBudgetProposalType.Create,
                ProposedName = "Account Budget (example)",

                // Specify the account budget starts immediately
                ProposedStartTimeType = TimeType.Now,
                // Alternatively, you can specify a specific start time. Refer to the
                // AccountBudgetProposal resource documentation for allowed formats.
                //
                //ProposedStartDateTime = "2020-01-02 03:04:05",

                // Specify that the budget runs forever.
                ProposedEndTimeType = TimeType.Forever,
                // Alternatively you can specify a specific end time. Allowed formats are as above.
                //ProposedEndDateTime = "2021-02-03 04:05:06",

                // Optional: set notes for the budget. These are free text and do not effect budget
                // delivery.
                //ProposedNotes = "Received prepayment of $0.01",

                // Set the spending limit to 0.01, measured in the Google Ads account currency.
                ProposedSpendingLimitMicros = 10_000

                                              // Optional: set PO number for record keeping. This value is at the user's
                                              // discretion, and has no effect on Google Billing & Payments.
                                              //ProposedPurchaseOrderNumber = "PO number 12345"
            };

            // Create an operation which will add the new AccountBudgetProposal
            AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
            {
                Create = proposal
            };

            try
            {
                // Send the request to the Account Budget Proposal Service.
                MutateAccountBudgetProposalResponse response = proposalService.
                                                               MutateAccountBudgetProposal(customerId.ToString(), operation);

                // Display the results.
                Console.WriteLine($"Account budget proposal '{response.Result.ResourceName}' " +
                                  "was created.");
            }
            catch (GoogleAdsException e)
            {
                Console.WriteLine("Failure:");
                Console.WriteLine($"Message: {e.Message}");
                Console.WriteLine($"Failure: {e.Failure}");
                Console.WriteLine($"Request ID: {e.RequestId}");
                throw;
            }
        }