def create_ad_set()

in facebook_business/adobjects/adaccount.py [0:0]


    def create_ad_set(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False):
        from facebook_business.utils import api_utils
        if batch is None and (success is not None or failure is not None):
          api_utils.warning('`success` and `failure` callback only work for batch call.')
        param_types = {
            '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 = {
            'bid_strategy_enum': [
                'COST_CAP',
                'LOWEST_COST_WITHOUT_CAP',
                'LOWEST_COST_WITH_BID_CAP',
            ],
            'billing_event_enum': [
                'APP_INSTALLS',
                'CLICKS',
                'IMPRESSIONS',
                'LINK_CLICKS',
                'LISTING_INTERACTION',
                'NONE',
                'OFFER_CLAIMS',
                'PAGE_LIKES',
                'POST_ENGAGEMENT',
                'PURCHASE',
                'THRUPLAY',
            ],
            'destination_type_enum': [
                'APP',
                'APPLINKS_AUTOMATIC',
                'FACEBOOK',
                'MESSENGER',
                'UNDEFINED',
                'WEBSITE',
            ],
            'execution_options_enum': [
                'include_recommendations',
                'validate_only',
            ],
            'full_funnel_exploration_mode_enum': [
                'EXTENDED_EXPLORATION',
                'LIMITED_EXPLORATION',
                'NONE_EXPLORATION',
            ],
            'multi_optimization_goal_weight_enum': [
                'BALANCED',
                'PREFER_EVENT',
                'PREFER_INSTALL',
                'UNDEFINED',
            ],
            'optimization_goal_enum': [
                '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': [
                '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': [
                'ACTIVE',
                'ARCHIVED',
                'DELETED',
                'PAUSED',
            ],
            'tune_for_category_enum': [
                'CREDIT',
                'EMPLOYMENT',
                'HOUSING',
                'ISSUES_ELECTIONS_POLITICS',
                'NONE',
                'ONLINE_GAMBLING_AND_GAMING',
            ],
        }
        request = FacebookRequest(
            node_id=self['id'],
            method='POST',
            endpoint='/adsets',
            api=self._api,
            param_checker=TypeChecker(param_types, enums),
            target_class=AbstractCrudObject,
            api_type='EDGE',
            response_parser=ObjectParser(target_class=AbstractCrudObject, api=self._api),
        )
        request.add_params(params)
        request.add_fields(fields)

        if batch is not None:
            request.add_to_batch(batch, success=success, failure=failure)
            return request
        elif pending:
            return request
        else:
            self.assure_call()
            return request.execute()