defmain(client:GoogleAdsClient,customer_id:str,billing_setup_id:str):account_budget_proposal_service=client.get_service("AccountBudgetProposalService")billing_setup_service=client.get_service("BillingSetupService")account_budget_proposal_operation=client.get_type("AccountBudgetProposalOperation")proposal=account_budget_proposal_operation.createproposal.proposal_type=client.enums.AccountBudgetProposalTypeEnum.CREATEproposal.billing_setup=billing_setup_service.billing_setup_path(customer_id,billing_setup_id)proposal.proposed_name="Account Budget Proposal (example)"# Specify the account budget starts immediatelyproposal.proposed_start_time_type=client.enums.TimeTypeEnum.NOW# Alternatively you can specify a specific start time. Refer to the# AccountBudgetProposal resource documentation for allowed formats.## proposal.proposed_start_date_time = '2020-01-02 03:04:05'# Specify that the budget runs foreverproposal.proposed_end_time_type=client.enums.TimeTypeEnum.FOREVER# Alternatively you can specify a specific end time. Allowed formats are as# above.## proposal.proposed_end_date_time = '2021-01-02 03:04:05'# Optional: set notes for the budget. These are free text and do not effect# budget delivery.## proposal.proposed_notes = 'Received prepayment of $0.01'proposal.proposed_spending_limit_micros=10000account_budget_proposal_response=(account_budget_proposal_service.mutate_account_budget_proposal(customer_id=customer_id,operation=account_budget_proposal_operation,))print("Created account budget proposal "f'"{account_budget_proposal_response.result.resource_name}".')
defadd_account_budget_proposal(customer_id,billing_setup_id)# GoogleAdsClient will read a config file from# ENV['HOME']/google_ads_config.rb when called without parametersclient=Google::Ads::GoogleAds::GoogleAdsClient.newoperation=client.operation.create_resource.account_budget_proposaldo|proposal|proposal.billing_setup=client.path.billing_setup(customer_id,billing_setup_id)proposal.proposal_type=:CREATEproposal.proposed_name='Account Budget (example)'# Specify the account budget starts immediatelyproposal.proposed_start_time_type=:NOW# Alternatively you can specify a specific start time. Refer to the# AccountBudgetProposal resource documentation for allowed formats.## proposal.proposed_start_date_time = '2020-01-02 03:04:05'# Specify that the budget runs forever.proposal.proposed_end_time_type=:FOREVER# Alternatively you can specify a specific end time. Allowed formats are as# above.## proposal.proposed_end_date_time = '2021-01-02 03:04:05'# Optional: set notes for the budget. These are free text and do not affect# budget delivery.## proposal.proposed_notes = 'Received prepayment of $0.01'# Set the spending limit to 0.01, measured in the Google Ads account currency.proposal.proposed_spending_limit_micros=10_000endaccount_budget_proposal_service=client.service.account_budget_proposal# Add budget proposal.response=account_budget_proposal_service.mutate_account_budget_proposal(customer_id:customer_id,operation:operation,)putssprintf("Created budget proposal %s.",response.results.first.resource_name)end
subadd_account_budget_proposal{my($api_client,$customer_id,$billing_setup_id)=@_;# Create an account budget proposal.my$account_budget_proposal=Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({billingSetup=>
Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup($customer_id,$billing_setup_id),proposalType=>CREATE,proposedName=>"Account Budget (example)",# Specify that the account budget starts immediately.proposedStartTimeType=>NOW,# Alternatively you can specify a specific start time. Refer to the# AccountBudgetProposal class for allowed formats.## proposedStartDateTime => "2020-01-02 03:04:05",# Specify that the account budget runs forever.proposedEndDateTime=>FOREVER,# Alternatively you can specify a specific end time. Allowed formats are as below.# 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",# 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",# Set the spending limit to 0.01, measured in the Google Ads account currency.proposedSpendingLimitMicros=>10000});# Create an account budget proposal operation.my$account_budget_proposal_operation=Google::Ads::GoogleAds::V22::Services::AccountBudgetProposalService::AccountBudgetProposalOperation->new({create=>$account_budget_proposal});# Add the account budget proposal.my$account_budget_proposal_response=$api_client->AccountBudgetProposalService()->mutate({customerId=>$customer_id,operation=>$account_budget_proposal_operation});printf"Created account budget proposal '%s'.\n",$account_budget_proposal_response->{result}{resourceName};return1;}
AccountBudgetProposalOperation operation = AccountBudgetProposalOperation.newBuilder()
.setRemove(StringValue.of(ResourceNames.accountBudgetProposal(customerId, accountBudgetProposalId)))
.build();
// Send request to Google Ads API (not shown).
C#
AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
{
Remove = ResourceNames.AccountBudgetProposal(customerId, accountBudgetProposalId)
};
// Send request to Google Ads API (not shown).
operation = client.operation.remove_resource.account_budget_proposal(client.path.account_budget_proposal(customer_id, account_budget_proposal_id))
# Send request to Google Ads API (not shown).
Perl
my$account_budget_proposal_operation=Google::Ads::GoogleAds::V22::Services::AccountBudgetProposalService::AccountBudgetProposalOperation->new({remove=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup($customer_id,$account_budget_proposal_id)});# Send request to Google Ads API (not shown).
AccountBudgetProposal proposal = AccountBudgetProposal.newBuilder()
.setProposalType(AccountBudgetProposalType.UPDATE)
.setAccountBudget(accountBudget.getResourceName())
.setProposedSpendingLimitMicros(
accountBudget.getProposedSpendingLimitMicros().getValue() + increaseAmount)
.build();
AccountBudgetProposalOperation operation = AccountBudgetProposalOperation.newBuilder()
.setCreate(proposal)
.setUpdateMask(
FieldMask.newBuilder().addAllPaths(Arrays.asList("proposed_spending_limit")).build())
.build();
// Send request to Google Ads API (not shown).
C#
AccountBudgetProposal proposal = new AccountBudgetProposal()
{
ProposalType = AccountBudgetProposalType.Update,
AccountBudget = accountBudget.ResourceName,
ProposedSpendingLimitMicros = accountBudget.ProposedSpendingLimitMicros + increaseAmount
};
AccountBudgetProposalOperation operation = new AccountBudgetProposalOperation()
{
Create = proposal,
UpdateMask = new FieldMask()
{
Paths = { "proposed_spending_limit" }
}
};
// Send request to Google Ads API (not shown).
PHP
$accountBudgetProposal=newAccountBudgetProposal(['proposal_type'=>AccountBudgetProposalType::UPDATE,'account_budget'=>$accountBudget->getResourceName(),'proposed_spending_limit_micros'=>$accountBudget->getProposedSpendingLimitMicros()+$increaseAmount])$accountBudgetProposalOperation=newAccountBudgetProposalOperation();$accountBudgetProposalOperation->setCreate($accountBudgetProposal);$accountBudgetProposalOperation->setUpdateMask(FieldMasks::allSetFieldsOf($accountBudgetProposal));// Send request to Google Ads API (not shown).
my$account_budget_proposal=Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({proposalType=>UPDATE,accountBudget=>$account_budget->{resourceName},proposedSpendingLimitMicros=>$account_budget->{proposedSpendingLimitMicros}+$increaseAmount});my$account_budget_proposal_operation=Google::Ads::GoogleAds::V22::Services::AccountBudgetProposalService::AccountBudgetProposalOperation->new({create=>$account_budget_proposal,updateMask=>all_set_fields_of($account_budget_proposal)});# Send request to Google Ads API (not shown).
$proposalMay=newAccountBudgetProposal(['billing_setup'=>ResourceNames::forBillingSetup($customerId,$billingSetupId),'proposal_type'=>AccountBudgetProposalType::CREATE,'proposed_name'=>'Maybudget','proposed_start_date_time'=>'2018-05-01','proposed_end_date_time'=>'2018-06-01','proposed_spending_limit_micros'=>1000000000]);$proposalJune=newAccountBudgetProposal(['billing_setup'=>ResourceNames::forBillingSetup($customerId,$billingSetupId),'proposal_type'=>AccountBudgetProposalType::CREATE,'proposed_name'=>'Junebudget','proposed_start_date_time'=>'2018-06-01','proposed_end_date_time'=>'2018-07-01','proposed_spending_limit_micros'=>5000000000]);$proposalJuly=newAccountBudgetProposal(['billing_setup'=>ResourceNames::forBillingSetup($customerId,$billingSetupId),'proposal_type'=>AccountBudgetProposalType::CREATE,'proposed_name'=>'Julybudget','proposed_start_date_time'=>'2018-07-01','proposed_end_date_time'=>'2018-08-01','proposed_spending_limit_micros'=>1000000000]);// Send request to Google Ads API (not shown).
my$may_proposal=Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({billingSetup=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup($customer_id,$billing_setup_id),proposalType=>CREATE,proposedName=>"May budget",proposedStartDateTime=>"2018-05-01",proposedEndDateTime=>"2018-06-01",proposedSpendingLimitMicros=>1000000000});my$june_proposal=Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({billingSetup=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup($customer_id,$billing_setup_id),proposalType=>CREATE,proposedName=>"June budget",proposedStartDateTime=>"2018-06-01",proposedEndDateTime=>"2018-07-01",proposedSpendingLimitMicros=>5000000000});my$july_proposal=Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({billingSetup=>Google::Ads::GoogleAds::V22::Utils::ResourceNames::billing_setup($customer_id,$billing_setup_id),proposalType=>CREATE,proposedName=>"July budget",proposedStartDateTime=>"2018-07-01",proposedEndDateTime=>"2018-08-01",proposedSpendingLimitMicros=>1000000000});# Send request to Google Ads API (not shown).
AccountBudgetProposal proposal = new AccountBudgetProposal()
{
ProposalType = AccountBudgetProposalType.End,
AccountBudget = accountBudget.ResourceName
};
// Send request to Google Ads API (not shown).
PHP
$accountBudgetProposal=newAccountBudgetProposal(['proposal_type'=>AccountBudgetProposalType::END,'account_budget'=>$accountBudget->getResourceName()])// Send request to Google Ads API (not shown).
my$account_budget_proposal=Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({proposalType=>END,accountBudget=>$account_budget->{resourceName});# Send request to Google Ads API (not shown).
AccountBudgetProposal.newBuilder()
.setProposalType(AccountBudgetProposalType.REMOVE)
.setAccountBudget(accountBudget.getResourceName())
.build();
// Send request to Google Ads API (not shown).
C#
AccountBudgetProposal proposal = new AccountBudgetProposal()
{
ProposalType = AccountBudgetProposalType.Remove,
AccountBudget = accountBudget.ResourceName
};
// Send request to Google Ads API (not shown).
PHP
$accountBudgetProposal=newAccountBudgetProposal(['proposal_type'=>AccountBudgetProposalType::REMOVE,'account_budget'=>$accountBudget->getResourceName()])// Send request to Google Ads API (not shown).
my$account_budget_proposal=Google::Ads::GoogleAds::V22::Resources::AccountBudgetProposal->new({proposalType=>REMOVE,accountBudget=>$account_budget->{resourceName});# Send request to Google Ads API (not shown).