Skip to content

Commit

Permalink
Update EndpointDecodeDict
Browse files Browse the repository at this point in the history
Summary:
Update EndpointDecodeDict.txt to support new names.
Make WhatsApp two words to align with the current situation.

Reviewed By: liliarizona

Differential Revision: D62056156

fbshipit-source-id: 6337eb9f819cc781c9b9164e0b12753da991ef99
  • Loading branch information
stcheng authored and facebook-github-bot committed Aug 31, 2024
1 parent 9a0e6fa commit da0789f
Show file tree
Hide file tree
Showing 98 changed files with 2,536 additions and 1,234 deletions.
2 changes: 1 addition & 1 deletion facebook_business/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
from facebook_business.session import FacebookSession
from facebook_business.api import FacebookAdsApi

__version__ = '20.0.1'
__version__ = '20.0.2'
__all__ = ['session', 'api']
112 changes: 111 additions & 1 deletion facebook_business/adobjects/adaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,20 @@ class Tasks:
draft = 'DRAFT'
manage = 'MANAGE'

class BrandSafetyContentFilterLevels:
an_relaxed = 'AN_RELAXED'
an_standard = 'AN_STANDARD'
an_strict = 'AN_STRICT'
facebook_relaxed = 'FACEBOOK_RELAXED'
facebook_standard = 'FACEBOOK_STANDARD'
facebook_strict = 'FACEBOOK_STRICT'
feed_dnm = 'FEED_DNM'
feed_relaxed = 'FEED_RELAXED'
feed_standard = 'FEED_STANDARD'
feed_strict = 'FEED_STRICT'
uninitialized = 'UNINITIALIZED'
unknown = 'UNKNOWN'

