Creates a new Display Network campaign.

  Args:
    client: an AdWordsClient instance.
    merchant_id: a int merchant center ID.
    budget_id: a int budget ID.

  Returns:
    The campaign that was successfully created.
175773
def CreateCampaign(client, merchant_id, budget_id):
  
  campaign_service = client.GetService('CampaignService', 'v201809')

  campaign = {
      'name': 'Shopping campaign #%d' % uuid.uuid4(),
      # Dynamic remarketing campaigns are only available on the Google Display
      # Network.
      'advertisingChannelType': 'DISPLAY',
      'status': 'PAUSED',
      'budget': {
          'budgetId': budget_id
      },
      # This example uses a Manual CPC bidding strategy, but you should select
      # the strategy that best aligns with your sales goals. More details here:
      # https://support.google.com/adwords/answer/2472725
      'biddingStrategyConfiguration': {
          'biddingStrategyType': 'MANUAL_CPC'
      },
      'settings': [{
          'xsi_type': 'ShoppingSetting',
          # Campaigns with numerically higher priorities take precedence over
          # those with lower priorities.
          'campaignPriority': 0,
          'merchantId': merchant_id,
          # Display network campaigns do not support partition by country. The
          # only supported value is "ZZ". This signals that products from all
          # countries are available in this campaign. The actual products which
          # serve are based on the products tagged in the user list entry.
          'salesCountry': 'ZZ',
          # Optional: Enable local inventory ads (items for sale in physical
          # stores.)
          'enableLocal': True,
      }]
  }

  operations = [{
      'operator': 'ADD',
      'operand': campaign
  }]

  return campaign_service.mutate(operations)['value'][0]
642483
def create(**data):
        
        http_client = HttpClient()
        response, _ = http_client.post(routes.url(routes.PAYMENT_RESOURCE), data)
        return resources.Payment(**response)
1268950
function newBid(serverBid, rtbBid, bidderRequest) {
  const bidRequest = utils.getBidRequest(serverBid.uuid, [bidderRequest]);
  const bid = {
    requestId: serverBid.uuid,
    cpm: rtbBid.cpm,
    creativeId: rtbBid.creative_id,
    dealId: rtbBid.deal_id,
    currency: 'USD',
    netRevenue: true,
    ttl: 300,
    adUnitCode: bidRequest.adUnitCode,
    appnexus: {
      buyerMemberId: rtbBid.buyer_member_id,
      dealPriority: rtbBid.deal_priority,
      dealCode: rtbBid.deal_code
    }
  };

  if (rtbBid.rtb.video) {
    Object.assign(bid, {
      width: rtbBid.rtb.video.player_width,
      height: rtbBid.rtb.video.player_height,
      vastUrl: rtbBid.rtb.video.asset_url,
      vastImpUrl: rtbBid.notify_url,
      ttl: 3600
    });

    const videoContext = utils.deepAccess(bidRequest, 'mediaTypes.video.context');
    if (videoContext === ADPOD) {
      const iabSubCatId = getIabSubCategory(bidRequest.bidder, rtbBid.brand_category_id);
      bid.meta = {
        iabSubCatId
      };

      bid.video = {
        context: ADPOD,
        durationSeconds: Math.floor(rtbBid.rtb.video.duration_ms / 1000),
      };
    }

    // This supports Outstream Video
    if (rtbBid.renderer_url) {
      const rendererOptions = utils.deepAccess(
        bidderRequest.bids[0],
        'renderer.options'
      );

      Object.assign(bid, {
        adResponse: serverBid,
        renderer: newRenderer(bid.adUnitCode, rtbBid, rendererOptions)
      });
      bid.adResponse.ad = bid.adResponse.ads[0];
      bid.adResponse.ad.video = bid.adResponse.ad.rtb.video;
    }
  } else if (rtbBid.rtb[NATIVE]) {
    const nativeAd = rtbBid.rtb[NATIVE];
    bid[NATIVE] = {
      title: nativeAd.title,
      body: nativeAd.desc,
      body2: nativeAd.desc2,
      cta: nativeAd.ctatext,
      rating: nativeAd.rating,
      sponsoredBy: nativeAd.sponsored,
      privacyLink: nativeAd.privacy_link,
      address: nativeAd.address,
      downloads: nativeAd.downloads,
      likes: nativeAd.likes,
      phone: nativeAd.phone,
      price: nativeAd.price,
      salePrice: nativeAd.saleprice,
      clickUrl: nativeAd.link.url,
      displayUrl: nativeAd.displayurl,
      clickTrackers: nativeAd.link.click_trackers,
      impressionTrackers: nativeAd.impression_trackers,
      javascriptTrackers: nativeAd.javascript_trackers
    };
    if (nativeAd.main_img) {
      bid['native'].image = {
        url: nativeAd.main_img.url,
        height: nativeAd.main_img.height,
        width: nativeAd.main_img.width,
      };
    }
    if (nativeAd.icon) {
      bid['native'].icon = {
        url: nativeAd.icon.url,
        height: nativeAd.icon.height,
        width: nativeAd.icon.width,
      };
    }
  } else {
    Object.assign(bid, {
      width: rtbBid.rtb.banner.width,
      height: rtbBid.rtb.banner.height,
      ad: rtbBid.rtb.banner.content
    });
    try {
      const url = rtbBid.rtb.trackers[0].impression_urls[0];
      const tracker = utils.createTrackPixelHtml(url);
      bid.ad += tracker;
    } catch (error) {
      utils.logError('Error appending tracking pixel', error);
    }
  }

  return bid;
}
81119
def network_sub_create_notif(self, tenant_id, tenant_name, cidr):
        
        if not self.fw_init:
            return
        self.network_create_notif(tenant_id, tenant_name, cidr)
