Skip to content

Commit

Permalink
Auto-generated python SDK code update
Browse files Browse the repository at this point in the history
Summary: ignore-conflict-markers

Reviewed By: stcheng

Differential Revision: D53019897

fbshipit-source-id: cf65786e6b7e8768c59fb4c351e6ed072794ba70
  • Loading branch information
generatedunixname89002005295453 authored and facebook-github-bot committed Jan 23, 2024
1 parent 1e423d2 commit 10c9eb6
Show file tree
Hide file tree
Showing 41 changed files with 490 additions and 383 deletions.
2 changes: 1 addition & 1 deletion facebook_business/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from facebook_business.session import FacebookSession
from facebook_business.api import FacebookAdsApi

__version__ = '18.0.5'
__version__ = '19.0.0'
__all__ = [
'session',
'objects',
Expand Down
41 changes: 41 additions & 0 deletions facebook_business/adobjects/adaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ class Currency:
vnd = 'VND'
zar = 'ZAR'

class PermittedTasks:
aa_analyze = 'AA_ANALYZE'
advertise = 'ADVERTISE'
analyze = 'ANALYZE'
draft = 'DRAFT'
manage = 'MANAGE'

class Tasks:
aa_analyze = 'AA_ANALYZE'
advertise = 'ADVERTISE'
Expand Down Expand Up @@ -1852,6 +1859,39 @@ def get_agencies(self, fields=None, params=None, batch=None, success=None, failu
self.assure_call()
return request.execute()

def create_agency(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 = {
'business': 'string',
'permitted_tasks': 'list<permitted_tasks_enum>',
}
enums = {
'permitted_tasks_enum': AdAccount.PermittedTasks.__dict__.values(),
}
request = FacebookRequest(
node_id=self['id'],
method='POST',
endpoint='/agencies',
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_applications(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 @@ -4139,6 +4179,7 @@ def get_value_adjustment_rules(self, fields=None, params=None, batch=None, succe
def _get_field_enum_info(cls):
field_enum_info = {}
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['ClaimObjective'] = AdAccount.ClaimObjective.__dict__.values()
field_enum_info['ContentType'] = AdAccount.ContentType.__dict__.values()
Expand Down
2 changes: 2 additions & 0 deletions facebook_business/adobjects/adaccountadruleshistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class Action:
changed_budget = 'CHANGED_BUDGET'
email = 'EMAIL'
enable_advantage_plus_creative = 'ENABLE_ADVANTAGE_PLUS_CREATIVE'
enable_advantage_plus_placements = 'ENABLE_ADVANTAGE_PLUS_PLACEMENTS'
enable_autoflow = 'ENABLE_AUTOFLOW'
enable_semantic_based_audience_expansion = 'ENABLE_SEMANTIC_BASED_AUDIENCE_EXPANSION'
endpoint_pinged = 'ENDPOINT_PINGED'
error = 'ERROR'
facebook_notification_sent = 'FACEBOOK_NOTIFICATION_SENT'
Expand Down
7 changes: 7 additions & 0 deletions facebook_business/adobjects/adaccountadvolume.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,17 @@ class RecommendationType:
aco_toggle = 'ACO_TOGGLE'
ads_reporting = 'ADS_REPORTING'
advanced_campaign_budget = 'ADVANCED_CAMPAIGN_BUDGET'
advantage_app_campaign = 'ADVANTAGE_APP_CAMPAIGN'
advantage_custom_audience = 'ADVANTAGE_CUSTOM_AUDIENCE'
advantage_custom_audience_upsell = 'ADVANTAGE_CUSTOM_AUDIENCE_UPSELL'
advantage_detailed_targeting = 'ADVANTAGE_DETAILED_TARGETING'
advantage_lookalike_audience = 'ADVANTAGE_LOOKALIKE_AUDIENCE'
advantage_plus_audience = 'ADVANTAGE_PLUS_AUDIENCE'
advantage_plus_audience_friction = 'ADVANTAGE_PLUS_AUDIENCE_FRICTION'
advantage_plus_audience_toggle = 'ADVANTAGE_PLUS_AUDIENCE_TOGGLE'
advantage_plus_creative = 'ADVANTAGE_PLUS_CREATIVE'
advantage_plus_creative_catalog = 'ADVANTAGE_PLUS_CREATIVE_CATALOG'
advantage_plus_placements_friction = 'ADVANTAGE_PLUS_PLACEMENTS_FRICTION'
advantage_shopping_campaign = 'ADVANTAGE_SHOPPING_CAMPAIGN'
advantage_shopping_campaign_fragmentation = 'ADVANTAGE_SHOPPING_CAMPAIGN_FRAGMENTATION'
ad_objective = 'AD_OBJECTIVE'
Expand Down Expand Up @@ -99,6 +104,7 @@ class RecommendationType:
guidance_center_code_gen = 'GUIDANCE_CENTER_CODE_GEN'
high_cost = 'HIGH_COST'
historical_benchmark = 'HISTORICAL_BENCHMARK'
ig_multi_ads = 'IG_MULTI_ADS'
learning_limited = 'LEARNING_LIMITED'
learning_pause_friction = 'LEARNING_PAUSE_FRICTION'
learning_phase_budget_edits = 'LEARNING_PHASE_BUDGET_EDITS'
Expand Down Expand Up @@ -130,6 +136,7 @@ class RecommendationType:
six_plus_manual_placements = 'SIX_PLUS_MANUAL_PLACEMENTS'
spend_limit = 'SPEND_LIMIT'
syd_test_mode = 'SYD_TEST_MODE'
tailored_lead_ad_campaign = 'TAILORED_LEAD_AD_CAMPAIGN'
top_adsets_with_ads_under_cap = 'TOP_ADSETS_WITH_ADS_UNDER_CAP'
top_campaigns_with_ads_under_cap = 'TOP_CAMPAIGNS_WITH_ADS_UNDER_CAP'
two_p_guidance_card_aaa = 'TWO_P_GUIDANCE_CARD_AAA'
Expand Down
4 changes: 4 additions & 0 deletions facebook_business/adobjects/adaccountbusinessconstraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def __init__(self, fbid=None, parent_id=None, api=None):

class Field(AbstractObject.Field):
audience_controls = 'audience_controls'
campaigns_with_error = 'campaigns_with_error'
placement_controls = 'placement_controls'
status = 'status'

# @deprecated get_endpoint function is deprecated
@classmethod
Expand All @@ -42,7 +44,9 @@ def api_create(self, parent_id, fields=None, params=None, batch=None, success=No

_field_types = {
'audience_controls': 'Object',
'campaigns_with_error': 'list<string>',
'placement_controls': 'Object',
'status': 'string',
}
@classmethod
def _get_field_enum_info(cls):
Expand Down
1 change: 1 addition & 0 deletions facebook_business/adobjects/adcreative.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class ApplinkTreatment:
class AuthorizationCategory:
none = 'NONE'
political = 'POLITICAL'
political_with_digitally_created_media = 'POLITICAL_WITH_DIGITALLY_CREATED_MEDIA'

class CategorizationCriteria:
brand = 'brand'
Expand Down
2 changes: 2 additions & 0 deletions facebook_business/adobjects/adcreativebrandedcontentads.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Field(AbstractObject.Field):
instagram_boost_post_access_token = 'instagram_boost_post_access_token'
is_mca_internal = 'is_mca_internal'
partners = 'partners'
promoted_page_id = 'promoted_page_id'
ui_version = 'ui_version'

_field_types = {
Expand All @@ -37,6 +38,7 @@ class Field(AbstractObject.Field):
'instagram_boost_post_access_token': 'string',
'is_mca_internal': 'bool',
'partners': 'list<AdCreativeBrandedContentAdsPartners>',
'promoted_page_id': 'string',
'ui_version': 'int',
}
@classmethod
Expand Down
4 changes: 4 additions & 0 deletions facebook_business/adobjects/adpromotedobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ class Field(AbstractObject.Field):
place_page_set_id = 'place_page_set_id'
product_catalog_id = 'product_catalog_id'
product_item_id = 'product_item_id'
product_set = 'product_set'
product_set_id = 'product_set_id'
retention_days = 'retention_days'
whatsapp_phone_number = 'whatsapp_phone_number'

class CustomEventType:
achievement_unlocked = 'ACHIEVEMENT_UNLOCKED'
Expand Down Expand Up @@ -101,8 +103,10 @@ class CustomEventType:
'place_page_set_id': 'string',
'product_catalog_id': 'string',
'product_item_id': 'string',
'product_set': 'ProductSet',
'product_set_id': 'string',
'retention_days': 'string',
'whatsapp_phone_number': 'string',
}
@classmethod
def _get_field_enum_info(cls):
Expand Down
1 change: 1 addition & 0 deletions facebook_business/adobjects/adruleexecutionspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class ExecutionType:
change_bid = 'CHANGE_BID'
change_budget = 'CHANGE_BUDGET'
change_campaign_budget = 'CHANGE_CAMPAIGN_BUDGET'
dco = 'DCO'
increase_radius = 'INCREASE_RADIUS'
notification = 'NOTIFICATION'
pause = 'PAUSE'
Expand Down
2 changes: 2 additions & 0 deletions facebook_business/adobjects/adrulehistory.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class Action:
changed_budget = 'CHANGED_BUDGET'
email = 'EMAIL'
enable_advantage_plus_creative = 'ENABLE_ADVANTAGE_PLUS_CREATIVE'
enable_advantage_plus_placements = 'ENABLE_ADVANTAGE_PLUS_PLACEMENTS'
enable_autoflow = 'ENABLE_AUTOFLOW'
enable_semantic_based_audience_expansion = 'ENABLE_SEMANTIC_BASED_AUDIENCE_EXPANSION'
endpoint_pinged = 'ENDPOINT_PINGED'
error = 'ERROR'
facebook_notification_sent = 'FACEBOOK_NOTIFICATION_SENT'
Expand Down
8 changes: 8 additions & 0 deletions facebook_business/adobjects/adsactionstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ class Field(AbstractObject.Field):
interactive_component_sticker_id = 'interactive_component_sticker_id'
interactive_component_sticker_response = 'interactive_component_sticker_response'
skan_click = 'skan_click'
skan_click_second_postback = 'skan_click_second_postback'
skan_click_third_postback = 'skan_click_third_postback'
skan_view = 'skan_view'
skan_view_second_postback = 'skan_view_second_postback'
skan_view_third_postback = 'skan_view_third_postback'
value = 'value'

_field_types = {
Expand Down Expand Up @@ -88,7 +92,11 @@ class Field(AbstractObject.Field):
'interactive_component_sticker_id': 'string',
'interactive_component_sticker_response': 'string',
'skan_click': 'string',
'skan_click_second_postback': 'string',
'skan_click_third_postback': 'string',
'skan_view': 'string',
'skan_view_second_postback': 'string',
'skan_view_third_postback': 'string',
'value': 'string',
}
@classmethod
Expand Down
8 changes: 8 additions & 0 deletions facebook_business/adobjects/adshistogramstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ class Field(AbstractObject.Field):
interactive_component_sticker_id = 'interactive_component_sticker_id'
interactive_component_sticker_response = 'interactive_component_sticker_response'
skan_click = 'skan_click'
skan_click_second_postback = 'skan_click_second_postback'
skan_click_third_postback = 'skan_click_third_postback'
skan_view = 'skan_view'
skan_view_second_postback = 'skan_view_second_postback'
skan_view_third_postback = 'skan_view_third_postback'
value = 'value'

_field_types = {
Expand Down Expand Up @@ -88,7 +92,11 @@ class Field(AbstractObject.Field):
'interactive_component_sticker_id': 'string',
'interactive_component_sticker_response': 'string',
'skan_click': 'list<int>',
'skan_click_second_postback': 'list<int>',
'skan_click_third_postback': 'list<int>',
'skan_view': 'list<int>',
'skan_view_second_postback': 'list<int>',
'skan_view_third_postback': 'list<int>',
'value': 'list<int>',
}
@classmethod
Expand Down
1 change: 1 addition & 0 deletions facebook_business/adobjects/adsinsights.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class Breakdowns:
image_asset = 'image_asset'
impression_device = 'impression_device'
is_conversion_id_modeled = 'is_conversion_id_modeled'
landing_destination = 'landing_destination'
link_url_asset = 'link_url_asset'
marketing_messages_btn_name = 'marketing_messages_btn_name'
mdsa_landing_destination = 'mdsa_landing_destination'
Expand Down
1 change: 1 addition & 0 deletions facebook_business/adobjects/adspixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ def create_event(self, fields=None, params=None, batch=None, success=None, failu
'namespace_id': 'string',
'partner_agent': 'string',
'platforms': 'list<map>',
'progress': 'Object',
'test_event_code': 'string',
'trace': 'unsigned int',
'upload_id': 'string',
Expand Down
3 changes: 2 additions & 1 deletion facebook_business/adobjects/advideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class ContainerType:
contained_post_audio_broadcast = 'CONTAINED_POST_AUDIO_BROADCAST'
contained_post_copyright_reference_broadcast = 'CONTAINED_POST_COPYRIGHT_REFERENCE_BROADCAST'
copyright_reference_broadcast = 'COPYRIGHT_REFERENCE_BROADCAST'
copyright_reference_ig_xpost_video = 'COPYRIGHT_REFERENCE_IG_XPOST_VIDEO'
copyright_reference_video = 'COPYRIGHT_REFERENCE_VIDEO'
creation_ml_precreation = 'CREATION_ML_PRECREATION'
dco_ad_asset_feed = 'DCO_AD_ASSET_FEED'
Expand Down Expand Up @@ -1206,7 +1207,7 @@ def get_video_insights(self, fields=None, params=None, batch=None, success=None,
'scheduled_publish_time': 'datetime',
'source': 'string',
'spherical': 'bool',
'status': 'Object',
'status': 'VideoStatus',
'title': 'string',
'universal_video_id': 'string',
'updated_time': 'datetime',
Expand Down
1 change: 1 addition & 0 deletions facebook_business/adobjects/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,7 @@ def create_mmp_auditing(self, fields=None, params=None, batch=None, success=None
'click_attr_window': 'unsigned int',
'custom_events': 'list<Object>',
'decline_reason': 'string',
'engagement_type': 'string',
'event': 'string',
'event_reported_time': 'unsigned int',
'fb_ad_id': 'unsigned int',
Expand Down
4 changes: 2 additions & 2 deletions facebook_business/adobjects/business.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class Vertical:
luxury = 'LUXURY'
marketing = 'MARKETING'
non_profit = 'NON_PROFIT'
not_set = 'NOT_SET'
organizations_and_associations = 'ORGANIZATIONS_AND_ASSOCIATIONS'
other = 'OTHER'
professional_services = 'PROFESSIONAL_SERVICES'
Expand Down Expand Up @@ -2423,6 +2424,7 @@ def create_managed_partner_business(self, fields=None, params=None, batch=None,
'LUXURY',
'MARKETING',
'NON_PROFIT',
'NOT_SET',
'ORGANIZATIONS_AND_ASSOCIATIONS',
'OTHER',
'PROFESSIONAL_SERVICES',
Expand Down Expand Up @@ -3433,14 +3435,12 @@ def get_picture(self, fields=None, params=None, batch=None, success=None, failur
api_utils.warning('`success` and `failure` callback only work for batch call.')
from facebook_business.adobjects.profilepicturesource import ProfilePictureSource
param_types = {
'breaking_change': 'breaking_change_enum',
'height': 'int',
'redirect': 'bool',
'type': 'type_enum',
'width': 'int',
}
enums = {
'breaking_change_enum': ProfilePictureSource.BreakingChange.__dict__.values(),
'type_enum': ProfilePictureSource.Type.__dict__.values(),
}
request = FacebookRequest(
Expand Down
31 changes: 31 additions & 0 deletions facebook_business/adobjects/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,37 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure
self.assure_call()
return request.execute()

def get_preview(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.canvaspreview import CanvasPreview
param_types = {
}
enums = {
}
request = FacebookRequest(
node_id=self['id'],
method='GET',
endpoint='/preview',
api=self._api,
param_checker=TypeChecker(param_types, enums),
target_class=CanvasPreview,
api_type='EDGE',
response_parser=ObjectParser(target_class=CanvasPreview, 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_previews(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
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,20 @@
pull request for this class.
"""

class InstantArticlesStats(
class CanvasPreview(
AbstractObject,
):

def __init__(self, api=None):
super(InstantArticlesStats, self).__init__()
self._isInstantArticlesStats = True
super(CanvasPreview, self).__init__()
self._isCanvasPreview = True
self._api = api

class Field(AbstractObject.Field):
error = 'error'
metadata = 'metadata'
metric = 'metric'
totals = 'totals'
x_axis_breakdown = 'x_axis_breakdown'
body = 'body'

_field_types = {
'error': 'string',
'metadata': 'list<map<string, Object>>',
'metric': 'Object',
'totals': 'list<map<string, Object>>',
'x_axis_breakdown': 'list<list<map<string, Object>>>',
'body': 'string',
}
@classmethod
def _get_field_enum_info(cls):
Expand Down
Loading

0 comments on commit 10c9eb6

Please sign in to comment.