public function createAdSet()

in src/FacebookAds/Object/AdAccount.php [851:1010]


  public function createAdSet(array $fields = array(), array $params = array(), $pending = false) {
    $this->assureId();

    $param_types = array(
      'adlabels' => 'list<Object>',
      'adset_schedule' => 'list<Object>',
      'attribution_spec' => 'list<map>',
      'bid_adjustments' => 'Object',
      'bid_amount' => 'int',
      'bid_constraints' => 'map<string, Object>',
      'bid_strategy' => 'bid_strategy_enum',
      'billing_event' => 'billing_event_enum',
      'campaign_id' => 'string',
      'campaign_spec' => 'Object',
      'creative_sequence' => 'list<string>',
      'daily_budget' => 'unsigned int',
      'daily_imps' => 'unsigned int',
      'daily_min_spend_target' => 'unsigned int',
      'daily_spend_cap' => 'unsigned int',
      'date_format' => 'string',
      'destination_type' => 'destination_type_enum',
      'end_time' => 'datetime',
      'execution_options' => 'list<execution_options_enum>',
      'existing_customer_budget_percentage' => 'unsigned int',
      'frequency_control_specs' => 'list<Object>',
      'full_funnel_exploration_mode' => 'full_funnel_exploration_mode_enum',
      'is_dynamic_creative' => 'bool',
      'lifetime_budget' => 'unsigned int',
      'lifetime_imps' => 'unsigned int',
      'lifetime_min_spend_target' => 'unsigned int',
      'lifetime_spend_cap' => 'unsigned int',
      'line_number' => 'unsigned int',
      'multi_optimization_goal_weight' => 'multi_optimization_goal_weight_enum',
      'name' => 'string',
      'optimization_goal' => 'optimization_goal_enum',
      'optimization_sub_event' => 'optimization_sub_event_enum',
      'pacing_type' => 'list<string>',
      'promoted_object' => 'Object',
      'rb_prediction_id' => 'string',
      'rf_prediction_id' => 'string',
      'source_adset_id' => 'string',
      'start_time' => 'datetime',
      'status' => 'status_enum',
      'targeting' => 'Targeting',
      'time_based_ad_rotation_id_blocks' => 'list<list<unsigned int>>',
      'time_based_ad_rotation_intervals' => 'list<unsigned int>',
      'time_start' => 'datetime',
      'time_stop' => 'datetime',
      'topline_id' => 'string',
      'tune_for_category' => 'tune_for_category_enum',
      'upstream_events' => 'map',
    );
    $enums = array(
      'bid_strategy_enum' => array(
        'COST_CAP',
        'LOWEST_COST_WITHOUT_CAP',
        'LOWEST_COST_WITH_BID_CAP',
      ),
      'billing_event_enum' => array(
        'APP_INSTALLS',
        'CLICKS',
        'IMPRESSIONS',
        'LINK_CLICKS',
        'LISTING_INTERACTION',
        'NONE',
        'OFFER_CLAIMS',
        'PAGE_LIKES',
        'POST_ENGAGEMENT',
        'PURCHASE',
        'THRUPLAY',
      ),
      'destination_type_enum' => array(
        'APP',
        'APPLINKS_AUTOMATIC',
        'FACEBOOK',
        'MESSENGER',
        'UNDEFINED',
        'WEBSITE',
      ),
      'execution_options_enum' => array(
        'include_recommendations',
        'validate_only',
      ),
      'full_funnel_exploration_mode_enum' => array(
        'EXTENDED_EXPLORATION',
        'LIMITED_EXPLORATION',
        'NONE_EXPLORATION',
      ),
      'multi_optimization_goal_weight_enum' => array(
        'BALANCED',
        'PREFER_EVENT',
        'PREFER_INSTALL',
        'UNDEFINED',
      ),
      'optimization_goal_enum' => array(
        'AD_RECALL_LIFT',
        'APP_INSTALLS',
        'APP_INSTALLS_AND_OFFSITE_CONVERSIONS',
        'CONVERSATIONS',
        'DERIVED_EVENTS',
        'ENGAGED_USERS',
        'EVENT_RESPONSES',
        'IMPRESSIONS',
        'IN_APP_VALUE',
        'LANDING_PAGE_VIEWS',
        'LEAD_GENERATION',
        'LINK_CLICKS',
        'NONE',
        'OFFSITE_CONVERSIONS',
        'PAGE_LIKES',
        'POST_ENGAGEMENT',
        'QUALITY_CALL',
        'QUALITY_LEAD',
        'REACH',
        'THRUPLAY',
        'VALUE',
        'VISIT_INSTAGRAM_PROFILE',
      ),
      'optimization_sub_event_enum' => array(
        'NONE',
        'TRAVEL_INTENT',
        'TRAVEL_INTENT_BUCKET_01',
        'TRAVEL_INTENT_BUCKET_02',
        'TRAVEL_INTENT_BUCKET_03',
        'TRAVEL_INTENT_BUCKET_04',
        'TRAVEL_INTENT_BUCKET_05',
        'TRAVEL_INTENT_NO_DESTINATION_INTENT',
        'TRIP_CONSIDERATION',
        'VIDEO_SOUND_ON',
      ),
      'status_enum' => array(
        'ACTIVE',
        'ARCHIVED',
        'DELETED',
        'PAUSED',
      ),
      'tune_for_category_enum' => array(
        'CREDIT',
        'EMPLOYMENT',
        'HOUSING',
        'ISSUES_ELECTIONS_POLITICS',
        'NONE',
        'ONLINE_GAMBLING_AND_GAMING',
      ),
    );

    $request = new ApiRequest(
      $this->api,
      $this->data['id'],
      RequestInterface::METHOD_POST,
      '/adsets',
      new AbstractCrudObject(),
      'EDGE',
      array(),
      new TypeChecker($param_types, $enums)
    );
    $request->addParams($params);
    $request->addFields($fields);
    return $pending ? $request : $request->execute();
  }