179422
def _CreatePerformanceTarget(client, campaign_group_id):
  
  # Get the CampaignGroupPerformanceTargetService.
  cgpt_service = client.GetService('CampaignGroupPerformanceTargetService',
                                   version='v201809')

  # Create the operation.
  operations = [{
      'operator': 'ADD',
      # Create the performance target.
      'operand': {
          'campaignGroupId': campaign_group_id,
          'performanceTarget': {
              # Keep the CPC for the campaigns < $3.
              'efficiencyTargetType': 'CPC_LESS_THAN_OR_EQUAL_TO',
              'efficiencyTargetValue': 3000000,
              # Keep the maximum spend under $50.
              'spendTargetType': 'MAXIMUM',
              'spendTarget': {
                  'microAmount': 500000000
              },
              # Aim for at least 3000 clicks.
              'volumeGoalType': 'MAXIMIZE_CLICKS',
              'volumeTargetValue': 3000,
              # Start the performance target today, and run it for the next 90
              # days.
              'startDate': datetime.datetime.now().strftime('%Y%m%d'),
              'endDate': (datetime.datetime.now() +
                          datetime.timedelta(90)).strftime('%Y%m%d')
          }
      }
  }]

  cgpt = cgpt_service.mutate(operations)['value'][0]

  # Display the results.
  print ('Campaign performance target with ID "%d" was added for campaign '
         'group ID "%d".' % (cgpt['id'], cgpt['campaignGroupId']))
58322
def CreateUnit(self, parent=None, value=None, bid_amount=None):
    
    unit = {
        'xsi_type': 'ProductPartition',
        'partitionType': 'UNIT'
    }

    # The root node has neither a parent nor a value.
    if parent is not None:
      unit['parentCriterionId'] = parent['id']
      unit['caseValue'] = value

    if bid_amount is not None and bid_amount > 0:
      # Note: Showcase ads require that the campaign has a ManualCpc
      # BiddingStrategyConfiguration.
      bidding_strategy_configuration = {
          'bids': [{
              'xsi_type': 'CpcBid',
              'bid': {
                  'xsi_type': 'Money',
                  'microAmount': str(bid_amount)
              }
          }]
      }

      adgroup_criterion = {
          'xsi_type': 'BiddableAdGroupCriterion',
          'biddingStrategyConfiguration': bidding_strategy_configuration
      }
    else:
      adgroup_criterion = {
          'xsi_type': 'NegativeAdGroupCriterion'
      }

    adgroup_criterion['adGroupId'] = self.adgroup_id
    adgroup_criterion['criterion'] = unit

    self.CreateAddOperation(adgroup_criterion)

    return unit
1139451
private static AdGroup createAdGroup(
      AdWordsServicesInterface adWordsServices, AdWordsSession session, Campaign campaign)
      throws ApiException, RemoteException {
    // Get the AdGroupService.
    AdGroupServiceInterface adGroupService =
        adWordsServices.get(session, AdGroupServiceInterface.class);

    // Create the ad group.
    AdGroup adGroup = new AdGroup();

    // Required: Set the ad group's type to Dynamic Search Ads.
    adGroup.setAdGroupType(AdGroupType.SEARCH_DYNAMIC_ADS);

    adGroup.setName("Earth to Mars Cruises #" + System.currentTimeMillis());
    adGroup.setCampaignId(campaign.getId());
    adGroup.setStatus(AdGroupStatus.PAUSED);

    // Recommended: Set a tracking URL template for your ad group if you want to use URL
    // tracking software.
    adGroup.setTrackingUrlTemplate("http://tracker.example.com/traveltracker/{escapedlpurl}");
    
    // Set the ad group bids.
    BiddingStrategyConfiguration biddingConfig = new BiddingStrategyConfiguration();

    CpcBid cpcBid = new CpcBid();
    cpcBid.setBid(new Money());
    cpcBid.getBid().setMicroAmount(3000000L);

    biddingConfig.setBids(new Bids[] {cpcBid});

    adGroup.setBiddingStrategyConfiguration(biddingConfig);

    // Create the operation.
    AdGroupOperation operation = new AdGroupOperation();
    operation.setOperand(adGroup);
    operation.setOperator(Operator.ADD);

    AdGroup newAdGroup = adGroupService.mutate(new AdGroupOperation[] {operation}).getValue(0);
    System.out.printf(
        "Ad group with name '%s' and ID %d was added.%n", newAdGroup.getName(), newAdGroup.getId());
    return newAdGroup;
  }