class ClaimObjective:
automotive_model = 'AUTOMOTIVE_MODEL'
collaborative_ads = 'COLLABORATIVE_ADS'
Expand Down Expand Up @@ -1671,7 +1685,6 @@ def create_ad_video(self, fields=None, params=None, batch=None, success=None, fa
api_utils.warning('`success` and `failure` callback only work for batch call.')
from facebook_business.adobjects.advideo import AdVideo
param_types = {
'animated_effect_id': 'unsigned int',
'application_id': 'string',
'asked_fun_fact_prompt_id': 'unsigned int',
'audio_story_wave_animation_handle': 'string',
Expand Down Expand Up @@ -2224,6 +2237,39 @@ def create_block_list_draft(self, fields=None, params=None, batch=None, success=
self.assure_call()
return request.execute()

def create_brand_safety_content_filter_level(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 = {
'brand_safety_content_filter_levels': 'list<brand_safety_content_filter_levels_enum>',
'business_id': 'string',
}
enums = {
'brand_safety_content_filter_levels_enum': AdAccount.BrandSafetyContentFilterLevels.__dict__.values(),
}
request = FacebookRequest(
node_id=self['id'],
method='POST',
endpoint='/brand_safety_content_filter_levels',
api=self._api,
param_checker=TypeChecker(param_types, enums),
target_class=AdAccount,
api_type='EDGE',
response_parser=ObjectParser(target_class=AdAccount, 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()

def get_broad_targeting_categories(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):
Expand Down Expand Up @@ -3682,6 +3728,69 @@ def create_reach_frequency_prediction(self, fields=None, params=None, batch=None
self.assure_call()
return request.execute()

def get_recommendations(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.')
from facebook_business.adobjects.adaccountrecommendations import AdAccountRecommendations
param_types = {
}
enums = {
}
request = FacebookRequest(
node_id=self['id'],
method='GET',
endpoint='/recommendations',
api=self._api,
param_checker=TypeChecker(param_types, enums),
target_class=AdAccountRecommendations,
api_type='EDGE',
response_parser=ObjectParser(target_class=AdAccountRecommendations, 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()

def create_recommendation(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.')
from facebook_business.adobjects.adaccountrecommendations import AdAccountRecommendations
param_types = {
'recommendation_signature': 'string',
}
enums = {
}
request = FacebookRequest(
node_id=self['id'],
method='POST',
endpoint='/recommendations',
api=self._api,
param_checker=TypeChecker(param_types, enums),
target_class=AdAccountRecommendations,
api_type='EDGE',
response_parser=ObjectParser(target_class=AdAccountRecommendations, 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()

def get_saved_audiences(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):
Expand Down Expand Up @@ -4290,6 +4399,7 @@ def _get_field_enum_info(cls):
field_enum_info['Currency'] = AdAccount.Currency.__dict__.values()
field_enum_info['PermittedTasks'] = AdAccount.PermittedTasks.__dict__.values()
field_enum_info['Tasks'] = AdAccount.Tasks.__dict__.values()
field_enum_info['BrandSafetyContentFilterLevels'] = AdAccount.BrandSafetyContentFilterLevels.__dict__.values()
field_enum_info['ClaimObjective'] = AdAccount.ClaimObjective.__dict__.values()
field_enum_info['ContentType'] = AdAccount.ContentType.__dict__.values()
field_enum_info['Subtype'] = AdAccount.Subtype.__dict__.values()
Expand Down
57 changes: 57 additions & 0 deletions facebook_business/adobjects/adaccountadvolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,36 +40,48 @@ class Field(AbstractObject.Field):
class RecommendationType:
aac_creation_package = 'AAC_CREATION_PACKAGE'
ab_test = 'AB_TEST'
account_needs_credit = 'ACCOUNT_NEEDS_CREDIT'
account_spend_limit = 'ACCOUNT_SPEND_LIMIT'
account_spend_limit_duplication = 'ACCOUNT_SPEND_LIMIT_DUPLICATION'
aco_toggle = 'ACO_TOGGLE'
ads_reporting = 'ADS_REPORTING'
advanced_campaign_budget = 'ADVANCED_CAMPAIGN_BUDGET'
advantage_app_campaign = 'ADVANTAGE_APP_CAMPAIGN'
advantage_campaign_budget_duplication = 'ADVANTAGE_CAMPAIGN_BUDGET_DUPLICATION'
advantage_custom_audience = 'ADVANTAGE_CUSTOM_AUDIENCE'
advantage_custom_audience_duplication = 'ADVANTAGE_CUSTOM_AUDIENCE_DUPLICATION'
advantage_custom_audience_upsell = 'ADVANTAGE_CUSTOM_AUDIENCE_UPSELL'
advantage_detailed_targeting = 'ADVANTAGE_DETAILED_TARGETING'
advantage_lookalike_audience = 'ADVANTAGE_LOOKALIKE_AUDIENCE'
advantage_lookalike_duplication = 'ADVANTAGE_LOOKALIKE_DUPLICATION'
advantage_plus_app_campaign_precreate = 'ADVANTAGE_PLUS_APP_CAMPAIGN_PRECREATE'
advantage_plus_audience = 'ADVANTAGE_PLUS_AUDIENCE'
advantage_plus_audience_duplication = 'ADVANTAGE_PLUS_AUDIENCE_DUPLICATION'
advantage_plus_audience_friction = 'ADVANTAGE_PLUS_AUDIENCE_FRICTION'
advantage_plus_audience_toggle = 'ADVANTAGE_PLUS_AUDIENCE_TOGGLE'
advantage_plus_campaign_budget = 'ADVANTAGE_PLUS_CAMPAIGN_BUDGET'
advantage_plus_catalog_ads = 'ADVANTAGE_PLUS_CATALOG_ADS'
advantage_plus_creative = 'ADVANTAGE_PLUS_CREATIVE'
advantage_plus_creative_catalog = 'ADVANTAGE_PLUS_CREATIVE_CATALOG'
advantage_plus_creative_se = 'ADVANTAGE_PLUS_CREATIVE_SE'
advantage_plus_placements_duplication = 'ADVANTAGE_PLUS_PLACEMENTS_DUPLICATION'
advantage_plus_placements_friction = 'ADVANTAGE_PLUS_PLACEMENTS_FRICTION'
advantage_shopping_campaign = 'ADVANTAGE_SHOPPING_CAMPAIGN'
advantage_shopping_campaign_fragmentation = 'ADVANTAGE_SHOPPING_CAMPAIGN_FRAGMENTATION'
ad_lift_recall_goal_precreate = 'AD_LIFT_RECALL_GOAL_PRECREATE'
ad_lift_recall_optimization_goal = 'AD_LIFT_RECALL_OPTIMIZATION_GOAL'
ad_objective = 'AD_OBJECTIVE'
aem_v2_ineligible = 'AEM_V2_INELIGIBLE'
aggregated_bid_limited = 'AGGREGATED_BID_LIMITED'
aggregated_budget_limited = 'AGGREGATED_BUDGET_LIMITED'
aggregated_cost_limited = 'AGGREGATED_COST_LIMITED'
aplus_c_catalog_duplication = 'APLUS_C_CATALOG_DUPLICATION'
app_aem_v2_installation_promotion = 'APP_AEM_V2_INSTALLATION_PROMOTION'
app_engaged_view_conversions_duplication = 'APP_ENGAGED_VIEW_CONVERSIONS_DUPLICATION'
asc_budget_optimization = 'ASC_BUDGET_OPTIMIZATION'
asc_creation_package = 'ASC_CREATION_PACKAGE'
asc_fragmentation_v2 = 'ASC_FRAGMENTATION_V2'
asc_precreate = 'ASC_PRECREATE'
aspect_ratio = 'ASPECT_RATIO'
atleast_6_placements = 'ATLEAST_6_PLACEMENTS'
auction_overlap = 'AUCTION_OVERLAP'
Expand All @@ -84,14 +96,20 @@ class RecommendationType:
automatic_placements = 'AUTOMATIC_PLACEMENTS'
automatic_placements_v2 = 'AUTOMATIC_PLACEMENTS_V2'
auto_bid = 'AUTO_BID'
background_generation = 'BACKGROUND_GENERATION'
blended_ads = 'BLENDED_ADS'
blended_ads_duplication = 'BLENDED_ADS_DUPLICATION'
broad_targeting = 'BROAD_TARGETING'
budget_limited = 'BUDGET_LIMITED'
capi = 'CAPI'
capi_crm_guidance = 'CAPI_CRM_GUIDANCE'
capi_performance_match_key = 'CAPI_PERFORMANCE_MATCH_KEY'
capi_performance_match_key_v2 = 'CAPI_PERFORMANCE_MATCH_KEY_V2'
cash_rewards_opt_in = 'CASH_REWARDS_OPT_IN'
catalog_match_rate = 'CATALOG_MATCH_RATE'
commerce_shops_ads_duplication = 'COMMERCE_SHOPS_ADS_DUPLICATION'
connected_sources = 'CONNECTED_SOURCES'
connected_sources_duplication = 'CONNECTED_SOURCES_DUPLICATION'
connect_facebook_page_to_instagram = 'CONNECT_FACEBOOK_PAGE_TO_INSTAGRAM'
connect_facebook_page_to_whatsapp = 'CONNECT_FACEBOOK_PAGE_TO_WHATSAPP'
conversion_lead_ads = 'CONVERSION_LEAD_ADS'
Expand All @@ -106,68 +124,102 @@ class RecommendationType:
creative_badge = 'CREATIVE_BADGE'
creative_diversity = 'CREATIVE_DIVERSITY'
creative_fatigue = 'CREATIVE_FATIGUE'
creative_fatigue_duplication = 'CREATIVE_FATIGUE_DUPLICATION'
creative_fatigue_hourly = 'CREATIVE_FATIGUE_HOURLY'
creative_limited = 'CREATIVE_LIMITED'
creative_limited_duplication = 'CREATIVE_LIMITED_DUPLICATION'
creative_limited_hourly = 'CREATIVE_LIMITED_HOURLY'
creator_ads_pa_conversion = 'CREATOR_ADS_PA_CONVERSION'
cta = 'CTA'
ctx_budget_optimization = 'CTX_BUDGET_OPTIMIZATION'
ctx_creation_package = 'CTX_CREATION_PACKAGE'
ctx_cta_upgrade_in_duplication = 'CTX_CTA_UPGRADE_IN_DUPLICATION'
ctx_guidance = 'CTX_GUIDANCE'
ctx_precreate = 'CTX_PRECREATE'
da_advantage_plus_creative_info_labels = 'DA_ADVANTAGE_PLUS_CREATIVE_INFO_LABELS'
da_duplication_product_tags = 'DA_DUPLICATION_PRODUCT_TAGS'
dead_link = 'DEAD_LINK'
defragmentation_acb = 'DEFRAGMENTATION_ACB'
defragmentation_acb_duplication = 'DEFRAGMENTATION_ACB_DUPLICATION'
delivery_error = 'DELIVERY_ERROR'
delivery_warning = 'DELIVERY_WARNING'
dynamic_advantage_campaign_budget = 'DYNAMIC_ADVANTAGE_CAMPAIGN_BUDGET'
ecosystem_bid_reduce_l1_cardinality = 'ECOSYSTEM_BID_REDUCE_L1_CARDINALITY'
evc_app_duplication_upgrade = 'EVC_APP_DUPLICATION_UPGRADE'
evc_web_duplication_upgrade = 'EVC_WEB_DUPLICATION_UPGRADE'
fragmentation = 'FRAGMENTATION'
fragmentation_resolution_update = 'FRAGMENTATION_RESOLUTION_UPDATE'
fragmentation_v2 = 'FRAGMENTATION_V2'
generative_uncrop_duplication = 'GENERATIVE_UNCROP_DUPLICATION'
ges_test = 'GES_TEST'
guidance_center_code_gen = 'GUIDANCE_CENTER_CODE_GEN'
heuristic_default_duration = 'HEURISTIC_DEFAULT_DURATION'
high_cost = 'HIGH_COST'
historical_benchmark = 'HISTORICAL_BENCHMARK'
ig_multi_ads = 'IG_MULTI_ADS'
landing_page_view_optimization_goal = 'LANDING_PAGE_VIEW_OPTIMIZATION_GOAL'
landing_page_view_precreate = 'LANDING_PAGE_VIEW_PRECREATE'
lead_ads_guidance = 'LEAD_ADS_GUIDANCE'
learning_limited = 'LEARNING_LIMITED'
learning_pause_friction = 'LEARNING_PAUSE_FRICTION'
learning_phase_budget_edits = 'LEARNING_PHASE_BUDGET_EDITS'
low_outcome = 'LOW_OUTCOME'
merlin_guidance = 'MERLIN_GUIDANCE'
messaging_events_precreate = 'MESSAGING_EVENTS_PRECREATE'
messaging_partners_precreate = 'MESSAGING_PARTNERS_PRECREATE'
meta_verified_ads_performance_guidance = 'META_VERIFIED_ADS_PERFORMANCE_GUIDANCE'
mixed_formats = 'MIXED_FORMATS'
mixed_pa_combine_adsets = 'MIXED_PA_COMBINE_ADSETS'
mmt_carousel_to_video = 'MMT_CAROUSEL_TO_VIDEO'
mobile_first_creative = 'MOBILE_FIRST_CREATIVE'
mobile_first_video = 'MOBILE_FIRST_VIDEO'
mr_aemv2sub_kconsolidation = 'MR_AEMV2SUB_KCONSOLIDATION'
multi_text = 'MULTI_TEXT'
music = 'MUSIC'
not_applicable = 'NOT_APPLICABLE'
no_delivery_status = 'NO_DELIVERY_STATUS'
offsite_conversion = 'OFFSITE_CONVERSION'
optimal_bau = 'OPTIMAL_BAU'
payment_method = 'PAYMENT_METHOD'
performant_creative_reels_opt_in = 'PERFORMANT_CREATIVE_REELS_OPT_IN'
pfr_l1_inline_mmt = 'PFR_L1_INLINE_MMT'
pixel_optimization_aam_precreate = 'PIXEL_OPTIMIZATION_AAM_PRECREATE'
pixel_optimization_hie_precreate = 'PIXEL_OPTIMIZATION_HIE_PRECREATE'
pixel_setup_precreate = 'PIXEL_SETUP_PRECREATE'
pixel_upsell = 'PIXEL_UPSELL'
placements_liquidity_automatic_guidance = 'PLACEMENTS_LIQUIDITY_AUTOMATIC_GUIDANCE'
predictive_creative_limited = 'PREDICTIVE_CREATIVE_LIMITED'
predictive_creative_limited_hourly = 'PREDICTIVE_CREATIVE_LIMITED_HOURLY'
preparing_status = 'PREPARING_STATUS'
purchase_optimization = 'PURCHASE_OPTIMIZATION'
rapid_learning_limited = 'RAPID_LEARNING_LIMITED'
rapid_learning_phase = 'RAPID_LEARNING_PHASE'
reach_optimization_goal = 'REACH_OPTIMIZATION_GOAL'
reach_optimization_goal_precreate = 'REACH_OPTIMIZATION_GOAL_PRECREATE'
reels_duplication_upsell = 'REELS_DUPLICATION_UPSELL'
reels_music_duplication = 'REELS_MUSIC_DUPLICATION'
reels_pc_and_mobile_first_creative = 'REELS_PC_AND_MOBILE_FIRST_CREATIVE'
reels_performant_creative = 'REELS_PERFORMANT_CREATIVE'
reels_placement = 'REELS_PLACEMENT'
revert = 'REVERT'
sabr_default_duration = 'SABR_DEFAULT_DURATION'
sales_conversion = 'SALES_CONVERSION'
scale_good_campaign = 'SCALE_GOOD_CAMPAIGN'
scale_good_campaign_duplication = 'SCALE_GOOD_CAMPAIGN_DUPLICATION'
scale_good_ctx_campaign = 'SCALE_GOOD_CTX_CAMPAIGN'
semantic_based_audience_duplication = 'SEMANTIC_BASED_AUDIENCE_DUPLICATION'
semantic_based_audience_expansion = 'SEMANTIC_BASED_AUDIENCE_EXPANSION'
setup_pixel = 'SETUP_PIXEL'
shops_ads = 'SHOPS_ADS'
shops_ads_duplication = 'SHOPS_ADS_DUPLICATION'
shop_ads_v2 = 'SHOP_ADS_V2'
signals_growth_capi = 'SIGNALS_GROWTH_CAPI'
signals_growth_capi_precreate = 'SIGNALS_GROWTH_CAPI_PRECREATE'
signals_growth_capi_table = 'SIGNALS_GROWTH_CAPI_TABLE'
signals_growth_capi_v2 = 'SIGNALS_GROWTH_CAPI_V2'
similar_advertiser_budget_recommendation = 'SIMILAR_ADVERTISER_BUDGET_RECOMMENDATION'
six_plus_manual_placements = 'SIX_PLUS_MANUAL_PLACEMENTS'
six_plus_placements_duplication = 'SIX_PLUS_PLACEMENTS_DUPLICATION'
spend_limit = 'SPEND_LIMIT'
syd_test_mode = 'SYD_TEST_MODE'
tailored_lead_ad_campaign = 'TAILORED_LEAD_AD_CAMPAIGN'
Expand All @@ -181,8 +233,13 @@ class RecommendationType:
two_p_guidance_card_ctm_preflight = 'TWO_P_GUIDANCE_CARD_CTM_PREFLIGHT'
uncrop_image = 'UNCROP_IMAGE'
uneconomical_ads_throttling = 'UNECONOMICAL_ADS_THROTTLING'
unified_inbox = 'UNIFIED_INBOX'
unused_budget = 'UNUSED_BUDGET'
video_length = 'VIDEO_LENGTH'
video_views_upsell = 'VIDEO_VIEWS_UPSELL'
video_views_upsell_precreate = 'VIDEO_VIEWS_UPSELL_PRECREATE'
wa_messaging_partners_precreate = 'WA_MESSAGING_PARTNERS_PRECREATE'
web_engaged_view_conversions = 'WEB_ENGAGED_VIEW_CONVERSIONS'
zero_conversion = 'ZERO_CONVERSION'
zero_impression = 'ZERO_IMPRESSION'

Expand Down
23 changes: 19 additions & 4 deletions facebook_business/adobjects/adaccountrecommendations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# LICENSE file in the root directory of this source tree.

from facebook_business.adobjects.abstractobject import AbstractObject
from facebook_business.adobjects.abstractcrudobject import AbstractCrudObject
from facebook_business.adobjects.objectparser import ObjectParser
from facebook_business.api import FacebookRequest
from facebook_business.typechecker import TypeChecker

"""
This class is auto-generated.
Expand All @@ -15,19 +19,30 @@
"""

class AdAccountRecommendations(
AbstractObject,
AbstractCrudObject,
):

def __init__(self, api=None):
super(AdAccountRecommendations, self).__init__()
def __init__(self, fbid=None, parent_id=None, api=None):
self._isAdAccountRecommendations = True
self._api = api
super(AdAccountRecommendations, self).__init__(fbid, parent_id, api)

class Field(AbstractObject.Field):
recommendations = 'recommendations'
recommendation_signature = 'recommendation_signature'

# @deprecated get_endpoint function is deprecated
@classmethod
def get_endpoint(cls):
return 'recommendations'

# @deprecated api_create is being deprecated
def api_create(self, parent_id, fields=None, params=None, batch=None, success=None, failure=None, pending=False):
from facebook_business.adobjects.adaccount import AdAccount
return AdAccount(api=self._api, fbid=parent_id).create_recommendation(fields, params, batch, success, failure, pending)

_field_types = {
'recommendations': 'list<Object>',
'recommendation_signature': 'string',
}
@classmethod
def _get_field_enum_info(cls):
Expand Down
Loading

0 comments on commit da0789f

Please sign in to comment.