360097
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session)
      throws RemoteException {
    Budget budget = createBudget(adWordsServices, session);

    Campaign campaign = createCampaign(adWordsServices, session, budget);
    AdGroup adGroup = createAdGroup(adWordsServices, session, campaign);
    createExpandedDSA(adWordsServices, session, adGroup);
    addWebPageCriteria(adWordsServices, session, adGroup);
  }
102605
private static function createAdGroup(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        Campaign $campaign
    ) {
        $adGroupService = $adWordsServices->get($session, AdGroupService::class);

        // Create the ad group.
        $adGroup = new AdGroup();

        // Required: Set the ad group's type to Dynamic Search Ads.
        $adGroup->setAdGroupType(AdGroupType::SEARCH_DYNAMIC_ADS);

        $adGroup->setName('Interplanetary Cruise #' . uniqid());
        $adGroup->setCampaignId($campaign->getId());
        $adGroup->setStatus(AdGroupStatus::PAUSED);

        // Recommended: Set a tracking URL template for your ad group if you want to
        // use URL tracking software.
        $adGroup->setTrackingUrlTemplate(
            'http://tracker.example.com/traveltracker/{escapedlpurl}'
        );

        // Set the ad group bids.
        $biddingStrategyConfiguration = new BiddingStrategyConfiguration();

        $cpcBid = new CpcBid();
        $money = new Money();
        $money->setMicroAmount(3000000);
        $cpcBid->setBid($money);
        $biddingStrategyConfiguration->setBids([$cpcBid]);

        $adGroup->setBiddingStrategyConfiguration($biddingStrategyConfiguration);

        // Create an ad group operation.
        $operation = new AdGroupOperation();
        $operation->setOperand($adGroup);
        $operation->setOperator(Operator::ADD);

        // Create the ad group on the server and print out some information.
        $result = $adGroupService->mutate([$operation]);
        $adGroup = $result->getValue()[0];
        printf(
            "Ad group with name '%s' and ID %d was added.\n",
            $adGroup->getName(),
            $adGroup->getId()
        );

        return $adGroup;
    }
310281
@Override
	@Transactional(enabled = false)
	public CommercePriceEntry createCommercePriceEntry(
		long commercePriceEntryId) {
		return commercePriceEntryPersistence.create(commercePriceEntryId);
	}
443032
def _create_vote_txn(signer, proposal_id, setting_key, vote_value):
    
    if vote_value == 'accept':
        vote_id = SettingVote.ACCEPT
    else:
        vote_id = SettingVote.REJECT

    vote = SettingVote(proposal_id=proposal_id, vote=vote_id)
    payload = SettingsPayload(data=vote.SerializeToString(),
                              action=SettingsPayload.VOTE)

    return _make_txn(signer, setting_key, payload)
725375
def channels_voice_agent_ticket_display_create(self, agent_id, ticket_id, data, **kwargs):
        ""
        api_path = "/api/v2/channels/voice/agents/{agent_id}/tickets/{ticket_id}/display.json"
        api_path = api_path.format(agent_id=agent_id, ticket_id=ticket_id)
        return self.call(api_path, method="POST", data=data, **kwargs)
142200
def AddClient(self, client):
    

    client_id, keywords = self.AnalyzeClient(client)
    self.AddKeywordsForName(client_id, keywords)
403744
def AddBudget(self, client_customer_id, micro_amount):
    
    self.client.SetClientCustomerId(client_customer_id)

    budget_service = self.client.GetService('BudgetService')

    operations = [{
        'operator': 'ADD',
        'operand': {
            'name': 'Budget #%s' % time.time(),
            'amount': {
                'microAmount': micro_amount
            },
            'deliveryMethod': 'STANDARD'
        }
    }]

    return budget_service.mutate(operations)['value'][0]['budgetId']
1020810
def CreateSharedBudget(client):
  
  # Initialize appropriate service.
  budget_service = client.GetService('BudgetService', version='v201809')

  # Create a shared budget
  budget = {
      'name': 'Shared Interplanetary Budget #%s' % uuid.uuid4(),
      'amount': {
          'microAmount': '2000000'
      },
      'deliveryMethod': 'STANDARD',
      'isExplicitlyShared': 'true'
  }

  # Create operation.
  operation = {
      'operator': 'ADD',
      'operand': budget
  }

  response = budget_service.mutate([operation])
  return response['value'][0]
1360071
def complete(self, campaign_id):
        

        return super(API, self).get(
            resource_id=campaign_id, resource_action='complete')
1189052
def create(self, id):
        
        resp = self.client.accounts.create(id=id)
        self.display(resp)