diff --git a/CHANGELOG.md b/CHANGELOG.md index 20fa60a0f..61514dbe8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file. ## Unreleased +## v17.0.0 + + ### Added - `advanced_measurement_table` field to Event for Conversion API @@ -124,3 +127,4 @@ All notable changes to this project will be documented in this file. ### Deprecated - `parent_id` in `AbstractCrudObject`. - Function `remote_create`, `remote_read`, `remote_update` and `remote_delete` for `AbstractCrudObject`. Check out our [recommended way](https://github.com/facebook/facebook-python-business-sdk#exploring-the-graph) to make API call with python SDK. + diff --git a/examples/AdAccountAdCreativesPost2CreateAdCreativeLinkAd.py b/examples/AdAccountAdCreativesPost2CreateAdCreativeLinkAd.py deleted file mode 100644 index 37126bab9..000000000 --- a/examples/AdAccountAdCreativesPost2CreateAdCreativeLinkAd.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Sample Creative', - 'object_story_spec': {'page_id':'','link_data':{'image_hash':'','link':'https:\/\/facebook.com\/','message':'try it out'}}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost2CreateLinkAdCallToActionAppInstall.py b/examples/AdAccountAdCreativesPost2CreateLinkAdCallToActionAppInstall.py deleted file mode 100644 index 39bfde2c4..000000000 --- a/examples/AdAccountAdCreativesPost2CreateLinkAdCallToActionAppInstall.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Sample Creative', - 'object_story_spec': {'page_id':'','link_data':{'call_to_action':{'type':'INSTALL_MOBILE_APP','value':{'link':''}},'image_hash':'','link':'','message':'Try it out'}}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost2CreateLinkAdImageCrop.py b/examples/AdAccountAdCreativesPost2CreateLinkAdImageCrop.py deleted file mode 100644 index ab0891385..000000000 --- a/examples/AdAccountAdCreativesPost2CreateLinkAdImageCrop.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Image crop creative', - 'object_story_spec': {'page_id':'','link_data':{'image_crops':{'100x100':[[0,0],[100,100]]},'image_hash':'','link':'','message':'Ad message'}}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost2CreateMAIDPA.py b/examples/AdAccountAdCreativesPost2CreateMAIDPA.py deleted file mode 100644 index 3acf3b745..000000000 --- a/examples/AdAccountAdCreativesPost2CreateMAIDPA.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Dynamic Ad Template Creative Sample', - 'object_story_spec': {'page_id':'','template_data':{'call_to_action':{'type':'INSTALL_MOBILE_APP','value':{'link':'http://www.example.com/appstoreurl'}},'message':'Test {{product.name | titleize}}','link':'http://www.example.com/appstoreurl','name':'Headline {{product.price}}','description':'Description {{product.description}}'}}, - 'product_set_id': '', -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost2CreateVideoLeadAd.py b/examples/AdAccountAdCreativesPost2CreateVideoLeadAd.py deleted file mode 100644 index 957de6cde..000000000 --- a/examples/AdAccountAdCreativesPost2CreateVideoLeadAd.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'object_story_spec': {'page_id':'','video_data':{'link_description':'try it out','image_url':'','video_id':'','call_to_action':{'type':'SIGN_UP','value':{'link':'http:\/\/fb.me\/','lead_gen_form_id':''}}}}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost2CreateVideoPageLikeAd.py b/examples/AdAccountAdCreativesPost2CreateVideoPageLikeAd.py deleted file mode 100644 index 0ac029039..000000000 --- a/examples/AdAccountAdCreativesPost2CreateVideoPageLikeAd.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Sample Creative', - 'object_story_spec': {'page_id':'','video_data':{'image_url':'','video_id':'','call_to_action':{'type':'LIKE_PAGE','value':{'page':''}}}}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost3CreateAdCreativePageLike.py b/examples/AdAccountAdCreativesPost3CreateAdCreativePageLike.py deleted file mode 100644 index 496312c6e..000000000 --- a/examples/AdAccountAdCreativesPost3CreateAdCreativePageLike.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Creative', - 'object_story_spec': {'page_id':'','link_data':{'image_hash':'','link':'https:\/\/facebook.com\/','message':'Creative message','call_to_action':{'type':'LIKE_PAGE','value':{'page':''}}}}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost3CreateAssetFeedSpec.py b/examples/AdAccountAdCreativesPost3CreateAssetFeedSpec.py deleted file mode 100644 index 7bfb29d8d..000000000 --- a/examples/AdAccountAdCreativesPost3CreateAssetFeedSpec.py +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Dynamic Ad Creative with Asset Feed Spec Sample', - 'object_story_spec': {'page_id':''}, - 'asset_feed_spec': {'images':[{'hash':''}],'bodies':[{'text':'Begin Your Adventure'},{'text':'Once a Trainer, always a Trainer.'}],'titles':[{'text':'Level Up'},{'text':'Swipe to evolve'}],'descriptions':[{'text':'First Dynamic Ad Creative Sample'}],'ad_formats':['SINGLE_IMAGE'],'call_to_action_types':['SHOP_NOW'],'link_urls':[{'website_url':'https://www.example.com/'}],'videos':[]}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost3CreateCarouselCallToActionAppInstall.py b/examples/AdAccountAdCreativesPost3CreateCarouselCallToActionAppInstall.py deleted file mode 100644 index f795d235c..000000000 --- a/examples/AdAccountAdCreativesPost3CreateCarouselCallToActionAppInstall.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Carousel app ad', - 'object_story_spec': {'page_id':'','link_data':{'message':'My message','link':'http://www.example.com/appstoreurl','caption':'WWW.ITUNES.COM','name':'The link name','description':'The link description','child_attachments':[{'link':'http://www.example.com/appstoreurl','image_hash':'','call_to_action':{'type':'USE_MOBILE_APP','value':{'app_link':''}}},{'link':'http://www.example.com/appstoreurl','image_hash':'','call_to_action':{'type':'USE_MOBILE_APP','value':{'app_link':''}}},{'link':'http://www.example.com/appstoreurl','image_hash':'','call_to_action':{'type':'USE_MOBILE_APP','value':{'app_link':''}}},{'link':'http://www.example.com/appstoreurl','image_hash':'','call_to_action':{'type':'USE_MOBILE_APP','value':{'app_link':''}}}],'multi_share_optimized':true}}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdCreativesPost3CreateDynamicAdCustomization.py b/examples/AdAccountAdCreativesPost3CreateDynamicAdCustomization.py deleted file mode 100644 index ea5aa33c7..000000000 --- a/examples/AdAccountAdCreativesPost3CreateDynamicAdCustomization.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Dynamic Ad Template Creative Sample', - 'object_story_spec': {'page_id':'','template_data':{'message':'English Test {{product.name | titleize}}','link':'http://www.example.com/englishurl','name':'English Headline {{product.price}}','description':'English Description {{product.description}}','customization_rules_spec':[{'customization_spec':{'language':'en_XX'}},{'customization_spec':{'language':'fr_XX'},'message':'French Test {{product.name | titleize}}','link':'http://www.example.com/frenchurl','name':'French Headline {{product.price}}','description':'French Description {{product.description}}','template_url_spec':{'web':{'url':'http://www.example.com/frenchdeeplink'}}}]}}, - 'product_set_id': '', - 'template_url_spec': {'web':{'url':'http://www.example.com/englishdeeplink'}}, -} -print AdAccount(id).create_ad_creative( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdSetsPostAdSetCreateCpa.py b/examples/AdAccountAdSetsPostAdSetCreateCpa.py index 0c5c53d82..aa996f0ca 100644 --- a/examples/AdAccountAdSetsPostAdSetCreateCpa.py +++ b/examples/AdAccountAdSetsPostAdSetCreateCpa.py @@ -35,8 +35,8 @@ 'name': 'A CPA Ad Set', 'campaign_id': '', 'daily_budget': '5000', - 'start_time': '2023-03-14T15:27:25-0700', - 'end_time': '2023-03-21T15:27:25-0700', + 'start_time': '2023-04-24T09:25:05-0700', + 'end_time': '2023-05-01T09:25:05-0700', 'billing_event': 'IMPRESSIONS', 'optimization_goal': 'REACH', 'bid_amount': '1000', diff --git a/examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.py b/examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.py index f15a21abc..965a93abb 100644 --- a/examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.py +++ b/examples/AdAccountAdSetsPostAdSetCreateCpaAppEvents.py @@ -35,8 +35,8 @@ 'name': 'A CPA Ad Set optimized for App Events', 'campaign_id': '', 'daily_budget': '300', - 'start_time': '2023-03-14T15:28:12-0700', - 'end_time': '2023-03-21T15:28:12-0700', + 'start_time': '2023-04-24T09:25:55-0700', + 'end_time': '2023-05-01T09:25:55-0700', 'billing_event': 'IMPRESSIONS', 'optimization_goal': 'OFFSITE_CONVERSIONS', 'bid_amount': '100', diff --git a/examples/AdAccountAdSetsPostCreateAdSet.py b/examples/AdAccountAdSetsPostCreateAdSet.py index e001af012..992efe229 100644 --- a/examples/AdAccountAdSetsPostCreateAdSet.py +++ b/examples/AdAccountAdSetsPostCreateAdSet.py @@ -34,8 +34,8 @@ params = { 'name': 'My First AdSet', 'lifetime_budget': '20000', - 'start_time': '2023-03-14T15:26:38-0700', - 'end_time': '2023-03-21T15:26:38-0700', + 'start_time': '2023-04-24T09:24:18-0700', + 'end_time': '2023-05-01T09:24:18-0700', 'campaign_id': '', 'bid_amount': '500', 'billing_event': 'IMPRESSIONS', diff --git a/examples/AdAccountAdSetsPostDailyBudget20.py b/examples/AdAccountAdSetsPostDailyBudget20.py index d458721b0..94b8bd53c 100644 --- a/examples/AdAccountAdSetsPostDailyBudget20.py +++ b/examples/AdAccountAdSetsPostDailyBudget20.py @@ -34,8 +34,8 @@ params = { 'name': 'My First Adset', 'daily_budget': '2000', - 'start_time': '2023-03-07T15:27:44-0800', - 'end_time': '2023-03-14T15:27:44-0700', + 'start_time': '2023-04-17T09:25:24-0700', + 'end_time': '2023-04-24T09:25:24-0700', 'campaign_id': '', 'bid_amount': '100', 'billing_event': 'LINK_CLICKS', diff --git a/examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.py b/examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.py index 41355f4d5..aed28b9d7 100644 --- a/examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.py +++ b/examples/AdAccountAdSetsPostLifetimeBudget200Duration10Days.py @@ -34,8 +34,8 @@ params = { 'name': 'My First Adset', 'lifetime_budget': '20000', - 'start_time': '2023-03-07T15:27:53-0800', - 'end_time': '2023-03-17T15:27:53-0700', + 'start_time': '2023-04-17T09:25:36-0700', + 'end_time': '2023-04-27T09:25:36-0700', 'campaign_id': '', 'bid_amount': '100', 'billing_event': 'LINK_CLICKS', diff --git a/examples/AdAccountAdSetsPostOfferClaim.py b/examples/AdAccountAdSetsPostOfferClaim.py deleted file mode 100644 index 83be003a6..000000000 --- a/examples/AdAccountAdSetsPostOfferClaim.py +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.adset import AdSet -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'My Offer Claim AdSet', - 'lifetime_budget': '56000', - 'start_time': '2022-05-23T13:26:58-0700', - 'end_time': '2022-05-30T13:26:58-0700', - 'campaign_id': '', - 'billing_event': 'LINK_CLICKS', - 'optimization_goal': 'LINK_CLICKS', - 'bid_amount': '1000', - 'promoted_object': {'page_id':'','offer_id':''}, - 'targeting': {'geo_locations':{'countries':['US']},'genders':[1],'age_min':'25','age_max':'55','facebook_positions':['feed']}, -} -print AdAccount(id).create_ad_set( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountAdSetsPostOptimizePostEngagement.py b/examples/AdAccountAdSetsPostOptimizePostEngagement.py index 021bc5e7c..725a4ab52 100644 --- a/examples/AdAccountAdSetsPostOptimizePostEngagement.py +++ b/examples/AdAccountAdSetsPostOptimizePostEngagement.py @@ -34,8 +34,8 @@ params = { 'name': 'My First Adset', 'lifetime_budget': '20000', - 'start_time': '2023-03-07T15:28:03-0800', - 'end_time': '2023-03-17T15:28:03-0700', + 'start_time': '2023-04-17T09:25:45-0700', + 'end_time': '2023-04-27T09:25:45-0700', 'campaign_id': '', 'bid_amount': '500', 'billing_event': 'IMPRESSIONS', diff --git a/examples/AdAccountAdsPostOfferClaim.py b/examples/AdAccountAdsPostOfferClaim.py deleted file mode 100644 index f46581dbd..000000000 --- a/examples/AdAccountAdsPostOfferClaim.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.ad import Ad -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'My New Offers Ad', - 'adset_id': '', - 'creative': {'object_story_spec':{'page_id':'','link_data':{'offer_id':'','link':'https:\/\/www.facebook.com\/','message':'Great Deal','name':'30% off','image_hash':''}}}, - 'status': 'PAUSED', -} -print AdAccount(id).create_ad( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostConversions.py b/examples/AdAccountCampaignsPostConversions.py deleted file mode 100644 index d7e24bf4b..000000000 --- a/examples/AdAccountCampaignsPostConversions.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Conversions Campaign', - 'objective': 'CONVERSIONS', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostEventResponses.py b/examples/AdAccountCampaignsPostEventResponses.py deleted file mode 100644 index d74eb8e58..000000000 --- a/examples/AdAccountCampaignsPostEventResponses.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'My First Event Campaign', - 'objective': 'EVENT_RESPONSES', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostLeadGen.py b/examples/AdAccountCampaignsPostLeadGen.py deleted file mode 100644 index 2d8cc4b81..000000000 --- a/examples/AdAccountCampaignsPostLeadGen.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Lead generation campaign', - 'objective': 'LEAD_GENERATION', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostLinkClicks.py b/examples/AdAccountCampaignsPostLinkClicks.py index e6db6b8a2..15c1716ff 100644 --- a/examples/AdAccountCampaignsPostLinkClicks.py +++ b/examples/AdAccountCampaignsPostLinkClicks.py @@ -33,7 +33,7 @@ ] params = { 'name': 'My campaign', - 'objective': 'LINK_CLICKS', + 'objective': 'OUTCOME_TRAFFIC', 'status': 'PAUSED', 'special_ad_categories': [], } diff --git a/examples/AdAccountCampaignsPostLocalAwareness.py b/examples/AdAccountCampaignsPostLocalAwareness.py deleted file mode 100644 index 8a92a4d74..000000000 --- a/examples/AdAccountCampaignsPostLocalAwareness.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Local ad campaign', - 'objective': 'REACH', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostMAIA.py b/examples/AdAccountCampaignsPostMAIA.py deleted file mode 100644 index b39b341a6..000000000 --- a/examples/AdAccountCampaignsPostMAIA.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Mobile App Installs Campaign', - 'objective': 'APP_INSTALLS', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostMAIDPA.py b/examples/AdAccountCampaignsPostMAIDPA.py deleted file mode 100644 index b40e416cc..000000000 --- a/examples/AdAccountCampaignsPostMAIDPA.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'App Installs Campaign with Dynamic Product Ads', - 'objective': 'APP_INSTALLS', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostOfferClaims.py b/examples/AdAccountCampaignsPostOfferClaims.py deleted file mode 100644 index 7614a633c..000000000 --- a/examples/AdAccountCampaignsPostOfferClaims.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'My Offer Claims Campaign', - 'objective': 'OFFER_CLAIMS', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostPageLikes.py b/examples/AdAccountCampaignsPostPageLikes.py deleted file mode 100644 index 4e8b7103e..000000000 --- a/examples/AdAccountCampaignsPostPageLikes.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'My First Campaign', - 'objective': 'PAGE_LIKES', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostPostEngagement.py b/examples/AdAccountCampaignsPostPostEngagement.py deleted file mode 100644 index 0aa6d71c7..000000000 --- a/examples/AdAccountCampaignsPostPostEngagement.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'My First Campaign', - 'objective': 'POST_ENGAGEMENT', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostStoreCampaign.py b/examples/AdAccountCampaignsPostStoreCampaign.py deleted file mode 100644 index 52a6cf47f..000000000 --- a/examples/AdAccountCampaignsPostStoreCampaign.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Store Traffic Campaign', - 'objective': 'STORE_VISITS', - 'promoted_object': {'page_id':''}, - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdAccountCampaignsPostVideoViews.py b/examples/AdAccountCampaignsPostVideoViews.py deleted file mode 100644 index f31326a5f..000000000 --- a/examples/AdAccountCampaignsPostVideoViews.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { - 'name': 'Video Views campaign', - 'objective': 'VIDEO_VIEWS', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -print AdAccount(id).create_campaign( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdCreativeCreativeInsightsEdge.py b/examples/AdCreativeCreativeInsightsEdge.py deleted file mode 100644 index 0a7a14f36..000000000 --- a/examples/AdCreativeCreativeInsightsEdge.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.adobjects.adcreativeinsights import AdCreativeInsights -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ - 'creative_compass_scores', -] -params = { -} -print AdCreative(id).get_creative_insights( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.py b/examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.py index c882795b3..354a8472e 100644 --- a/examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.py +++ b/examples/AdgroupLeadsEdgeAdgroupLeadsFiltered.py @@ -32,7 +32,7 @@ fields = [ ] params = { - 'filtering': [{'field':'time_created','operator':'GREATER_THAN','value':1677627440}], + 'filtering': [{'field':'time_created','operator':'GREATER_THAN','value':1681144509}], } print Ad(id).get_leads( fields=fields, diff --git a/examples/AdsInsightsEdgeStoreVisitsAdCampaignInsights.py b/examples/AdsInsightsEdgeStoreVisitsAdCampaignInsights.py deleted file mode 100644 index 9a7a4477d..000000000 --- a/examples/AdsInsightsEdgeStoreVisitsAdCampaignInsights.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.adset import AdSet -from facebook_business.adobjects.adsinsights import AdsInsights -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ - 'cost_per_store_visit_action', - 'store_visit_actions', -] -params = { -} -print AdSet(id).get_insights( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/AdsPixelEventsPost.py b/examples/AdsPixelEventsPost.py index 9fb6db024..8c3d050ba 100644 --- a/examples/AdsPixelEventsPost.py +++ b/examples/AdsPixelEventsPost.py @@ -31,7 +31,7 @@ fields = [ ] params = { - 'data': [{'event_name':'PageView','event_time':1678231512,'user_data':{'fbc':'fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890','fbp':'fb.1.1558571054389.1098115397','em':'309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd'}}], + 'data': [{'event_name':'PageView','event_time':1681748568,'user_data':{'fbc':'fb.1.1554763741205.AbCdEfGhIjKlMnOpQrStUvWxYz1234567890','fbp':'fb.1.1558571054389.1098115397','em':'309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd'}}], } print AdsPixel(id).create_event( fields=fields, diff --git a/examples/MultiPageFeedCreateThenDelete.py b/examples/MultiPageFeedCreateThenDelete.py deleted file mode 100644 index e6ff87831..000000000 --- a/examples/MultiPageFeedCreateThenDelete.py +++ /dev/null @@ -1,72 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.user import User -from facebook_business.adobjects.page import Page -from facebook_business.adobjects.pagepost import PagePost -from facebook_business.adobjects.abstractobject import AbstractObject -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -# Get page access token and page_id -fields = [ - 'access_token', -] -params = { -} -pages = User(id).get_accounts( - fields=fields, - params=params, -) -print 'pages', pages -page_id = pages[0].get_id() -print 'page_id:', page_id, '\n' - -# Switch access token to page access token -FacebookAdsApi.init(access_token=pages[0].access_token) -# Page feed create -fields = [ -] -params = { - 'message': 'This is a test value', -} -pagepost = Page(page_id).create_feed( - fields=fields, - params=params, -) -print 'pagepost', pagepost -pagepost_id = pagepost.get_id() -print 'pagepost_id:', pagepost_id, '\n' - -# Pagepost delete -fields = [ -] -params = { -} -print PagePost(pagepost_id).delete( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/MultiPromoteYourPage.py b/examples/MultiPromoteYourPage.py deleted file mode 100644 index f49b68188..000000000 --- a/examples/MultiPromoteYourPage.py +++ /dev/null @@ -1,162 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.user import User -from facebook_business.adobjects.page import Page -from facebook_business.adobjects.pagepost import PagePost -from facebook_business.adobjects.adaccount import AdAccount -from facebook_business.adobjects.campaign import Campaign -from facebook_business.adobjects.adset import AdSet -from facebook_business.adobjects.adcreative import AdCreative -from facebook_business.adobjects.ad import Ad -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -# User get -fields = [ -] -params = { -} -user = User(id).get( - fields=fields, - params=params, -) -print 'user', user -user_id = user.get_id() -print 'user_id:', user_id, '\n' - -# Get page access token and page_id -fields = [ - 'access_token', -] -params = { -} -pages = User(id).get_accounts( - fields=fields, - params=params, -) -print 'pages', pages -page_id = pages[0].get_id() -print 'page_id:', page_id, '\n' - -# Switch access token to page access token -FacebookAdsApi.init(access_token=pages[0].access_token) -# Page feed create -fields = [ -] -params = { - 'message': 'This is a test value', -} -pagepost = Page(page_id).create_feed( - fields=fields, - params=params, -) -print 'pagepost', pagepost -pagepost_id = pagepost.get_id() -print 'pagepost_id:', pagepost_id, '\n' - -# Switch access token back to user access token -FacebookAdsApi.init(access_token=access_token) -# User adaccounts get -fields = [ -] -params = { -} -adaccounts = User(user_id).get_ad_accounts( - fields=fields, - params=params, -) -print 'adaccounts', adaccounts -adaccount_id = adaccounts[0].get_id() -print 'adaccount_id:', adaccount_id, '\n' - -# AdCampaign create -fields = [ -] -params = { - 'name': 'My campaign', - 'objective': 'LINK_CLICKS', - 'status': 'PAUSED', - 'special_ad_categories': [], -} -adcampaign = AdAccount(adaccount_id).create_campaign( - fields=fields, - params=params, -) -print 'adcampaign', adcampaign -adcampaign_id = adcampaign.get_id() -print 'adcampaign_id:', adcampaign_id, '\n' - -# AdSet create -fields = [ -] -params = { - 'name': 'My Reach Ad Set', - 'optimization_goal': 'REACH', - 'billing_event': 'IMPRESSIONS', - 'bid_amount': '2', - 'daily_budget': '1000', - 'campaign_id': adcampaign_id, - 'targeting': {'geo_locations':{'countries':['US']},'facebook_positions':['feed']}, - 'status': 'PAUSED', - 'promoted_object': {'page_id':page_id}, -} -adset = AdAccount(adaccount_id).create_ad_set( - fields=fields, - params=params, -) -print 'adset', adset -adset_id = adset.get_id() -print 'adset_id:', adset_id, '\n' - -# AdCreative create page post -fields = [ -] -params = { - 'name': 'Sample Promoted Post', - 'object_story_id': page_id + '_' + pagepost_id, -} -adcreative = AdAccount(adaccount_id).create_ad_creative( - fields=fields, - params=params, -) -print 'adcreative', adcreative -adcreative_id = adcreative.get_id() -print 'adcreative_id:', adcreative_id, '\n' - -# AdGroup create -fields = [ -] -params = { - 'name': 'My Ad', - 'adset_id': adset_id, - 'creative': {'creative_id':adcreative_id}, - 'status': 'PAUSED', -} -print AdAccount(adaccount_id).create_ad( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/examples/PagePostCommentsEdge.py b/examples/PagePostCommentsEdge.py deleted file mode 100644 index 6e7df4fc6..000000000 --- a/examples/PagePostCommentsEdge.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. - -# You are hereby granted a non-exclusive, worldwide, royalty-free license to -# use, copy, modify, and distribute this software in source code or binary -# form for use in connection with the web services and APIs provided by -# Facebook. - -# As with any software that integrates with the Facebook platform, your use -# of this software is subject to the Facebook Developer Principles and -# Policies [http://developers.facebook.com/policy/]. This copyright notice -# shall be included in all copies or substantial portions of the software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -from facebook_business.adobjects.pagepost import PagePost -from facebook_business.adobjects.comment import Comment -from facebook_business.api import FacebookAdsApi - -access_token = '' -app_secret = '' -app_id = '' -id = '' -FacebookAdsApi.init(access_token=access_token) - -fields = [ -] -params = { -} -print PagePost(id).get_comments( - fields=fields, - params=params, -) \ No newline at end of file diff --git a/facebook_business/__init__.py b/facebook_business/__init__.py index 758857ad4..ea800222a 100644 --- a/facebook_business/__init__.py +++ b/facebook_business/__init__.py @@ -21,7 +21,7 @@ from facebook_business.session import FacebookSession from facebook_business.api import FacebookAdsApi -__version__ = '16.0.2' +__version__ = '17.0.0' __all__ = [ 'session', 'objects', diff --git a/facebook_business/adobjects/ad.py b/facebook_business/adobjects/ad.py index ce1d99d22..43cc8d2ec 100644 --- a/facebook_business/adobjects/ad.py +++ b/facebook_business/adobjects/ad.py @@ -66,6 +66,7 @@ class Field(AbstractObject.Field): id = 'id' issues_info = 'issues_info' last_updated_by_app_id = 'last_updated_by_app_id' + meta_reward_adgroup_status = 'meta_reward_adgroup_status' name = 'name' preview_shareable_link = 'preview_shareable_link' priority = 'priority' @@ -145,6 +146,10 @@ class ExecutionOptions: synchronous_ad_review = 'synchronous_ad_review' validate_only = 'validate_only' + class MetaRewardAdgroupStatus: + active = 'ACTIVE' + inactive = 'INACTIVE' + class Operator: all = 'ALL' any = 'ANY' @@ -267,6 +272,7 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure 'engagement_audience': 'bool', 'execution_options': 'list', 'include_demolink_hashes': 'bool', + 'meta_reward_adgroup_status': 'meta_reward_adgroup_status_enum', 'name': 'string', 'priority': 'unsigned int', 'status': 'status_enum', @@ -274,6 +280,7 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure } enums = { 'execution_options_enum': Ad.ExecutionOptions.__dict__.values(), + 'meta_reward_adgroup_status_enum': Ad.MetaRewardAdgroupStatus.__dict__.values(), 'status_enum': Ad.Status.__dict__.values(), } request = FacebookRequest( @@ -621,13 +628,14 @@ def get_leads(self, fields=None, params=None, batch=None, success=None, failure= self.assure_call() return request.execute() - def get_previews(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): + def get_pre_views(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.adpreview import AdPreview param_types = { 'ad_format': 'ad_format_enum', + 'creative_feature': 'creative_feature_enum', 'dynamic_asset_label': 'string', 'dynamic_creative_spec': 'Object', 'dynamic_customization': 'Object', @@ -643,6 +651,7 @@ def get_previews(self, fields=None, params=None, batch=None, success=None, failu } enums = { 'ad_format_enum': AdPreview.AdFormat.__dict__.values(), + 'creative_feature_enum': AdPreview.CreativeFeature.__dict__.values(), 'render_type_enum': AdPreview.RenderType.__dict__.values(), } request = FacebookRequest( @@ -722,6 +731,7 @@ def get_targeting_sentence_lines(self, fields=None, params=None, batch=None, suc 'id': 'string', 'issues_info': 'list', 'last_updated_by_app_id': 'string', + 'meta_reward_adgroup_status': 'string', 'name': 'string', 'preview_shareable_link': 'string', 'priority': 'unsigned int', @@ -750,6 +760,7 @@ def _get_field_enum_info(cls): field_enum_info['Status'] = Ad.Status.__dict__.values() field_enum_info['DatePreset'] = Ad.DatePreset.__dict__.values() field_enum_info['ExecutionOptions'] = Ad.ExecutionOptions.__dict__.values() + field_enum_info['MetaRewardAdgroupStatus'] = Ad.MetaRewardAdgroupStatus.__dict__.values() field_enum_info['Operator'] = Ad.Operator.__dict__.values() field_enum_info['StatusOption'] = Ad.StatusOption.__dict__.values() return field_enum_info diff --git a/facebook_business/adobjects/adaccount.py b/facebook_business/adobjects/adaccount.py index 4f3f4df81..93c2376b3 100644 --- a/facebook_business/adobjects/adaccount.py +++ b/facebook_business/adobjects/adaccount.py @@ -75,7 +75,6 @@ class Field(AbstractObject.Field): fb_entity = 'fb_entity' funding_source = 'funding_source' funding_source_details = 'funding_source_details' - has_advertiser_opted_in_odax = 'has_advertiser_opted_in_odax' has_migrated_permissions = 'has_migrated_permissions' has_page_authorized_adaccount = 'has_page_authorized_adaccount' id = 'id' @@ -205,6 +204,7 @@ class ContentType: class Subtype: app = 'APP' bag_of_accounts = 'BAG_OF_ACCOUNTS' + bidding = 'BIDDING' claim = 'CLAIM' custom = 'CUSTOM' engagement = 'ENGAGEMENT' @@ -214,6 +214,7 @@ class Subtype: measurement = 'MEASUREMENT' offline_conversion = 'OFFLINE_CONVERSION' partner = 'PARTNER' + primary = 'PRIMARY' regulated_categories_audience = 'REGULATED_CATEGORIES_AUDIENCE' study_rule_audience = 'STUDY_RULE_AUDIENCE' video = 'VIDEO' @@ -273,7 +274,6 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure 'is_notifications_enabled': 'bool', 'media_agency': 'string', 'name': 'string', - 'odax_opt_in': 'bool', 'partner': 'string', 'spend_cap': 'float', 'spend_cap_action': 'string', @@ -305,6 +305,69 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure self.assure_call() return request.execute() + def get_account_controls(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.adaccountbusinessconstraints import AdAccountBusinessConstraints + param_types = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/account_controls', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=AdAccountBusinessConstraints, + api_type='EDGE', + response_parser=ObjectParser(target_class=AdAccountBusinessConstraints, 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_account_control(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.adaccountbusinessconstraints import AdAccountBusinessConstraints + param_types = { + 'audience_controls': 'Object', + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='POST', + endpoint='/account_controls', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=AdAccountBusinessConstraints, + api_type='EDGE', + response_parser=ObjectParser(target_class=AdAccountBusinessConstraints, 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_activities(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): @@ -590,6 +653,7 @@ def create_ad_creative(self, fields=None, params=None, batch=None, success=None, 'asset_feed_spec': 'Object', 'authorization_category': 'authorization_category_enum', 'body': 'string', + 'branded_content': 'map', 'branded_content_sponsor_page_id': 'string', 'bundle_folder_id': 'string', 'call_to_action': 'Object', @@ -599,11 +663,13 @@ def create_ad_creative(self, fields=None, params=None, batch=None, success=None, 'destination_set_id': 'string', 'dynamic_ad_voice': 'dynamic_ad_voice_enum', 'enable_launch_instant_app': 'bool', + 'facebook_branded_content': 'map', 'image_crops': 'map', 'image_file': 'string', 'image_hash': 'string', 'image_url': 'string', 'instagram_actor_id': 'string', + 'instagram_branded_content': 'map', 'instagram_permalink_url': 'string', 'instagram_user_id': 'string', 'interactive_components_spec': 'map', @@ -1092,6 +1158,7 @@ def create_ad(self, fields=None, params=None, batch=None, success=None, failure= 'engagement_audience': 'bool', 'execution_options': 'list', 'include_demolink_hashes': 'bool', + 'meta_reward_adgroup_status': 'meta_reward_adgroup_status_enum', 'name': 'string', 'priority': 'unsigned int', 'source_ad_id': 'string', @@ -1100,6 +1167,7 @@ def create_ad(self, fields=None, params=None, batch=None, success=None, failure= } enums = { 'execution_options_enum': Ad.ExecutionOptions.__dict__.values(), + 'meta_reward_adgroup_status_enum': Ad.MetaRewardAdgroupStatus.__dict__.values(), 'status_enum': Ad.Status.__dict__.values(), } request = FacebookRequest( @@ -1125,6 +1193,39 @@ def create_ad(self, fields=None, params=None, batch=None, success=None, failure= self.assure_call() return request.execute() + def create_ads_conversion_goal(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 = { + 'description': 'string', + 'goal_name': 'string', + 'single_channel_conversion_events': 'list', + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='POST', + endpoint='/ads_conversion_goal', + 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() + def get_ads_reporting_mmm_reports(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): @@ -1265,6 +1366,7 @@ def get_ad_sets(self, fields=None, params=None, batch=None, success=None, failur 'effective_status': 'list', 'is_completed': 'bool', 'time_range': 'Object', + 'updated_since': 'int', } enums = { 'date_preset_enum': AdSet.DatePreset.__dict__.values(), @@ -1315,6 +1417,8 @@ def create_ad_set(self, fields=None, params=None, batch=None, success=None, fail 'daily_spend_cap': 'unsigned int', 'date_format': 'string', 'destination_type': 'destination_type_enum', + 'dsa_beneficiary': 'string', + 'dsa_payor': 'string', 'end_time': 'datetime', 'execution_options': 'list', 'existing_customer_budget_percentage': 'unsigned int', @@ -1344,7 +1448,6 @@ def create_ad_set(self, fields=None, params=None, batch=None, success=None, fail 'time_stop': 'datetime', 'topline_id': 'string', 'tune_for_category': 'tune_for_category_enum', - 'upstream_events': 'map', } enums = { 'bid_strategy_enum': AdSet.BidStrategy.__dict__.values(), @@ -2247,7 +2350,6 @@ def create_campaign(self, fields=None, params=None, batch=None, success=None, fa 'status': 'status_enum', 'stop_time': 'datetime', 'topline_id': 'string', - 'upstream_events': 'map', } enums = { 'bid_strategy_enum': Campaign.BidStrategy.__dict__.values(), @@ -2345,6 +2447,36 @@ def get_connected_instagram_accounts(self, fields=None, params=None, batch=None, self.assure_call() return request.execute() + def get_conversion_goals(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 = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/conversion_goals', + 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() + def get_custom_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): @@ -2352,6 +2484,7 @@ def get_custom_audiences(self, fields=None, params=None, batch=None, success=Non from facebook_business.adobjects.customaudience import CustomAudience param_types = { 'business_id': 'string', + 'fetch_primary_audience': 'bool', 'fields': 'list', 'filtering': 'list', 'pixel_id': 'string', @@ -2418,6 +2551,7 @@ def create_custom_audience(self, fields=None, params=None, batch=None, success=N 'rule': 'string', 'rule_aggregation': 'string', 'subtype': 'subtype_enum', + 'use_in_campaigns': 'bool', 'video_group_ids': 'list', } enums = { @@ -2648,7 +2782,7 @@ def get_deprecated_targeting_ad_sets(self, fields=None, params=None, batch=None, self.assure_call() return request.execute() - def get_generate_previews(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): + def get_generate_pre_views(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.') @@ -2656,6 +2790,7 @@ def get_generate_previews(self, fields=None, params=None, batch=None, success=No param_types = { 'ad_format': 'ad_format_enum', 'creative': 'AdCreative', + 'creative_feature': 'creative_feature_enum', 'dynamic_asset_label': 'string', 'dynamic_creative_spec': 'Object', 'dynamic_customization': 'Object', @@ -2671,6 +2806,7 @@ def get_generate_previews(self, fields=None, params=None, batch=None, success=No } enums = { 'ad_format_enum': AdPreview.AdFormat.__dict__.values(), + 'creative_feature_enum': AdPreview.CreativeFeature.__dict__.values(), 'render_type_enum': AdPreview.RenderType.__dict__.values(), } request = FacebookRequest( @@ -3571,11 +3707,13 @@ def get_targeting_browse(self, fields=None, params=None, batch=None, success=Non 'is_exclusion': 'bool', 'limit_type': 'limit_type_enum', 'regulated_categories': 'list', + 'regulated_countries': 'list', 'whitelisted_types': 'list', } enums = { 'limit_type_enum': AdAccountTargetingUnified.LimitType.__dict__.values(), 'regulated_categories_enum': AdAccountTargetingUnified.RegulatedCategories.__dict__.values(), + 'regulated_countries_enum': AdAccountTargetingUnified.RegulatedCountries.__dict__.values(), 'whitelisted_types_enum': AdAccountTargetingUnified.WhitelistedTypes.__dict__.values(), } request = FacebookRequest( @@ -3615,6 +3753,7 @@ def get_targeting_search(self, fields=None, params=None, batch=None, success=Non 'promoted_object': 'Object', 'q': 'string', 'regulated_categories': 'list', + 'regulated_countries': 'list', 'session_id': 'unsigned int', 'targeting_list': 'list', 'whitelisted_types': 'list', @@ -3624,6 +3763,7 @@ def get_targeting_search(self, fields=None, params=None, batch=None, success=Non 'limit_type_enum': AdAccountTargetingUnified.LimitType.__dict__.values(), 'objective_enum': AdAccountTargetingUnified.Objective.__dict__.values(), 'regulated_categories_enum': AdAccountTargetingUnified.RegulatedCategories.__dict__.values(), + 'regulated_countries_enum': AdAccountTargetingUnified.RegulatedCountries.__dict__.values(), 'whitelisted_types_enum': AdAccountTargetingUnified.WhitelistedTypes.__dict__.values(), } request = FacebookRequest( @@ -3696,6 +3836,7 @@ def get_targeting_suggestions(self, fields=None, params=None, batch=None, succes 'objective': 'objective_enum', 'objects': 'Object', 'regulated_categories': 'list', + 'regulated_countries': 'list', 'session_id': 'unsigned int', 'targeting_list': 'list', 'whitelisted_types': 'list', @@ -3706,6 +3847,7 @@ def get_targeting_suggestions(self, fields=None, params=None, batch=None, succes 'mode_enum': AdAccountTargetingUnified.Mode.__dict__.values(), 'objective_enum': AdAccountTargetingUnified.Objective.__dict__.values(), 'regulated_categories_enum': AdAccountTargetingUnified.RegulatedCategories.__dict__.values(), + 'regulated_countries_enum': AdAccountTargetingUnified.RegulatedCountries.__dict__.values(), 'whitelisted_types_enum': AdAccountTargetingUnified.WhitelistedTypes.__dict__.values(), } request = FacebookRequest( @@ -3912,7 +4054,7 @@ def delete_users_of_any_audience(self, fields=None, params=None, batch=None, suc 'capabilities': 'list', 'created_time': 'datetime', 'currency': 'string', - 'custom_audience_info': 'AdAccountCustomAudience', + 'custom_audience_info': 'CustomAudienceGroup', 'disable_reason': 'unsigned int', 'end_advertiser': 'string', 'end_advertiser_name': 'string', @@ -3922,7 +4064,6 @@ def delete_users_of_any_audience(self, fields=None, params=None, batch=None, suc 'fb_entity': 'unsigned int', 'funding_source': 'string', 'funding_source_details': 'FundingSourceDetails', - 'has_advertiser_opted_in_odax': 'bool', 'has_migrated_permissions': 'bool', 'has_page_authorized_adaccount': 'bool', 'id': 'string', diff --git a/facebook_business/adobjects/adaccountadvolume.py b/facebook_business/adobjects/adaccountadvolume.py index d94062276..68fe4f748 100644 --- a/facebook_business/adobjects/adaccountadvolume.py +++ b/facebook_business/adobjects/adaccountadvolume.py @@ -52,7 +52,12 @@ class Field(AbstractObject.Field): recommendations = 'recommendations' class RecommendationType: + ab_test = 'AB_TEST' aco_toggle = 'ACO_TOGGLE' + ads_reporting = 'ADS_REPORTING' + advantage_plus_creative = 'ADVANTAGE_PLUS_CREATIVE' + 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' @@ -61,25 +66,42 @@ class RecommendationType: audience_expansion = 'AUDIENCE_EXPANSION' autoflow_opt_in = 'AUTOFLOW_OPT_IN' automatic_placements = 'AUTOMATIC_PLACEMENTS' + auto_bid = 'AUTO_BID' + broad_targeting = 'BROAD_TARGETING' capi = 'CAPI' + connect_facebook_page_to_instagram = 'CONNECT_FACEBOOK_PAGE_TO_INSTAGRAM' + connect_facebook_page_to_whatsapp = 'CONNECT_FACEBOOK_PAGE_TO_WHATSAPP' cost_goal = 'COST_GOAL' cost_goal_budget_limited = 'COST_GOAL_BUDGET_LIMITED' cost_goal_cpa_limited = 'COST_GOAL_CPA_LIMITED' creative_badge = 'CREATIVE_BADGE' creative_fatigue = 'CREATIVE_FATIGUE' + creative_fatigue_hourly = 'CREATIVE_FATIGUE_HOURLY' creative_limited = 'CREATIVE_LIMITED' + creative_limited_hourly = 'CREATIVE_LIMITED_HOURLY' dead_link = 'DEAD_LINK' ecosystem_bid_reduce_l1_cardinality = 'ECOSYSTEM_BID_REDUCE_L1_CARDINALITY' fragmentation = 'FRAGMENTATION' + ges_test = 'GES_TEST' learning_limited = 'LEARNING_LIMITED' low_outcome = 'LOW_OUTCOME' mmt_carousel_to_video = 'MMT_CAROUSEL_TO_VIDEO' + mobile_first_video = 'MOBILE_FIRST_VIDEO' multi_text = 'MULTI_TEXT' music = 'MUSIC' + optimal_spend = 'OPTIMAL_SPEND' + payment_method = 'PAYMENT_METHOD' + pfr_l1_inline_mmt = 'PFR_L1_INLINE_MMT' predictive_creative_limited = 'PREDICTIVE_CREATIVE_LIMITED' + predictive_creative_limited_hourly = 'PREDICTIVE_CREATIVE_LIMITED_HOURLY' revert = 'REVERT' + scale_good_campaign = 'SCALE_GOOD_CAMPAIGN' semantic_based_audience_expansion = 'SEMANTIC_BASED_AUDIENCE_EXPANSION' + setup_pixel = 'SETUP_PIXEL' + shops_ads = 'SHOPS_ADS' signals_growth_capi = 'SIGNALS_GROWTH_CAPI' + six_plus_manual_placements = 'SIX_PLUS_MANUAL_PLACEMENTS' + spend_limit = 'SPEND_LIMIT' syd_test_mode = 'SYD_TEST_MODE' top_adsets_with_ads_under_cap = 'TOP_ADSETS_WITH_ADS_UNDER_CAP' top_campaigns_with_ads_under_cap = 'TOP_CAMPAIGNS_WITH_ADS_UNDER_CAP' diff --git a/facebook_business/adobjects/adaccountbusinessconstraints.py b/facebook_business/adobjects/adaccountbusinessconstraints.py new file mode 100644 index 000000000..e3970bbb9 --- /dev/null +++ b/facebook_business/adobjects/adaccountbusinessconstraints.py @@ -0,0 +1,64 @@ +# Copyright 2014 Facebook, Inc. + +# You are hereby granted a non-exclusive, worldwide, royalty-free license to +# use, copy, modify, and distribute this software in source code or binary +# form for use in connection with the web services and APIs provided by +# Facebook. + +# As with any software that integrates with the Facebook platform, your use +# of this software is subject to the Facebook Developer Principles and +# Policies [http://developers.facebook.com/policy/]. This copyright notice +# shall be included in all copies or substantial portions of the software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +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. + +For any issues or feature requests related to this class, please let us know on +github and we'll fix in our codegen framework. We'll not be able to accept +pull request for this class. +""" + +class AdAccountBusinessConstraints( + AbstractCrudObject, +): + + def __init__(self, fbid=None, parent_id=None, api=None): + self._isAdAccountBusinessConstraints = True + super(AdAccountBusinessConstraints, self).__init__(fbid, parent_id, api) + + class Field(AbstractObject.Field): + audience_controls = 'audience_controls' + + # @deprecated get_endpoint function is deprecated + @classmethod + def get_endpoint(cls): + return 'account_controls' + + # @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_account_control(fields, params, batch, success, failure, pending) + + _field_types = { + 'audience_controls': 'Object', + } + @classmethod + def _get_field_enum_info(cls): + field_enum_info = {} + return field_enum_info + + diff --git a/facebook_business/adobjects/adaccountdeliveryestimate.py b/facebook_business/adobjects/adaccountdeliveryestimate.py index 93f886cda..ba6b19d42 100644 --- a/facebook_business/adobjects/adaccountdeliveryestimate.py +++ b/facebook_business/adobjects/adaccountdeliveryestimate.py @@ -67,6 +67,7 @@ class OptimizationGoal: quality_call = 'QUALITY_CALL' quality_lead = 'QUALITY_LEAD' reach = 'REACH' + subscribers = 'SUBSCRIBERS' thruplay = 'THRUPLAY' value = 'VALUE' visit_instagram_profile = 'VISIT_INSTAGRAM_PROFILE' @@ -77,7 +78,7 @@ class OptimizationGoal: 'estimate_mau_lower_bound': 'int', 'estimate_mau_upper_bound': 'int', 'estimate_ready': 'bool', - 'targeting_optimization_types': 'map', + 'targeting_optimization_types': 'list>', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/adaccountmatchedsearchapplicationsedgedata.py b/facebook_business/adobjects/adaccountmatchedsearchapplicationsedgedata.py index 4220e0c15..d14f0efa3 100644 --- a/facebook_business/adobjects/adaccountmatchedsearchapplicationsedgedata.py +++ b/facebook_business/adobjects/adaccountmatchedsearchapplicationsedgedata.py @@ -63,6 +63,8 @@ class AppStore: instant_game = 'INSTANT_GAME' itunes = 'ITUNES' itunes_ipad = 'ITUNES_IPAD' + neon_android_store = 'NEON_ANDROID_STORE' + none = 'NONE' oculus_app_store = 'OCULUS_APP_STORE' oppo = 'OPPO' roku_store = 'ROKU_STORE' diff --git a/facebook_business/adobjects/adaccounttargetingunified.py b/facebook_business/adobjects/adaccounttargetingunified.py index 0ccd1b983..54d8907a1 100644 --- a/facebook_business/adobjects/adaccounttargetingunified.py +++ b/facebook_business/adobjects/adaccounttargetingunified.py @@ -101,16 +101,272 @@ class RegulatedCategories: none = 'NONE' online_gambling_and_gaming = 'ONLINE_GAMBLING_AND_GAMING' + class RegulatedCountries: + ad = 'AD' + ae = 'AE' + af = 'AF' + ag = 'AG' + ai = 'AI' + al = 'AL' + am = 'AM' + an = 'AN' + ao = 'AO' + aq = 'AQ' + ar = 'AR' + value_as = 'AS' + at = 'AT' + au = 'AU' + aw = 'AW' + ax = 'AX' + az = 'AZ' + ba = 'BA' + bb = 'BB' + bd = 'BD' + be = 'BE' + bf = 'BF' + bg = 'BG' + bh = 'BH' + bi = 'BI' + bj = 'BJ' + bl = 'BL' + bm = 'BM' + bn = 'BN' + bo = 'BO' + bq = 'BQ' + br = 'BR' + bs = 'BS' + bt = 'BT' + bv = 'BV' + bw = 'BW' + by = 'BY' + bz = 'BZ' + ca = 'CA' + cc = 'CC' + cd = 'CD' + cf = 'CF' + cg = 'CG' + ch = 'CH' + ci = 'CI' + ck = 'CK' + cl = 'CL' + cm = 'CM' + cn = 'CN' + co = 'CO' + cr = 'CR' + cu = 'CU' + cv = 'CV' + cw = 'CW' + cx = 'CX' + cy = 'CY' + cz = 'CZ' + de = 'DE' + dj = 'DJ' + dk = 'DK' + dm = 'DM' + do = 'DO' + dz = 'DZ' + ec = 'EC' + ee = 'EE' + eg = 'EG' + eh = 'EH' + er = 'ER' + es = 'ES' + et = 'ET' + fi = 'FI' + fj = 'FJ' + fk = 'FK' + fm = 'FM' + fo = 'FO' + fr = 'FR' + ga = 'GA' + gb = 'GB' + gd = 'GD' + ge = 'GE' + gf = 'GF' + gg = 'GG' + gh = 'GH' + gi = 'GI' + gl = 'GL' + gm = 'GM' + gn = 'GN' + gp = 'GP' + gq = 'GQ' + gr = 'GR' + gs = 'GS' + gt = 'GT' + gu = 'GU' + gw = 'GW' + gy = 'GY' + hk = 'HK' + hm = 'HM' + hn = 'HN' + hr = 'HR' + ht = 'HT' + hu = 'HU' + id = 'ID' + ie = 'IE' + il = 'IL' + im = 'IM' + value_in = 'IN' + io = 'IO' + iq = 'IQ' + ir = 'IR' + value_is = 'IS' + it = 'IT' + je = 'JE' + jm = 'JM' + jo = 'JO' + jp = 'JP' + ke = 'KE' + kg = 'KG' + kh = 'KH' + ki = 'KI' + km = 'KM' + kn = 'KN' + kp = 'KP' + kr = 'KR' + kw = 'KW' + ky = 'KY' + kz = 'KZ' + la = 'LA' + lb = 'LB' + lc = 'LC' + li = 'LI' + lk = 'LK' + lr = 'LR' + ls = 'LS' + lt = 'LT' + lu = 'LU' + lv = 'LV' + ly = 'LY' + ma = 'MA' + mc = 'MC' + md = 'MD' + me = 'ME' + mf = 'MF' + mg = 'MG' + mh = 'MH' + mk = 'MK' + ml = 'ML' + mm = 'MM' + mn = 'MN' + mo = 'MO' + mp = 'MP' + mq = 'MQ' + mr = 'MR' + ms = 'MS' + mt = 'MT' + mu = 'MU' + mv = 'MV' + mw = 'MW' + mx = 'MX' + my = 'MY' + mz = 'MZ' + na = 'NA' + nc = 'NC' + ne = 'NE' + nf = 'NF' + ng = 'NG' + ni = 'NI' + nl = 'NL' + no = 'NO' + np = 'NP' + nr = 'NR' + nu = 'NU' + nz = 'NZ' + om = 'OM' + pa = 'PA' + pe = 'PE' + pf = 'PF' + pg = 'PG' + ph = 'PH' + pk = 'PK' + pl = 'PL' + pm = 'PM' + pn = 'PN' + pr = 'PR' + ps = 'PS' + pt = 'PT' + pw = 'PW' + py = 'PY' + qa = 'QA' + re = 'RE' + ro = 'RO' + rs = 'RS' + ru = 'RU' + rw = 'RW' + sa = 'SA' + sb = 'SB' + sc = 'SC' + sd = 'SD' + se = 'SE' + sg = 'SG' + sh = 'SH' + si = 'SI' + sj = 'SJ' + sk = 'SK' + sl = 'SL' + sm = 'SM' + sn = 'SN' + so = 'SO' + sr = 'SR' + ss = 'SS' + st = 'ST' + sv = 'SV' + sx = 'SX' + sy = 'SY' + sz = 'SZ' + tc = 'TC' + td = 'TD' + tf = 'TF' + tg = 'TG' + th = 'TH' + tj = 'TJ' + tk = 'TK' + tl = 'TL' + tm = 'TM' + tn = 'TN' + to = 'TO' + tr = 'TR' + tt = 'TT' + tv = 'TV' + tw = 'TW' + tz = 'TZ' + ua = 'UA' + ug = 'UG' + um = 'UM' + us = 'US' + uy = 'UY' + uz = 'UZ' + va = 'VA' + vc = 'VC' + ve = 'VE' + vg = 'VG' + vi = 'VI' + vn = 'VN' + vu = 'VU' + wf = 'WF' + ws = 'WS' + xk = 'XK' + ye = 'YE' + yt = 'YT' + za = 'ZA' + zm = 'ZM' + zw = 'ZW' + class WhitelistedTypes: adgroup_id = 'adgroup_id' age_max = 'age_max' age_min = 'age_min' + age_range = 'age_range' alternate_auto_targeting_option = 'alternate_auto_targeting_option' app_install_state = 'app_install_state' audience_network_positions = 'audience_network_positions' behaviors = 'behaviors' brand_safety_content_filter_levels = 'brand_safety_content_filter_levels' brand_safety_content_severity_levels = 'brand_safety_content_severity_levels' + cafe_ca_contraction_targeting_signal = 'cafe_ca_contraction_targeting_signal' + cafe_ca_expansion_targeting_signal = 'cafe_ca_expansion_targeting_signal' catalog_based_targeting = 'catalog_based_targeting' cities = 'cities' city_keys = 'city_keys' @@ -241,6 +497,8 @@ class AppStore: instant_game = 'instant_game' itunes = 'itunes' itunes_ipad = 'itunes_ipad' + neon_android_store = 'neon_android_store' + none = 'none' oculus_app_store = 'oculus_app_store' oppo = 'oppo' roku_channel_store = 'roku_channel_store' @@ -309,6 +567,7 @@ def _get_field_enum_info(cls): field_enum_info = {} field_enum_info['LimitType'] = AdAccountTargetingUnified.LimitType.__dict__.values() field_enum_info['RegulatedCategories'] = AdAccountTargetingUnified.RegulatedCategories.__dict__.values() + field_enum_info['RegulatedCountries'] = AdAccountTargetingUnified.RegulatedCountries.__dict__.values() field_enum_info['WhitelistedTypes'] = AdAccountTargetingUnified.WhitelistedTypes.__dict__.values() field_enum_info['AppStore'] = AdAccountTargetingUnified.AppStore.__dict__.values() field_enum_info['Objective'] = AdAccountTargetingUnified.Objective.__dict__.values() diff --git a/facebook_business/adobjects/adassetfeedspec.py b/facebook_business/adobjects/adassetfeedspec.py index efd1a2984..47d810785 100644 --- a/facebook_business/adobjects/adassetfeedspec.py +++ b/facebook_business/adobjects/adassetfeedspec.py @@ -40,6 +40,7 @@ def __init__(self, api=None): class Field(AbstractObject.Field): ad_formats = 'ad_formats' additional_data = 'additional_data' + app_product_page_id = 'app_product_page_id' asset_customization_rules = 'asset_customization_rules' autotranslate = 'autotranslate' bodies = 'bodies' @@ -81,9 +82,11 @@ class CallToActionTypes: get_directions = 'GET_DIRECTIONS' get_offer = 'GET_OFFER' get_offer_view = 'GET_OFFER_VIEW' + get_promotions = 'GET_PROMOTIONS' get_quote = 'GET_QUOTE' get_showtimes = 'GET_SHOWTIMES' get_started = 'GET_STARTED' + inquire_now = 'INQUIRE_NOW' install_app = 'INSTALL_APP' install_mobile_app = 'INSTALL_MOBILE_APP' learn_more = 'LEARN_MORE' @@ -133,6 +136,7 @@ class CallToActionTypes: _field_types = { 'ad_formats': 'list', 'additional_data': 'Object', + 'app_product_page_id': 'string', 'asset_customization_rules': 'list', 'autotranslate': 'list', 'bodies': 'list', diff --git a/facebook_business/adobjects/adcampaigndeliveryestimate.py b/facebook_business/adobjects/adcampaigndeliveryestimate.py index af6595307..21ed2693c 100644 --- a/facebook_business/adobjects/adcampaigndeliveryestimate.py +++ b/facebook_business/adobjects/adcampaigndeliveryestimate.py @@ -67,6 +67,7 @@ class OptimizationGoal: quality_call = 'QUALITY_CALL' quality_lead = 'QUALITY_LEAD' reach = 'REACH' + subscribers = 'SUBSCRIBERS' thruplay = 'THRUPLAY' value = 'VALUE' visit_instagram_profile = 'VISIT_INSTAGRAM_PROFILE' @@ -77,7 +78,7 @@ class OptimizationGoal: 'estimate_mau_lower_bound': 'int', 'estimate_mau_upper_bound': 'int', 'estimate_ready': 'bool', - 'targeting_optimization_types': 'map', + 'targeting_optimization_types': 'list>', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/adcampaigndeliverystatsunsupportedreasons.py b/facebook_business/adobjects/adcampaigndeliverystatsunsupportedreasons.py index e3d0a9659..cc0b4c38e 100644 --- a/facebook_business/adobjects/adcampaigndeliverystatsunsupportedreasons.py +++ b/facebook_business/adobjects/adcampaigndeliverystatsunsupportedreasons.py @@ -42,7 +42,7 @@ class Field(AbstractObject.Field): reason_type = 'reason_type' _field_types = { - 'reason_data': 'map', + 'reason_data': 'list>', 'reason_type': 'string', } @classmethod diff --git a/facebook_business/adobjects/adcreative.py b/facebook_business/adobjects/adcreative.py index b0198e600..42e6862a0 100644 --- a/facebook_business/adobjects/adcreative.py +++ b/facebook_business/adobjects/adcreative.py @@ -51,6 +51,7 @@ class Field(AbstractObject.Field): authorization_category = 'authorization_category' auto_update = 'auto_update' body = 'body' + branded_content = 'branded_content' branded_content_sponsor_page_id = 'branded_content_sponsor_page_id' bundle_folder_id = 'bundle_folder_id' call_to_action_type = 'call_to_action_type' @@ -66,11 +67,13 @@ class Field(AbstractObject.Field): effective_object_story_id = 'effective_object_story_id' enable_direct_install = 'enable_direct_install' enable_launch_instant_app = 'enable_launch_instant_app' + facebook_branded_content = 'facebook_branded_content' id = 'id' image_crops = 'image_crops' image_hash = 'image_hash' image_url = 'image_url' instagram_actor_id = 'instagram_actor_id' + instagram_branded_content = 'instagram_branded_content' instagram_permalink_url = 'instagram_permalink_url' instagram_story_id = 'instagram_story_id' instagram_user_id = 'instagram_user_id' @@ -133,9 +136,11 @@ class CallToActionType: get_directions = 'GET_DIRECTIONS' get_offer = 'GET_OFFER' get_offer_view = 'GET_OFFER_VIEW' + get_promotions = 'GET_PROMOTIONS' get_quote = 'GET_QUOTE' get_showtimes = 'GET_SHOWTIMES' get_started = 'GET_STARTED' + inquire_now = 'INQUIRE_NOW' install_app = 'INSTALL_APP' install_mobile_app = 'INSTALL_MOBILE_APP' learn_more = 'LEARN_MORE' @@ -406,13 +411,14 @@ def get_creative_insights(self, fields=None, params=None, batch=None, success=No self.assure_call() return request.execute() - def get_previews(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): + def get_pre_views(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.adpreview import AdPreview param_types = { 'ad_format': 'ad_format_enum', + 'creative_feature': 'creative_feature_enum', 'dynamic_asset_label': 'string', 'dynamic_creative_spec': 'Object', 'dynamic_customization': 'Object', @@ -428,6 +434,7 @@ def get_previews(self, fields=None, params=None, batch=None, success=None, failu } enums = { 'ad_format_enum': AdPreview.AdFormat.__dict__.values(), + 'creative_feature_enum': AdPreview.CreativeFeature.__dict__.values(), 'render_type_enum': AdPreview.RenderType.__dict__.values(), } request = FacebookRequest( @@ -461,6 +468,7 @@ def get_previews(self, fields=None, params=None, batch=None, success=None, failu 'authorization_category': 'string', 'auto_update': 'bool', 'body': 'string', + 'branded_content': 'AdCreativeBrandedContentAds', 'branded_content_sponsor_page_id': 'string', 'bundle_folder_id': 'string', 'call_to_action_type': 'CallToActionType', @@ -476,11 +484,13 @@ def get_previews(self, fields=None, params=None, batch=None, success=None, failu 'effective_object_story_id': 'string', 'enable_direct_install': 'bool', 'enable_launch_instant_app': 'bool', + 'facebook_branded_content': 'AdCreativeFacebookBrandedContent', 'id': 'string', 'image_crops': 'AdsImageCrops', 'image_hash': 'string', 'image_url': 'string', 'instagram_actor_id': 'string', + 'instagram_branded_content': 'AdCreativeInstagramBrandedContent', 'instagram_permalink_url': 'string', 'instagram_story_id': 'string', 'instagram_user_id': 'string', diff --git a/facebook_business/adobjects/adcreativebrandedcontentads.py b/facebook_business/adobjects/adcreativebrandedcontentads.py new file mode 100644 index 000000000..9ec39a0b0 --- /dev/null +++ b/facebook_business/adobjects/adcreativebrandedcontentads.py @@ -0,0 +1,59 @@ +# Copyright 2014 Facebook, Inc. + +# You are hereby granted a non-exclusive, worldwide, royalty-free license to +# use, copy, modify, and distribute this software in source code or binary +# form for use in connection with the web services and APIs provided by +# Facebook. + +# As with any software that integrates with the Facebook platform, your use +# of this software is subject to the Facebook Developer Principles and +# Policies [http://developers.facebook.com/policy/]. This copyright notice +# shall be included in all copies or substantial portions of the software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +from facebook_business.adobjects.abstractobject import AbstractObject + +""" +This class is auto-generated. + +For any issues or feature requests related to this class, please let us know on +github and we'll fix in our codegen framework. We'll not be able to accept +pull request for this class. +""" + +class AdCreativeBrandedContentAds( + AbstractObject, +): + + def __init__(self, api=None): + super(AdCreativeBrandedContentAds, self).__init__() + self._isAdCreativeBrandedContentAds = True + self._api = api + + class Field(AbstractObject.Field): + ad_format = 'ad_format' + creator_ad_permission_type = 'creator_ad_permission_type' + instagram_boost_post_access_token = 'instagram_boost_post_access_token' + partners = 'partners' + ui_version = 'ui_version' + + _field_types = { + 'ad_format': 'int', + 'creator_ad_permission_type': 'string', + 'instagram_boost_post_access_token': 'string', + 'partners': 'list', + 'ui_version': 'int', + } + @classmethod + def _get_field_enum_info(cls): + field_enum_info = {} + return field_enum_info + + diff --git a/facebook_business/adobjects/adcreativefacebookbrandedcontent.py b/facebook_business/adobjects/adcreativefacebookbrandedcontent.py new file mode 100644 index 000000000..70c198009 --- /dev/null +++ b/facebook_business/adobjects/adcreativefacebookbrandedcontent.py @@ -0,0 +1,55 @@ +# Copyright 2014 Facebook, Inc. + +# You are hereby granted a non-exclusive, worldwide, royalty-free license to +# use, copy, modify, and distribute this software in source code or binary +# form for use in connection with the web services and APIs provided by +# Facebook. + +# As with any software that integrates with the Facebook platform, your use +# of this software is subject to the Facebook Developer Principles and +# Policies [http://developers.facebook.com/policy/]. This copyright notice +# shall be included in all copies or substantial portions of the software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +from facebook_business.adobjects.abstractobject import AbstractObject + +""" +This class is auto-generated. + +For any issues or feature requests related to this class, please let us know on +github and we'll fix in our codegen framework. We'll not be able to accept +pull request for this class. +""" + +class AdCreativeFacebookBrandedContent( + AbstractObject, +): + + def __init__(self, api=None): + super(AdCreativeFacebookBrandedContent, self).__init__() + self._isAdCreativeFacebookBrandedContent = True + self._api = api + + class Field(AbstractObject.Field): + shared_to_sponsor_status = 'shared_to_sponsor_status' + sponsor_page_id = 'sponsor_page_id' + sponsor_relationship = 'sponsor_relationship' + + _field_types = { + 'shared_to_sponsor_status': 'string', + 'sponsor_page_id': 'string', + 'sponsor_relationship': 'string', + } + @classmethod + def _get_field_enum_info(cls): + field_enum_info = {} + return field_enum_info + + diff --git a/facebook_business/adobjects/adcreativeinsights.py b/facebook_business/adobjects/adcreativeinsights.py index 73b1c2f80..4465fb892 100644 --- a/facebook_business/adobjects/adcreativeinsights.py +++ b/facebook_business/adobjects/adcreativeinsights.py @@ -41,7 +41,7 @@ class Field(AbstractObject.Field): aesthetics = 'aesthetics' _field_types = { - 'aesthetics': 'map', + 'aesthetics': 'list>', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/instantarticleinsightsqueryresult.py b/facebook_business/adobjects/adcreativeinstagrambrandedcontent.py similarity index 59% rename from facebook_business/adobjects/instantarticleinsightsqueryresult.py rename to facebook_business/adobjects/adcreativeinstagrambrandedcontent.py index a97186f1d..20dbb1db5 100644 --- a/facebook_business/adobjects/instantarticleinsightsqueryresult.py +++ b/facebook_business/adobjects/adcreativeinstagrambrandedcontent.py @@ -28,51 +28,24 @@ pull request for this class. """ -class InstantArticleInsightsQueryResult( +class AdCreativeInstagramBrandedContent( AbstractObject, ): def __init__(self, api=None): - super(InstantArticleInsightsQueryResult, self).__init__() - self._isInstantArticleInsightsQueryResult = True + super(AdCreativeInstagramBrandedContent, self).__init__() + self._isAdCreativeInstagramBrandedContent = True self._api = api class Field(AbstractObject.Field): - breakdowns = 'breakdowns' - name = 'name' - time = 'time' - value = 'value' - - class Breakdown: - age = 'age' - country = 'country' - gender = 'gender' - gender_and_age = 'gender_and_age' - is_organic = 'is_organic' - is_shared_by_ia_owner = 'is_shared_by_ia_owner' - no_breakdown = 'no_breakdown' - platform = 'platform' - region = 'region' - - class Period: - day = 'day' - days_28 = 'days_28' - lifetime = 'lifetime' - month = 'month' - total_over_range = 'total_over_range' - week = 'week' + sponsor_id = 'sponsor_id' _field_types = { - 'breakdowns': 'map', - 'name': 'string', - 'time': 'datetime', - 'value': 'string', + 'sponsor_id': 'string', } @classmethod def _get_field_enum_info(cls): field_enum_info = {} - field_enum_info['Breakdown'] = InstantArticleInsightsQueryResult.Breakdown.__dict__.values() - field_enum_info['Period'] = InstantArticleInsightsQueryResult.Period.__dict__.values() return field_enum_info diff --git a/facebook_business/adobjects/adcreativelinkdatacalltoaction.py b/facebook_business/adobjects/adcreativelinkdatacalltoaction.py index 09cac93eb..679dfe0d8 100644 --- a/facebook_business/adobjects/adcreativelinkdatacalltoaction.py +++ b/facebook_business/adobjects/adcreativelinkdatacalltoaction.py @@ -66,9 +66,11 @@ class Type: get_directions = 'GET_DIRECTIONS' get_offer = 'GET_OFFER' get_offer_view = 'GET_OFFER_VIEW' + get_promotions = 'GET_PROMOTIONS' get_quote = 'GET_QUOTE' get_showtimes = 'GET_SHOWTIMES' get_started = 'GET_STARTED' + inquire_now = 'INQUIRE_NOW' install_app = 'INSTALL_APP' install_mobile_app = 'INSTALL_MOBILE_APP' learn_more = 'LEARN_MORE' diff --git a/facebook_business/adobjects/adcreativelinkdatatemplatevideospec.py b/facebook_business/adobjects/adcreativelinkdatatemplatevideospec.py index 7c8e6b756..17fbdbcb5 100644 --- a/facebook_business/adobjects/adcreativelinkdatatemplatevideospec.py +++ b/facebook_business/adobjects/adcreativelinkdatatemplatevideospec.py @@ -44,7 +44,7 @@ class Field(AbstractObject.Field): _field_types = { 'categorization_criteria': 'string', - 'customization': 'map', + 'customization': 'list>', 'template_id': 'string', } @classmethod diff --git a/facebook_business/adobjects/adpreview.py b/facebook_business/adobjects/adpreview.py index 01c8da95d..ebb3dcfa9 100644 --- a/facebook_business/adobjects/adpreview.py +++ b/facebook_business/adobjects/adpreview.py @@ -41,6 +41,7 @@ def __init__(self, api=None): class Field(AbstractObject.Field): body = 'body' + transformation_spec = 'transformation_spec' class AdFormat: audience_network_instream_video = 'AUDIENCE_NETWORK_INSTREAM_VIDEO' @@ -66,9 +67,9 @@ class AdFormat: instagram_reels_overlay = 'INSTAGRAM_REELS_OVERLAY' instagram_search_chain = 'INSTAGRAM_SEARCH_CHAIN' instagram_search_grid = 'INSTAGRAM_SEARCH_GRID' - instagram_shop = 'INSTAGRAM_SHOP' instagram_standard = 'INSTAGRAM_STANDARD' instagram_story = 'INSTAGRAM_STORY' + instagram_story_camera_tray = 'INSTAGRAM_STORY_CAMERA_TRAY' instagram_story_web = 'INSTAGRAM_STORY_WEB' instagram_story_web_m_site = 'INSTAGRAM_STORY_WEB_M_SITE' instant_article_recirculation_ad = 'INSTANT_ARTICLE_RECIRCULATION_AD' @@ -96,6 +97,9 @@ class AdFormat: watch_feed_home = 'WATCH_FEED_HOME' watch_feed_mobile = 'WATCH_FEED_MOBILE' + class CreativeFeature: + profile_card = 'profile_card' + class RenderType: fallback = 'FALLBACK' @@ -106,11 +110,13 @@ def get_endpoint(cls): _field_types = { 'body': 'string', + 'transformation_spec': 'Object', } @classmethod def _get_field_enum_info(cls): field_enum_info = {} field_enum_info['AdFormat'] = AdPreview.AdFormat.__dict__.values() + field_enum_info['CreativeFeature'] = AdPreview.CreativeFeature.__dict__.values() field_enum_info['RenderType'] = AdPreview.RenderType.__dict__.values() return field_enum_info diff --git a/facebook_business/adobjects/adpromotedobject.py b/facebook_business/adobjects/adpromotedobject.py index 7ec30483e..457deaf35 100644 --- a/facebook_business/adobjects/adpromotedobject.py +++ b/facebook_business/adobjects/adpromotedobject.py @@ -39,6 +39,7 @@ def __init__(self, api=None): class Field(AbstractObject.Field): application_id = 'application_id' + conversion_goal_id = 'conversion_goal_id' custom_conversion_id = 'custom_conversion_id' custom_event_str = 'custom_event_str' custom_event_type = 'custom_event_type' @@ -53,6 +54,7 @@ class Field(AbstractObject.Field): pixel_aggregation_rule = 'pixel_aggregation_rule' pixel_id = 'pixel_id' pixel_rule = 'pixel_rule' + place_page_set = 'place_page_set' place_page_set_id = 'place_page_set_id' product_catalog_id = 'product_catalog_id' product_item_id = 'product_item_id' @@ -91,6 +93,7 @@ class CustomEventType: _field_types = { 'application_id': 'string', + 'conversion_goal_id': 'string', 'custom_conversion_id': 'string', 'custom_event_str': 'string', 'custom_event_type': 'CustomEventType', @@ -105,6 +108,7 @@ class CustomEventType: 'pixel_aggregation_rule': 'string', 'pixel_id': 'string', 'pixel_rule': 'string', + 'place_page_set': 'AdPlacePageSet', 'place_page_set_id': 'string', 'product_catalog_id': 'string', 'product_item_id': 'string', diff --git a/facebook_business/adobjects/adrule.py b/facebook_business/adobjects/adrule.py index 040580dab..01fbbe343 100644 --- a/facebook_business/adobjects/adrule.py +++ b/facebook_business/adobjects/adrule.py @@ -64,12 +64,16 @@ class UiCreationSource: am_activity_history_table = 'AM_ACTIVITY_HISTORY_TABLE' am_ad_object_name_card = 'AM_AD_OBJECT_NAME_CARD' am_amfe_l3_recommendation = 'AM_AMFE_L3_RECOMMENDATION' + am_autoflow_guidance_card = 'AM_AUTOFLOW_GUIDANCE_CARD' am_auto_apply_widget = 'AM_AUTO_APPLY_WIDGET' am_editor_card = 'AM_EDITOR_CARD' am_info_card = 'AM_INFO_CARD' am_name_cell_dropdown = 'AM_NAME_CELL_DROPDOWN' + am_optimization_tip_guidance_card = 'AM_OPTIMIZATION_TIP_GUIDANCE_CARD' am_performance_summary = 'AM_PERFORMANCE_SUMMARY' am_rule_landing_page_banner = 'AM_RULE_LANDING_PAGE_BANNER' + am_syd_resolution_flow = 'AM_SYD_RESOLUTION_FLOW' + am_syd_resolution_flow_modal = 'AM_SYD_RESOLUTION_FLOW_MODAL' am_toolbar_create_rule_dropdown = 'AM_TOOLBAR_CREATE_RULE_DROPDOWN' pe_campaign_structure_menu = 'PE_CAMPAIGN_STRUCTURE_MENU' pe_editor_card = 'PE_EDITOR_CARD' diff --git a/facebook_business/adobjects/adset.py b/facebook_business/adobjects/adset.py index d9bb3f874..0ce6aa3b6 100644 --- a/facebook_business/adobjects/adset.py +++ b/facebook_business/adobjects/adset.py @@ -67,6 +67,8 @@ class Field(AbstractObject.Field): daily_min_spend_target = 'daily_min_spend_target' daily_spend_cap = 'daily_spend_cap' destination_type = 'destination_type' + dsa_beneficiary = 'dsa_beneficiary' + dsa_payor = 'dsa_payor' effective_status = 'effective_status' end_time = 'end_time' existing_customer_budget_percentage = 'existing_customer_budget_percentage' @@ -111,7 +113,6 @@ class Field(AbstractObject.Field): time_stop = 'time_stop' topline_id = 'topline_id' tune_for_category = 'tune_for_category' - upstream_events = 'upstream_events' class BidStrategy: cost_cap = 'COST_CAP' @@ -168,6 +169,7 @@ class OptimizationGoal: quality_call = 'QUALITY_CALL' quality_lead = 'QUALITY_LEAD' reach = 'REACH' + subscribers = 'SUBSCRIBERS' thruplay = 'THRUPLAY' value = 'VALUE' visit_instagram_profile = 'VISIT_INSTAGRAM_PROFILE' @@ -370,6 +372,8 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure 'daily_spend_cap': 'unsigned int', 'date_format': 'string', 'destination_type': 'destination_type_enum', + 'dsa_beneficiary': 'string', + 'dsa_payor': 'string', 'end_time': 'datetime', 'execution_options': 'list', 'existing_customer_budget_percentage': 'unsigned int', @@ -394,7 +398,6 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure 'time_start': 'datetime', 'time_stop': 'datetime', 'tune_for_category': 'tune_for_category_enum', - 'upstream_events': 'map', } enums = { 'bid_strategy_enum': AdSet.BidStrategy.__dict__.values(), @@ -988,6 +991,8 @@ def get_targeting_sentence_lines(self, fields=None, params=None, batch=None, suc 'daily_min_spend_target': 'string', 'daily_spend_cap': 'string', 'destination_type': 'string', + 'dsa_beneficiary': 'string', + 'dsa_payor': 'string', 'effective_status': 'EffectiveStatus', 'end_time': 'datetime', 'existing_customer_budget_percentage': 'unsigned int', @@ -1017,7 +1022,7 @@ def get_targeting_sentence_lines(self, fields=None, params=None, batch=None, suc 'start_time': 'datetime', 'status': 'Status', 'targeting': 'Targeting', - 'targeting_optimization_types': 'map', + 'targeting_optimization_types': 'list>', 'time_based_ad_rotation_id_blocks': 'list>', 'time_based_ad_rotation_intervals': 'list', 'updated_time': 'datetime', @@ -1032,7 +1037,6 @@ def get_targeting_sentence_lines(self, fields=None, params=None, batch=None, suc 'time_stop': 'datetime', 'topline_id': 'string', 'tune_for_category': 'TuneForCategory', - 'upstream_events': 'map', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/adsinsights.py b/facebook_business/adobjects/adsinsights.py index 349b42abf..af694070a 100644 --- a/facebook_business/adobjects/adsinsights.py +++ b/facebook_business/adobjects/adsinsights.py @@ -45,12 +45,10 @@ class Field(AbstractObject.Field): account_name = 'account_name' action_values = 'action_values' actions = 'actions' - ad_bid_value = 'ad_bid_value' ad_click_actions = 'ad_click_actions' ad_id = 'ad_id' ad_impression_actions = 'ad_impression_actions' ad_name = 'ad_name' - adset_bid_value = 'adset_bid_value' adset_end = 'adset_end' adset_id = 'adset_id' adset_name = 'adset_name' @@ -97,6 +95,7 @@ class Field(AbstractObject.Field): cpm = 'cpm' cpp = 'cpp' created_time = 'created_time' + creative_media_type = 'creative_media_type' ctr = 'ctr' date_start = 'date_start' date_stop = 'date_stop' @@ -117,6 +116,7 @@ class Field(AbstractObject.Field): inline_link_click_ctr = 'inline_link_click_ctr' inline_link_clicks = 'inline_link_clicks' inline_post_engagement = 'inline_post_engagement' + instagram_upcoming_event_reminders_set = 'instagram_upcoming_event_reminders_set' instant_experience_clicks_to_open = 'instant_experience_clicks_to_open' instant_experience_clicks_to_start = 'instant_experience_clicks_to_start' instant_experience_outbound_clicks = 'instant_experience_outbound_clicks' @@ -140,6 +140,7 @@ class Field(AbstractObject.Field): spend = 'spend' total_postbacks = 'total_postbacks' total_postbacks_detailed = 'total_postbacks_detailed' + total_postbacks_detailed_v4 = 'total_postbacks_detailed_v4' unique_actions = 'unique_actions' unique_clicks = 'unique_clicks' unique_conversions = 'unique_conversions' @@ -207,14 +208,17 @@ class Breakdowns: app_id = 'app_id' body_asset = 'body_asset' call_to_action_asset = 'call_to_action_asset' + coarse_conversion_value = 'coarse_conversion_value' country = 'country' description_asset = 'description_asset' device_platform = 'device_platform' dma = 'dma' + fidelity_type = 'fidelity_type' frequency_value = 'frequency_value' gender = 'gender' hourly_stats_aggregated_by_advertiser_time_zone = 'hourly_stats_aggregated_by_advertiser_time_zone' hourly_stats_aggregated_by_audience_time_zone = 'hourly_stats_aggregated_by_audience_time_zone' + hsid = 'hsid' image_asset = 'image_asset' impression_device = 'impression_device' is_conversion_id_modeled = 'is_conversion_id_modeled' @@ -222,8 +226,10 @@ class Breakdowns: mmm = 'mmm' place_page_id = 'place_page_id' platform_position = 'platform_position' + postback_sequence_index = 'postback_sequence_index' product_id = 'product_id' publisher_platform = 'publisher_platform' + redownload = 'redownload' region = 'region' skan_campaign_id = 'skan_campaign_id' skan_conversion_id = 'skan_conversion_id' @@ -281,12 +287,10 @@ def get_endpoint(cls): 'account_name': 'string', 'action_values': 'list', 'actions': 'list', - 'ad_bid_value': 'string', 'ad_click_actions': 'list', 'ad_id': 'string', 'ad_impression_actions': 'list', 'ad_name': 'string', - 'adset_bid_value': 'string', 'adset_end': 'string', 'adset_id': 'string', 'adset_name': 'string', @@ -333,6 +337,7 @@ def get_endpoint(cls): 'cpm': 'string', 'cpp': 'string', 'created_time': 'string', + 'creative_media_type': 'string', 'ctr': 'string', 'date_start': 'string', 'date_stop': 'string', @@ -353,6 +358,7 @@ def get_endpoint(cls): 'inline_link_click_ctr': 'string', 'inline_link_clicks': 'string', 'inline_post_engagement': 'string', + 'instagram_upcoming_event_reminders_set': 'string', 'instant_experience_clicks_to_open': 'string', 'instant_experience_clicks_to_start': 'string', 'instant_experience_outbound_clicks': 'list', @@ -376,6 +382,7 @@ def get_endpoint(cls): 'spend': 'string', 'total_postbacks': 'string', 'total_postbacks_detailed': 'list', + 'total_postbacks_detailed_v4': 'string', 'unique_actions': 'list', 'unique_clicks': 'string', 'unique_conversions': 'list', diff --git a/facebook_business/adobjects/adsoptimaldeliverygrowthopportunity.py b/facebook_business/adobjects/adsoptimaldeliverygrowthopportunity.py index 1e6747cbe..2659bbd63 100644 --- a/facebook_business/adobjects/adsoptimaldeliverygrowthopportunity.py +++ b/facebook_business/adobjects/adsoptimaldeliverygrowthopportunity.py @@ -43,7 +43,7 @@ class Field(AbstractObject.Field): optimization_type = 'optimization_type' _field_types = { - 'child_metadata': 'map', + 'child_metadata': 'list>', 'metadata': 'Object', 'optimization_type': 'string', } diff --git a/facebook_business/adobjects/adspixel.py b/facebook_business/adobjects/adspixel.py index 92f8ad64e..a45811b30 100644 --- a/facebook_business/adobjects/adspixel.py +++ b/facebook_business/adobjects/adspixel.py @@ -456,6 +456,37 @@ def get_offline_event_uploads(self, fields=None, params=None, batch=None, succes self.assure_call() return request.execute() + def get_open_bridge_configurations(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.openbridgeconfiguration import OpenBridgeConfiguration + param_types = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/openbridge_configurations', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=OpenBridgeConfiguration, + api_type='EDGE', + response_parser=ObjectParser(target_class=OpenBridgeConfiguration, 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_shadow_traffic_helper(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): diff --git a/facebook_business/adobjects/adstudyobjective.py b/facebook_business/adobjects/adstudyobjective.py index b7738409d..e66147464 100644 --- a/facebook_business/adobjects/adstudyobjective.py +++ b/facebook_business/adobjects/adstudyobjective.py @@ -202,6 +202,37 @@ def get_applications(self, fields=None, params=None, batch=None, success=None, f self.assure_call() return request.execute() + def get_brand_requests(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.brandrequest import BrandRequest + param_types = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/brand_requests', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=BrandRequest, + api_type='EDGE', + response_parser=ObjectParser(target_class=BrandRequest, 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_custom_conversions(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): @@ -264,6 +295,37 @@ def get_offline_conversion_data_sets(self, fields=None, params=None, batch=None, self.assure_call() return request.execute() + def get_partner_private_studies(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.business import Business + param_types = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/partner_private_studies', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=Business, + api_type='EDGE', + response_parser=ObjectParser(target_class=Business, 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_partner_studies(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): diff --git a/facebook_business/adobjects/advideo.py b/facebook_business/adobjects/advideo.py index 25facc068..f18171854 100644 --- a/facebook_business/adobjects/advideo.py +++ b/facebook_business/adobjects/advideo.py @@ -198,6 +198,7 @@ class ContainerType: event_cover_video = 'EVENT_COVER_VIDEO' event_tour = 'EVENT_TOUR' facecast_dvr = 'FACECAST_DVR' + fb_avatar_animated_satp = 'FB_AVATAR_ANIMATED_SATP' fb_collectible_video = 'FB_COLLECTIBLE_VIDEO' fb_shorts = 'FB_SHORTS' fb_shorts_content_remixable = 'FB_SHORTS_CONTENT_REMIXABLE' @@ -586,6 +587,67 @@ def create_caption(self, fields=None, params=None, batch=None, success=None, fai self.assure_call() return request.execute() + def get_collaborators(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 = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/collaborators', + 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() + + def create_collaborator(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 = { + 'target_id': 'string', + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='POST', + endpoint='/collaborators', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=AdVideo, + api_type='EDGE', + response_parser=ObjectParser(target_class=AdVideo, 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_comments(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): diff --git a/facebook_business/adobjects/application.py b/facebook_business/adobjects/application.py index 843eefaba..dce7bda41 100644 --- a/facebook_business/adobjects/application.py +++ b/facebook_business/adobjects/application.py @@ -190,6 +190,7 @@ class PostMethod: eymt = 'EYMT' class LoggingSource: + detection = 'DETECTION' messenger_bot = 'MESSENGER_BOT' class LoggingTarget: @@ -800,8 +801,9 @@ def create_aem_skan_readiness(self, fields=None, params=None, batch=None, succes param_types = { 'app_id': 'int', 'is_aem_ready': 'bool', - 'is_aem_v2_ready': 'bool', + 'is_app_aem_ready': 'bool', 'is_skan_ready': 'bool', + 'message': 'string', } enums = { } @@ -1439,6 +1441,36 @@ def get_ios_dialog_configs(self, fields=None, params=None, batch=None, success=N self.assure_call() return request.execute() + def get_linked_dataset(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 = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/linked_dataset', + 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() + def create_mmp_auditing(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): diff --git a/facebook_business/adobjects/commercemerchanttosacceptance.py b/facebook_business/adobjects/brandrequest.py similarity index 65% rename from facebook_business/adobjects/commercemerchanttosacceptance.py rename to facebook_business/adobjects/brandrequest.py index 8035247af..9a120e2dd 100644 --- a/facebook_business/adobjects/commercemerchanttosacceptance.py +++ b/facebook_business/adobjects/brandrequest.py @@ -32,17 +32,36 @@ pull request for this class. """ -class CommerceMerchantTOSAcceptance( +class BrandRequest( AbstractCrudObject, ): def __init__(self, fbid=None, parent_id=None, api=None): - self._isCommerceMerchantTOSAcceptance = True - super(CommerceMerchantTOSAcceptance, self).__init__(fbid, parent_id, api) + self._isBrandRequest = True + super(BrandRequest, self).__init__(fbid, parent_id, api) class Field(AbstractObject.Field): - business = 'business' + ad_countries = 'ad_countries' + additional_contacts = 'additional_contacts' + approval_level = 'approval_level' + cells = 'cells' + countries = 'countries' + deny_reason = 'deny_reason' + end_time = 'end_time' + estimated_reach = 'estimated_reach' id = 'id' + is_multicell = 'is_multicell' + locale = 'locale' + max_age = 'max_age' + min_age = 'min_age' + questions = 'questions' + region = 'region' + request_status = 'request_status' + review_date = 'review_date' + start_time = 'start_time' + status = 'status' + submit_date = 'submit_date' + total_budget = 'total_budget' def api_get(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils @@ -58,7 +77,7 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No endpoint='/', api=self._api, param_checker=TypeChecker(param_types, enums), - target_class=CommerceMerchantTOSAcceptance, + target_class=BrandRequest, api_type='NODE', response_parser=ObjectParser(reuse_object=self), ) @@ -75,8 +94,27 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No return request.execute() _field_types = { - 'business': 'Business', + 'ad_countries': 'list', + 'additional_contacts': 'list', + 'approval_level': 'unsigned int', + 'cells': 'list', + 'countries': 'list', + 'deny_reason': 'string', + 'end_time': 'datetime', + 'estimated_reach': 'unsigned int', 'id': 'string', + 'is_multicell': 'bool', + 'locale': 'string', + 'max_age': 'unsigned int', + 'min_age': 'unsigned int', + 'questions': 'list', + 'region': 'string', + 'request_status': 'string', + 'review_date': 'datetime', + 'start_time': 'datetime', + 'status': 'string', + 'submit_date': 'datetime', + 'total_budget': 'unsigned int', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/business.py b/facebook_business/adobjects/business.py index 827f8276b..e86221fbf 100644 --- a/facebook_business/adobjects/business.py +++ b/facebook_business/adobjects/business.py @@ -607,6 +607,37 @@ def create_ad_account(self, fields=None, params=None, batch=None, success=None, self.assure_call() return request.execute() + def create_add_phone_number(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 = { + 'phone_number': 'string', + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='POST', + endpoint='/add_phone_numbers', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=Business, + api_type='EDGE', + response_parser=ObjectParser(target_class=Business, 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_ad_network_application(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): @@ -2455,6 +2486,74 @@ def create_offline_conversion_data_set(self, fields=None, params=None, batch=Non self.assure_call() return request.execute() + def get_open_bridge_configurations(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.openbridgeconfiguration import OpenBridgeConfiguration + param_types = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/openbridge_configurations', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=OpenBridgeConfiguration, + api_type='EDGE', + response_parser=ObjectParser(target_class=OpenBridgeConfiguration, 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_open_bridge_configuration(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.openbridgeconfiguration import OpenBridgeConfiguration + param_types = { + 'access_key': 'string', + 'active': 'bool', + 'endpoint': 'string', + 'host_business_id': 'unsigned int', + 'host_external_id': 'string', + 'pixel_id': 'unsigned int', + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='POST', + endpoint='/openbridge_configurations', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=OpenBridgeConfiguration, + api_type='EDGE', + response_parser=ObjectParser(target_class=OpenBridgeConfiguration, 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_owned_ad_accounts(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): @@ -3297,6 +3396,40 @@ def create_pixel_to(self, fields=None, params=None, batch=None, success=None, fa self.assure_call() return request.execute() + def get_pre_verified_numbers(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.whatsappbusinesspreverifiedphonenumber import WhatsAppBusinessPreVerifiedPhoneNumber + param_types = { + 'code_verification_status': 'code_verification_status_enum', + 'phone_number': 'string', + } + enums = { + 'code_verification_status_enum': WhatsAppBusinessPreVerifiedPhoneNumber.CodeVerificationStatus.__dict__.values(), + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/preverified_numbers', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=WhatsAppBusinessPreVerifiedPhoneNumber, + api_type='EDGE', + response_parser=ObjectParser(target_class=WhatsAppBusinessPreVerifiedPhoneNumber, 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_received_audience_sharing_requests(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): diff --git a/facebook_business/adobjects/campaign.py b/facebook_business/adobjects/campaign.py index 1ec207f35..3fd2978bf 100644 --- a/facebook_business/adobjects/campaign.py +++ b/facebook_business/adobjects/campaign.py @@ -46,8 +46,6 @@ def __init__(self, fbid=None, parent_id=None, api=None): class Field(AbstractObject.Field): account_id = 'account_id' - ad_strategy_group_id = 'ad_strategy_group_id' - ad_strategy_id = 'ad_strategy_id' adlabels = 'adlabels' bid_strategy = 'bid_strategy' boosted_object_id = 'boosted_object_id' @@ -88,7 +86,6 @@ class Field(AbstractObject.Field): adbatch = 'adbatch' execution_options = 'execution_options' iterative_split_test_configs = 'iterative_split_test_configs' - upstream_events = 'upstream_events' class BidStrategy: cost_cap = 'COST_CAP' @@ -569,7 +566,6 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure 'start_time': 'datetime', 'status': 'status_enum', 'stop_time': 'datetime', - 'upstream_events': 'map', } enums = { 'bid_strategy_enum': Campaign.BidStrategy.__dict__.values(), @@ -973,8 +969,6 @@ def get_insights_async(self, fields=None, params=None, batch=None, success=None, _field_types = { 'account_id': 'string', - 'ad_strategy_group_id': 'string', - 'ad_strategy_id': 'string', 'adlabels': 'list', 'bid_strategy': 'BidStrategy', 'boosted_object_id': 'string', @@ -1015,7 +1009,6 @@ def get_insights_async(self, fields=None, params=None, batch=None, success=None, 'adbatch': 'list', 'execution_options': 'list', 'iterative_split_test_configs': 'list', - 'upstream_events': 'map', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/canvas.py b/facebook_business/adobjects/canvas.py index 55449cfaf..78ca3b75f 100644 --- a/facebook_business/adobjects/canvas.py +++ b/facebook_business/adobjects/canvas.py @@ -136,7 +136,7 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure self.assure_call() return request.execute() - def get_previews(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): + def get_pre_views(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.') diff --git a/facebook_business/adobjects/catalogitemappealstatus.py b/facebook_business/adobjects/catalogitemappealstatus.py index 0d7e1144c..516c6a0a1 100644 --- a/facebook_business/adobjects/catalogitemappealstatus.py +++ b/facebook_business/adobjects/catalogitemappealstatus.py @@ -43,15 +43,23 @@ class Field(AbstractObject.Field): status = 'status' use_cases = 'use_cases' + class Status: + this_item_cannot_be_appealed_as_it_is_either_approved_or_already_has_an_appeal = 'This item cannot be appealed as it is either approved or already has an appeal' + this_item_is_not_rejected_for_any_of_channels = 'This item is not rejected for any of channels' + we_ve_encountered_unexpected_error_while_processing_this_request_please_try_again_later_ = 'We've encountered unexpected error while processing this request. Please try again later !' + you_ve_reached_the_maximum_number_of_item_requests_you_can_make_this_week_you_ll_be_able_to_request_item_reviews_again_within_the_next_7_days_ = 'You've reached the maximum number of item requests you can make this week. You'll be able to request item reviews again within the next 7 days.' + your_request_was_received_see_information_below_to_learn_more_ = 'Your request was received. See information below to learn more.' + _field_types = { 'handle': 'string', 'item_id': 'int', - 'status': 'string', + 'status': 'Status', 'use_cases': 'list', } @classmethod def _get_field_enum_info(cls): field_enum_info = {} + field_enum_info['Status'] = CatalogItemAppealStatus.Status.__dict__.values() return field_enum_info diff --git a/facebook_business/adobjects/commercemerchantsettings.py b/facebook_business/adobjects/commercemerchantsettings.py index b93146582..bfa1dc719 100644 --- a/facebook_business/adobjects/commercemerchantsettings.py +++ b/facebook_business/adobjects/commercemerchantsettings.py @@ -644,12 +644,12 @@ def create_whatsapp_channel(self, fields=None, params=None, batch=None, success= 'merchant_status': 'string', 'onsite_commerce_merchant': 'Object', 'payment_provider': 'string', - 'privacy_url_by_locale': 'map', + 'privacy_url_by_locale': 'list>', 'review_rejection_messages': 'list', 'review_rejection_reasons': 'list', 'supported_card_types': 'list', 'terms': 'string', - 'terms_url_by_locale': 'map', + 'terms_url_by_locale': 'list>', 'whatsapp_channel': 'Object', } @classmethod diff --git a/facebook_business/adobjects/cpasbusinesssetupconfig.py b/facebook_business/adobjects/cpasbusinesssetupconfig.py index 4616858c8..8b3490e8d 100644 --- a/facebook_business/adobjects/cpasbusinesssetupconfig.py +++ b/facebook_business/adobjects/cpasbusinesssetupconfig.py @@ -122,8 +122,8 @@ def get_ad_accounts(self, fields=None, params=None, batch=None, success=None, fa _field_types = { 'accepted_collab_ads_tos': 'bool', 'business': 'Business', - 'business_capabilities_status': 'map', - 'capabilities_compliance_status': 'map', + 'business_capabilities_status': 'list>', + 'capabilities_compliance_status': 'list>', 'id': 'string', 'ad_accounts': 'list', } diff --git a/facebook_business/adobjects/cpasmerchantconfig.py b/facebook_business/adobjects/cpasmerchantconfig.py index 65f1a991c..e253a1204 100644 --- a/facebook_business/adobjects/cpasmerchantconfig.py +++ b/facebook_business/adobjects/cpasmerchantconfig.py @@ -82,10 +82,10 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No _field_types = { 'accepted_tos': 'bool', 'beta_features': 'list', - 'business_outcomes_status': 'map', + 'business_outcomes_status': 'list>', 'id': 'string', 'is_test_merchant': 'bool', - 'outcomes_compliance_status': 'map', + 'outcomes_compliance_status': 'list>', 'qualified_to_onboard': 'bool', } @classmethod diff --git a/facebook_business/adobjects/customaudience.py b/facebook_business/adobjects/customaudience.py index 5c290256c..0efa269de 100644 --- a/facebook_business/adobjects/customaudience.py +++ b/facebook_business/adobjects/customaudience.py @@ -100,6 +100,7 @@ class Field(AbstractObject.Field): partner_reference_key = 'partner_reference_key' prefill = 'prefill' product_set_id = 'product_set_id' + use_in_campaigns = 'use_in_campaigns' video_group_ids = 'video_group_ids' class ClaimObjective: @@ -135,6 +136,7 @@ class CustomerFileSource: class Subtype: app = 'APP' bag_of_accounts = 'BAG_OF_ACCOUNTS' + bidding = 'BIDDING' claim = 'CLAIM' custom = 'CUSTOM' engagement = 'ENGAGEMENT' @@ -144,6 +146,7 @@ class Subtype: measurement = 'MEASUREMENT' offline_conversion = 'OFFLINE_CONVERSION' partner = 'PARTNER' + primary = 'PRIMARY' regulated_categories_audience = 'REGULATED_CATEGORIES_AUDIENCE' study_rule_audience = 'STUDY_RULE_AUDIENCE' video = 'VIDEO' @@ -251,6 +254,7 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure 'rule': 'string', 'rule_aggregation': 'string', 'tags': 'list', + 'use_in_campaigns': 'bool', } enums = { 'claim_objective_enum': CustomAudience.ClaimObjective.__dict__.values(), @@ -629,6 +633,7 @@ def create_users_replace(self, fields=None, params=None, batch=None, success=Non 'partner_reference_key': 'string', 'prefill': 'bool', 'product_set_id': 'string', + 'use_in_campaigns': 'bool', 'video_group_ids': 'list', } @classmethod diff --git a/facebook_business/adobjects/customaudiencedatasource.py b/facebook_business/adobjects/customaudiencedatasource.py index bbe3b2dab..afcc7f5d6 100644 --- a/facebook_business/adobjects/customaudiencedatasource.py +++ b/facebook_business/adobjects/customaudiencedatasource.py @@ -45,6 +45,7 @@ class Field(AbstractObject.Field): class SubType: anything = 'ANYTHING' app_users = 'APP_USERS' + ar_effects_events = 'AR_EFFECTS_EVENTS' ar_experience_events = 'AR_EXPERIENCE_EVENTS' campaign_conversions = 'CAMPAIGN_CONVERSIONS' combination_custom_audience_users = 'COMBINATION_CUSTOM_AUDIENCE_USERS' @@ -91,6 +92,7 @@ class SubType: signal_source = 'SIGNAL_SOURCE' smart_audience = 'SMART_AUDIENCE' store_visit_events = 'STORE_VISIT_EVENTS' + subscriber_list = 'SUBSCRIBER_LIST' s_expr = 'S_EXPR' tokens = 'TOKENS' user_ids = 'USER_IDS' diff --git a/facebook_business/adobjects/adaccountcustomaudience.py b/facebook_business/adobjects/customaudiencegroup.py similarity index 93% rename from facebook_business/adobjects/adaccountcustomaudience.py rename to facebook_business/adobjects/customaudiencegroup.py index 3f938e902..0d4bbda11 100644 --- a/facebook_business/adobjects/adaccountcustomaudience.py +++ b/facebook_business/adobjects/customaudiencegroup.py @@ -28,13 +28,13 @@ pull request for this class. """ -class AdAccountCustomAudience( +class CustomAudienceGroup( AbstractObject, ): def __init__(self, api=None): - super(AdAccountCustomAudience, self).__init__() - self._isAdAccountCustomAudience = True + super(CustomAudienceGroup, self).__init__() + self._isCustomAudienceGroup = True self._api = api class Field(AbstractObject.Field): diff --git a/facebook_business/adobjects/extendedcreditinvoicegroup.py b/facebook_business/adobjects/extendedcreditinvoicegroup.py index dd408648d..a325f57cb 100644 --- a/facebook_business/adobjects/extendedcreditinvoicegroup.py +++ b/facebook_business/adobjects/extendedcreditinvoicegroup.py @@ -51,6 +51,36 @@ class Field(AbstractObject.Field): name = 'name' sold_to_address = 'sold_to_address' + def api_delete(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 = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='DELETE', + endpoint='/', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=AbstractCrudObject, + api_type='NODE', + response_parser=ObjectParser(reuse_object=self), + ) + 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 api_get(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): diff --git a/facebook_business/adobjects/group.py b/facebook_business/adobjects/group.py index e73d53213..1b3de2dc0 100644 --- a/facebook_business/adobjects/group.py +++ b/facebook_business/adobjects/group.py @@ -1076,44 +1076,6 @@ def get_picture(self, fields=None, params=None, batch=None, success=None, failur self.assure_call() return request.execute() - def create_shift_setting(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 = { - 'external_id': 'string', - 'shift_feature_setting': 'shift_feature_setting_enum', - } - enums = { - 'shift_feature_setting_enum': [ - 'ALL_FEATURES_OFF', - 'ALL_FEATURES_ON', - 'SHIFT_COVER_ONLY_ON', - 'SHIFT_VIEWER_ONLY_ON', - ], - } - request = FacebookRequest( - node_id=self['id'], - method='POST', - endpoint='/shift_settings', - 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() - def get_videos(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): diff --git a/facebook_business/adobjects/iguser.py b/facebook_business/adobjects/iguser.py index 537aa7590..1f3e80d01 100644 --- a/facebook_business/adobjects/iguser.py +++ b/facebook_business/adobjects/iguser.py @@ -300,6 +300,7 @@ def create_media(self, fields=None, params=None, batch=None, success=None, failu api_utils.warning('`success` and `failure` callback only work for batch call.') from facebook_business.adobjects.igmedia import IGMedia param_types = { + 'audio_name': 'string', 'caption': 'string', 'children': 'list', 'cover_url': 'string', diff --git a/facebook_business/adobjects/instantarticlesstats.py b/facebook_business/adobjects/instantarticlesstats.py index 5850c05d5..364000a83 100644 --- a/facebook_business/adobjects/instantarticlesstats.py +++ b/facebook_business/adobjects/instantarticlesstats.py @@ -46,10 +46,10 @@ class Field(AbstractObject.Field): _field_types = { 'error': 'string', - 'metadata': 'map', + 'metadata': 'list>', 'metric': 'Object', - 'totals': 'map', - 'x_axis_breakdown': 'list>', + 'totals': 'list>', + 'x_axis_breakdown': 'list>>', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/jobopening.py b/facebook_business/adobjects/jobopening.py new file mode 100644 index 000000000..d1205b27d --- /dev/null +++ b/facebook_business/adobjects/jobopening.py @@ -0,0 +1,162 @@ +# Copyright 2014 Facebook, Inc. + +# You are hereby granted a non-exclusive, worldwide, royalty-free license to +# use, copy, modify, and distribute this software in source code or binary +# form for use in connection with the web services and APIs provided by +# Facebook. + +# As with any software that integrates with the Facebook platform, your use +# of this software is subject to the Facebook Developer Principles and +# Policies [http://developers.facebook.com/policy/]. This copyright notice +# shall be included in all copies or substantial portions of the software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. + +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. + +For any issues or feature requests related to this class, please let us know on +github and we'll fix in our codegen framework. We'll not be able to accept +pull request for this class. +""" + +class JobOpening( + AbstractCrudObject, +): + + def __init__(self, fbid=None, parent_id=None, api=None): + self._isJobOpening = True + super(JobOpening, self).__init__(fbid, parent_id, api) + + class Field(AbstractObject.Field): + address = 'address' + application_callback_url = 'application_callback_url' + created_time = 'created_time' + description = 'description' + errors = 'errors' + external_company_facebook_url = 'external_company_facebook_url' + external_company_full_address = 'external_company_full_address' + external_company_id = 'external_company_id' + external_company_name = 'external_company_name' + external_id = 'external_id' + id = 'id' + job_status = 'job_status' + latitude = 'latitude' + longitude = 'longitude' + offsite_application_url = 'offsite_application_url' + page = 'page' + photo = 'photo' + platform_review_status = 'platform_review_status' + post = 'post' + remote_type = 'remote_type' + review_rejection_reasons = 'review_rejection_reasons' + title = 'title' + type = 'type' + + class JobStatus: + closed = 'CLOSED' + draft = 'DRAFT' + open = 'OPEN' + provisional = 'PROVISIONAL' + + class PlatformReviewStatus: + approved = 'APPROVED' + pending = 'PENDING' + rejected = 'REJECTED' + + class ReviewRejectionReasons: + adult_content = 'ADULT_CONTENT' + discrimination = 'DISCRIMINATION' + drugs = 'DRUGS' + generic_default = 'GENERIC_DEFAULT' + illegal = 'ILLEGAL' + impersonation = 'IMPERSONATION' + misleading = 'MISLEADING' + multilevel_marketing = 'MULTILEVEL_MARKETING' + personal_info = 'PERSONAL_INFO' + sexual = 'SEXUAL' + + class Type: + contract = 'CONTRACT' + full_time = 'FULL_TIME' + internship = 'INTERNSHIP' + part_time = 'PART_TIME' + volunteer = 'VOLUNTEER' + + def api_get(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 = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/', + api=self._api, + param_checker=TypeChecker(param_types, enums), + target_class=JobOpening, + api_type='NODE', + response_parser=ObjectParser(reuse_object=self), + ) + 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() + + _field_types = { + 'address': 'string', + 'application_callback_url': 'string', + 'created_time': 'datetime', + 'description': 'string', + 'errors': 'list', + 'external_company_facebook_url': 'string', + 'external_company_full_address': 'string', + 'external_company_id': 'string', + 'external_company_name': 'string', + 'external_id': 'string', + 'id': 'string', + 'job_status': 'JobStatus', + 'latitude': 'float', + 'longitude': 'float', + 'offsite_application_url': 'string', + 'page': 'Page', + 'photo': 'Photo', + 'platform_review_status': 'PlatformReviewStatus', + 'post': 'Post', + 'remote_type': 'string', + 'review_rejection_reasons': 'list', + 'title': 'string', + 'type': 'Type', + } + @classmethod + def _get_field_enum_info(cls): + field_enum_info = {} + field_enum_info['JobStatus'] = JobOpening.JobStatus.__dict__.values() + field_enum_info['PlatformReviewStatus'] = JobOpening.PlatformReviewStatus.__dict__.values() + field_enum_info['ReviewRejectionReasons'] = JobOpening.ReviewRejectionReasons.__dict__.values() + field_enum_info['Type'] = JobOpening.Type.__dict__.values() + return field_enum_info + + diff --git a/facebook_business/adobjects/lead.py b/facebook_business/adobjects/lead.py index 7b4ba1669..501d948b6 100644 --- a/facebook_business/adobjects/lead.py +++ b/facebook_business/adobjects/lead.py @@ -57,6 +57,7 @@ class Field(AbstractObject.Field): partner_name = 'partner_name' platform = 'platform' post = 'post' + post_submission_check_result = 'post_submission_check_result' retailer_item_id = 'retailer_item_id' vehicle = 'vehicle' @@ -142,6 +143,7 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No 'partner_name': 'string', 'platform': 'string', 'post': 'Link', + 'post_submission_check_result': 'LeadGenPostSubmissionCheckResult', 'retailer_item_id': 'string', 'vehicle': 'Vehicle', } diff --git a/facebook_business/adobjects/leadgenform.py b/facebook_business/adobjects/leadgenform.py index 0d351efa9..849dea0d2 100644 --- a/facebook_business/adobjects/leadgenform.py +++ b/facebook_business/adobjects/leadgenform.py @@ -290,7 +290,7 @@ def create_test_lead(self, fields=None, params=None, batch=None, success=None, f 'questions': 'list', 'status': 'string', 'thank_you_page': 'Object', - 'tracking_parameters': 'map', + 'tracking_parameters': 'list>', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/mediatitle.py b/facebook_business/adobjects/mediatitle.py index bd48070f0..24c8c3fcb 100644 --- a/facebook_business/adobjects/mediatitle.py +++ b/facebook_business/adobjects/mediatitle.py @@ -80,16 +80,6 @@ class ContentCategory: music = 'MUSIC' tv_show = 'TV_SHOW' - # @deprecated get_endpoint function is deprecated - @classmethod - def get_endpoint(cls): - return 'media_titles' - - # @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.productcatalog import ProductCatalog - return ProductCatalog(api=self._api, fbid=parent_id).create_media_title(fields, params, batch, success, failure, pending) - def api_delete(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): diff --git a/facebook_business/adobjects/offlineconversiondataset.py b/facebook_business/adobjects/offlineconversiondataset.py index b86fe3b8f..2a2575da6 100644 --- a/facebook_business/adobjects/offlineconversiondataset.py +++ b/facebook_business/adobjects/offlineconversiondataset.py @@ -389,42 +389,6 @@ def get_custom_conversions(self, fields=None, params=None, batch=None, success=N self.assure_call() return request.execute() - def create_event(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 = { - 'data': 'list', - 'namespace_id': 'string', - 'progress': 'Object', - 'upload_id': 'string', - 'upload_source': 'string', - 'upload_tag': 'string', - } - enums = { - } - request = FacebookRequest( - node_id=self['id'], - method='POST', - endpoint='/events', - 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() - def get_server_events_permitted_business(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): diff --git a/facebook_business/adobjects/instantarticle.py b/facebook_business/adobjects/openbridgeconfiguration.py similarity index 72% rename from facebook_business/adobjects/instantarticle.py rename to facebook_business/adobjects/openbridgeconfiguration.py index f0410447c..58fe7db8f 100644 --- a/facebook_business/adobjects/instantarticle.py +++ b/facebook_business/adobjects/openbridgeconfiguration.py @@ -32,24 +32,32 @@ pull request for this class. """ -class InstantArticle( +class OpenBridgeConfiguration( AbstractCrudObject, ): def __init__(self, fbid=None, parent_id=None, api=None): - self._isInstantArticle = True - super(InstantArticle, self).__init__(fbid, parent_id, api) + self._isOpenBridgeConfiguration = True + super(OpenBridgeConfiguration, self).__init__(fbid, parent_id, api) class Field(AbstractObject.Field): - canonical_url = 'canonical_url' - development_mode = 'development_mode' - html_source = 'html_source' + access_key = 'access_key' + active = 'active' + endpoint = 'endpoint' + host_business_id = 'host_business_id' + host_external_id = 'host_external_id' id = 'id' - most_recent_import_status = 'most_recent_import_status' - photos = 'photos' - publish_status = 'publish_status' - published = 'published' - videos = 'videos' + pixel_id = 'pixel_id' + + # @deprecated get_endpoint function is deprecated + @classmethod + def get_endpoint(cls): + return 'openbridge_configurations' + + # @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.business import Business + return Business(api=self._api, fbid=parent_id).create_open_bridge_configuration(fields, params, batch, success, failure, pending) def api_delete(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): from facebook_business.utils import api_utils @@ -95,7 +103,7 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No endpoint='/', api=self._api, param_checker=TypeChecker(param_types, enums), - target_class=InstantArticle, + target_class=OpenBridgeConfiguration, api_type='NODE', response_parser=ObjectParser(reuse_object=self), ) @@ -111,34 +119,28 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No self.assure_call() return request.execute() - def get_insights(self, fields=None, params=None, is_async=False, batch=None, success=None, failure=None, pending=False): + def api_update(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.instantarticleinsightsqueryresult import InstantArticleInsightsQueryResult - if is_async: - return self.get_insights_async(fields, params, batch, success, failure, pending) param_types = { - 'breakdown': 'breakdown_enum', - 'metric': 'list', - 'period': 'period_enum', - 'since': 'datetime', - 'until': 'datetime', + 'access_key': 'string', + 'active': 'bool', + 'endpoint': 'string', + 'host_business_id': 'unsigned int', + 'host_external_id': 'string', } enums = { - 'breakdown_enum': InstantArticleInsightsQueryResult.Breakdown.__dict__.values(), - 'period_enum': InstantArticleInsightsQueryResult.Period.__dict__.values(), } request = FacebookRequest( node_id=self['id'], - method='GET', - endpoint='/insights', + method='POST', + endpoint='/', api=self._api, param_checker=TypeChecker(param_types, enums), - target_class=InstantArticleInsightsQueryResult, - api_type='EDGE', - response_parser=ObjectParser(target_class=InstantArticleInsightsQueryResult, api=self._api), - include_summary=False, + target_class=OpenBridgeConfiguration, + api_type='NODE', + response_parser=ObjectParser(reuse_object=self), ) request.add_params(params) request.add_fields(fields) @@ -153,15 +155,13 @@ def get_insights(self, fields=None, params=None, is_async=False, batch=None, suc return request.execute() _field_types = { - 'canonical_url': 'string', - 'development_mode': 'bool', - 'html_source': 'string', + 'access_key': 'string', + 'active': 'bool', + 'endpoint': 'string', + 'host_business_id': 'string', + 'host_external_id': 'string', 'id': 'string', - 'most_recent_import_status': 'Object', - 'photos': 'list', - 'publish_status': 'string', - 'published': 'bool', - 'videos': 'list', + 'pixel_id': 'string', } @classmethod def _get_field_enum_info(cls): diff --git a/facebook_business/adobjects/page.py b/facebook_business/adobjects/page.py index c9ba3ee44..5c17896bd 100644 --- a/facebook_business/adobjects/page.py +++ b/facebook_business/adobjects/page.py @@ -101,7 +101,6 @@ class Field(AbstractObject.Field): impressum = 'impressum' influences = 'influences' instagram_business_account = 'instagram_business_account' - instant_articles_review_status = 'instant_articles_review_status' is_always_open = 'is_always_open' is_chain = 'is_chain' is_community_page = 'is_community_page' @@ -175,7 +174,6 @@ class Field(AbstractObject.Field): store_number = 'store_number' studio = 'studio' supports_donate_button_in_live_video = 'supports_donate_button_in_live_video' - supports_instant_articles = 'supports_instant_articles' talking_about_count = 'talking_about_count' temporary_status = 'temporary_status' unread_message_count = 'unread_message_count' @@ -393,10 +391,6 @@ class UnpublishedContentType: scheduled = 'SCHEDULED' scheduled_recurring = 'SCHEDULED_RECURRING' - class PublishStatus: - draft = 'DRAFT' - live = 'LIVE' - class MessagingType: message_tag = 'MESSAGE_TAG' response = 'RESPONSE' @@ -414,6 +408,11 @@ class SenderAction: typing_on = 'TYPING_ON' unreact = 'UNREACT' + class SuggestionAction: + accept = 'ACCEPT' + dismiss = 'DISMISS' + impression = 'IMPRESSION' + class Platform: instagram = 'INSTAGRAM' messenger = 'MESSENGER' @@ -466,9 +465,12 @@ class SubscribedFields: founded = 'founded' general_info = 'general_info' general_manager = 'general_manager' + group_feed = 'group_feed' hometown = 'hometown' hours = 'hours' + in_thread_lead_form_submit = 'in_thread_lead_form_submit' inbox_labels = 'inbox_labels' + invoice_access_bank_slip_events = 'invoice_access_bank_slip_events' invoice_access_invoice_change = 'invoice_access_invoice_change' invoice_access_invoice_draft_change = 'invoice_access_invoice_draft_change' invoice_access_onboarding_status_active = 'invoice_access_onboarding_status_active' @@ -481,6 +483,7 @@ class SubscribedFields: members = 'members' mention = 'mention' merchant_review = 'merchant_review' + message_context = 'message_context' message_deliveries = 'message_deliveries' message_echoes = 'message_echoes' message_mention = 'message_mention' @@ -521,6 +524,7 @@ class SubscribedFields: publisher_subscriptions = 'publisher_subscriptions' ratings = 'ratings' registration = 'registration' + send_cart = 'send_cart' standby = 'standby' user_action = 'user_action' video_text_question_responses = 'video_text_question_responses' @@ -594,7 +598,6 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure 'hours': 'map', 'ignore_coordinate_warnings': 'bool', 'impressum': 'string', - 'instant_articles_submit_for_review': 'bool', 'is_always_open': 'bool', 'is_permanently_closed': 'bool', 'is_published': 'bool', @@ -1214,6 +1217,7 @@ def create_canvas_element(self, fields=None, params=None, batch=None, success=No 'canvas_product_list': 'Object', 'canvas_product_set': 'Object', 'canvas_store_locator': 'Object', + 'canvas_template_video': 'Object', 'canvas_text': 'Object', 'canvas_video': 'Object', } @@ -1391,37 +1395,6 @@ def create_chat_plugin(self, fields=None, params=None, batch=None, success=None, self.assure_call() return request.execute() - def get_claimed_urls(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.url import URL - param_types = { - } - enums = { - } - request = FacebookRequest( - node_id=self['id'], - method='GET', - endpoint='/claimed_urls', - api=self._api, - param_checker=TypeChecker(param_types, enums), - target_class=URL, - api_type='EDGE', - response_parser=ObjectParser(target_class=URL, 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_commerce_eligibility(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): @@ -2401,144 +2374,6 @@ def get_instagram_accounts(self, fields=None, params=None, batch=None, success=N self.assure_call() return request.execute() - def get_instant_articles(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.instantarticle import InstantArticle - param_types = { - 'development_mode': 'bool', - } - enums = { - } - request = FacebookRequest( - node_id=self['id'], - method='GET', - endpoint='/instant_articles', - api=self._api, - param_checker=TypeChecker(param_types, enums), - target_class=InstantArticle, - api_type='EDGE', - response_parser=ObjectParser(target_class=InstantArticle, 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_instant_article(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.instantarticle import InstantArticle - param_types = { - 'development_mode': 'bool', - 'html_source': 'string', - 'published': 'bool', - 'take_live': 'bool', - } - enums = { - } - request = FacebookRequest( - node_id=self['id'], - method='POST', - endpoint='/instant_articles', - api=self._api, - param_checker=TypeChecker(param_types, enums), - target_class=InstantArticle, - api_type='EDGE', - response_parser=ObjectParser(target_class=InstantArticle, 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_instant_articles_insights(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.instantarticleinsightsqueryresult import InstantArticleInsightsQueryResult - param_types = { - 'breakdown': 'breakdown_enum', - 'metric': 'list', - 'period': 'period_enum', - 'since': 'datetime', - 'until': 'datetime', - } - enums = { - 'breakdown_enum': InstantArticleInsightsQueryResult.Breakdown.__dict__.values(), - 'period_enum': InstantArticleInsightsQueryResult.Period.__dict__.values(), - } - request = FacebookRequest( - node_id=self['id'], - method='GET', - endpoint='/instant_articles_insights', - api=self._api, - param_checker=TypeChecker(param_types, enums), - target_class=InstantArticleInsightsQueryResult, - api_type='EDGE', - response_parser=ObjectParser(target_class=InstantArticleInsightsQueryResult, 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_instant_articles_publish(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 = { - 'canonical_url': 'string', - 'publish_status': 'publish_status_enum', - } - enums = { - 'publish_status_enum': Page.PublishStatus.__dict__.values(), - } - request = FacebookRequest( - node_id=self['id'], - method='POST', - endpoint='/instant_articles_publish', - api=self._api, - param_checker=TypeChecker(param_types, enums), - target_class=Page, - api_type='EDGE', - response_parser=ObjectParser(target_class=Page, 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_instant_articles_stats(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): @@ -3039,6 +2874,7 @@ def create_message(self, fields=None, params=None, batch=None, success=None, fai 'persona_id': 'string', 'recipient': 'Object', 'sender_action': 'sender_action_enum', + 'suggestion_action': 'suggestion_action_enum', 'tag': 'Object', 'thread_control': 'Object', } @@ -3046,6 +2882,7 @@ def create_message(self, fields=None, params=None, batch=None, success=None, fai 'messaging_type_enum': Page.MessagingType.__dict__.values(), 'notification_type_enum': Page.NotificationType.__dict__.values(), 'sender_action_enum': Page.SenderAction.__dict__.values(), + 'suggestion_action_enum': Page.SuggestionAction.__dict__.values(), } request = FacebookRequest( node_id=self['id'], @@ -4617,6 +4454,8 @@ def get_video_reels(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 = { + 'since': 'datetime', + 'until': 'datetime', } enums = { } @@ -4884,6 +4723,37 @@ def get_visitor_posts(self, fields=None, params=None, batch=None, success=None, self.assure_call() return request.execute() + def get_welcome_message_flows(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 = { + 'flow_id': 'string', + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/welcome_message_flows', + 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() + _field_types = { 'about': 'string', 'access_token': 'string', @@ -4918,7 +4788,7 @@ def get_visitor_posts(self, fields=None, params=None, batch=None, success=None, 'delivery_and_pickup_option_info': 'list', 'description': 'string', 'description_html': 'string', - 'differently_open_offerings': 'map', + 'differently_open_offerings': 'list>', 'directed_by': 'string', 'display_subtext': 'string', 'displayed_message_response_time': 'string', @@ -4945,7 +4815,6 @@ def get_visitor_posts(self, fields=None, params=None, batch=None, success=None, 'impressum': 'string', 'influences': 'string', 'instagram_business_account': 'IGUser', - 'instant_articles_review_status': 'string', 'is_always_open': 'bool', 'is_chain': 'bool', 'is_community_page': 'bool', @@ -5019,7 +4888,6 @@ def get_visitor_posts(self, fields=None, params=None, batch=None, success=None, 'store_number': 'unsigned int', 'studio': 'string', 'supports_donate_button_in_live_video': 'bool', - 'supports_instant_articles': 'bool', 'talking_about_count': 'unsigned int', 'temporary_status': 'string', 'unread_message_count': 'unsigned int', @@ -5056,10 +4924,10 @@ def _get_field_enum_info(cls): field_enum_info['PostingToRedspace'] = Page.PostingToRedspace.__dict__.values() field_enum_info['TargetSurface'] = Page.TargetSurface.__dict__.values() field_enum_info['UnpublishedContentType'] = Page.UnpublishedContentType.__dict__.values() - field_enum_info['PublishStatus'] = Page.PublishStatus.__dict__.values() field_enum_info['MessagingType'] = Page.MessagingType.__dict__.values() field_enum_info['NotificationType'] = Page.NotificationType.__dict__.values() field_enum_info['SenderAction'] = Page.SenderAction.__dict__.values() + field_enum_info['SuggestionAction'] = Page.SuggestionAction.__dict__.values() field_enum_info['Platform'] = Page.Platform.__dict__.values() field_enum_info['Model'] = Page.Model.__dict__.values() field_enum_info['DeveloperAction'] = Page.DeveloperAction.__dict__.values() diff --git a/facebook_business/adobjects/pagepostexperiment.py b/facebook_business/adobjects/pagepostexperiment.py index be007bc12..26d6d53a4 100644 --- a/facebook_business/adobjects/pagepostexperiment.py +++ b/facebook_business/adobjects/pagepostexperiment.py @@ -92,7 +92,7 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No 'declared_winning_time': 'datetime', 'description': 'string', 'id': 'string', - 'insight_snapshots': 'map>', + 'insight_snapshots': 'list>>>', 'name': 'string', 'optimization_goal': 'string', 'publish_status': 'string', diff --git a/facebook_business/adobjects/privateliftstudyinstance.py b/facebook_business/adobjects/privateliftstudyinstance.py index 8eaea6e3c..6a9823a1c 100644 --- a/facebook_business/adobjects/privateliftstudyinstance.py +++ b/facebook_business/adobjects/privateliftstudyinstance.py @@ -97,6 +97,7 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure api_utils.warning('`success` and `failure` callback only work for batch call.') param_types = { 'operation': 'operation_enum', + 'run_id': 'string', } enums = { 'operation_enum': PrivateLiftStudyInstance.Operation.__dict__.values(), diff --git a/facebook_business/adobjects/productcatalog.py b/facebook_business/adobjects/productcatalog.py index 6049e75e8..d2c41ac38 100644 --- a/facebook_business/adobjects/productcatalog.py +++ b/facebook_business/adobjects/productcatalog.py @@ -520,6 +520,7 @@ def create_batch(self, fields=None, params=None, batch=None, success=None, failu 'allow_upsert': 'bool', 'fbe_external_business_id': 'string', 'requests': 'list', + 'version': 'unsigned int', } enums = { } @@ -1303,6 +1304,7 @@ def create_items_batch(self, fields=None, params=None, batch=None, success=None, 'item_sub_type': 'item_sub_type_enum', 'item_type': 'string', 'requests': 'map', + 'version': 'unsigned int', } enums = { 'item_sub_type_enum': ProductCatalog.ItemSubType.__dict__.values(), @@ -1337,6 +1339,7 @@ def create_localized_items_batch(self, fields=None, params=None, batch=None, suc 'allow_upsert': 'bool', 'item_type': 'string', 'requests': 'map', + 'version': 'unsigned int', } enums = { } @@ -1362,84 +1365,6 @@ def create_localized_items_batch(self, fields=None, params=None, batch=None, suc self.assure_call() return request.execute() - def get_media_titles(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.mediatitle import MediaTitle - param_types = { - 'bulk_pagination': 'bool', - 'filter': 'Object', - } - enums = { - } - request = FacebookRequest( - node_id=self['id'], - method='GET', - endpoint='/media_titles', - api=self._api, - param_checker=TypeChecker(param_types, enums), - target_class=MediaTitle, - api_type='EDGE', - response_parser=ObjectParser(target_class=MediaTitle, 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_media_title(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.mediatitle import MediaTitle - param_types = { - 'applinks': 'Object', - 'content_category': 'content_category_enum', - 'currency': 'string', - 'description': 'string', - 'fb_page_id': 'string', - 'genres': 'list', - 'images': 'list', - 'kg_fb_id': 'string', - 'media_title_id': 'string', - 'price': 'unsigned int', - 'title': 'string', - 'title_display_name': 'string', - 'url': 'string', - } - enums = { - 'content_category_enum': MediaTitle.ContentCategory.__dict__.values(), - } - request = FacebookRequest( - node_id=self['id'], - method='POST', - endpoint='/media_titles', - api=self._api, - param_checker=TypeChecker(param_types, enums), - target_class=MediaTitle, - api_type='EDGE', - response_parser=ObjectParser(target_class=MediaTitle, 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_pricing_variables_batch(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): diff --git a/facebook_business/adobjects/productcatalogcategory.py b/facebook_business/adobjects/productcatalogcategory.py index b00a20b81..e2271587d 100644 --- a/facebook_business/adobjects/productcatalogcategory.py +++ b/facebook_business/adobjects/productcatalogcategory.py @@ -72,7 +72,7 @@ def api_create(self, parent_id, fields=None, params=None, batch=None, success=No 'image_url': 'string', 'name': 'string', 'num_items': 'int', - 'tokens': 'map', + 'tokens': 'list>', 'data': 'list', } @classmethod diff --git a/facebook_business/adobjects/productfeedrule.py b/facebook_business/adobjects/productfeedrule.py index 9c69e28e5..7bde5459f 100644 --- a/facebook_business/adobjects/productfeedrule.py +++ b/facebook_business/adobjects/productfeedrule.py @@ -147,7 +147,7 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure _field_types = { 'attribute': 'string', 'id': 'string', - 'params': 'map', + 'params': 'list>', 'rule_type': 'string', } @classmethod diff --git a/facebook_business/adobjects/productfeedrulesuggestion.py b/facebook_business/adobjects/productfeedrulesuggestion.py index bd02c71be..9a5cbd8cc 100644 --- a/facebook_business/adobjects/productfeedrulesuggestion.py +++ b/facebook_business/adobjects/productfeedrulesuggestion.py @@ -44,7 +44,7 @@ class Field(AbstractObject.Field): _field_types = { 'attribute': 'string', - 'params': 'map', + 'params': 'list>', 'type': 'string', } @classmethod diff --git a/facebook_business/adobjects/productfeedschedule.py b/facebook_business/adobjects/productfeedschedule.py index 7d8c2c1ec..c646d4b25 100644 --- a/facebook_business/adobjects/productfeedschedule.py +++ b/facebook_business/adobjects/productfeedschedule.py @@ -52,15 +52,6 @@ class Field(AbstractObject.Field): url = 'url' username = 'username' - class DayOfWeek: - friday = 'FRIDAY' - monday = 'MONDAY' - saturday = 'SATURDAY' - sunday = 'SUNDAY' - thursday = 'THURSDAY' - tuesday = 'TUESDAY' - wednesday = 'WEDNESDAY' - class Interval: daily = 'DAILY' hourly = 'HOURLY' @@ -99,7 +90,7 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No _field_types = { 'day_of_month': 'unsigned int', - 'day_of_week': 'DayOfWeek', + 'day_of_week': 'string', 'hour': 'unsigned int', 'id': 'string', 'interval': 'Interval', @@ -112,7 +103,6 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No @classmethod def _get_field_enum_info(cls): field_enum_info = {} - field_enum_info['DayOfWeek'] = ProductFeedSchedule.DayOfWeek.__dict__.values() field_enum_info['Interval'] = ProductFeedSchedule.Interval.__dict__.values() return field_enum_info diff --git a/facebook_business/adobjects/productitem.py b/facebook_business/adobjects/productitem.py index feec3233f..24b27d3ec 100644 --- a/facebook_business/adobjects/productitem.py +++ b/facebook_business/adobjects/productitem.py @@ -417,6 +417,7 @@ class ErrorType: digital_goods_not_available_for_checkout = 'DIGITAL_GOODS_NOT_AVAILABLE_FOR_CHECKOUT' duplicate_images = 'DUPLICATE_IMAGES' duplicate_title_and_description = 'DUPLICATE_TITLE_AND_DESCRIPTION' + empty_description = 'EMPTY_DESCRIPTION' generic_invalid_field = 'GENERIC_INVALID_FIELD' hidden_until_product_launch = 'HIDDEN_UNTIL_PRODUCT_LAUNCH' image_fetch_failed = 'IMAGE_FETCH_FAILED' @@ -995,23 +996,53 @@ def get_product_sets(self, fields=None, params=None, batch=None, success=None, f self.assure_call() return request.execute() + def get_videos_metadata(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 = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/videos_metadata', + 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() + _field_types = { - 'additional_image_cdn_urls': 'list>', + 'additional_image_cdn_urls': 'list>>', 'additional_image_urls': 'list', - 'additional_variant_attributes': 'map', + 'additional_variant_attributes': 'list>', 'age_group': 'AgeGroup', 'applinks': 'CatalogItemAppLinks', 'ar_data': 'ProductItemARData', 'availability': 'Availability', 'brand': 'string', - 'capability_to_review_status': 'map', + 'capability_to_review_status': 'list>', 'category': 'string', 'category_specific_fields': 'CatalogSubVerticalList', 'color': 'string', 'commerce_insights': 'ProductItemCommerceInsights', 'condition': 'Condition', 'currency': 'string', - 'custom_data': 'map', + 'custom_data': 'list>', 'custom_label_0': 'string', 'custom_label_1': 'string', 'custom_label_2': 'string', @@ -1029,7 +1060,7 @@ def get_product_sets(self, fields=None, params=None, batch=None, success=None, f 'gender': 'Gender', 'gtin': 'string', 'id': 'string', - 'image_cdn_urls': 'map', + 'image_cdn_urls': 'list>', 'image_fetch_status': 'ImageFetchStatus', 'image_url': 'string', 'images': 'list', diff --git a/facebook_business/adobjects/reachfrequencyestimatesplacementbreakdown.py b/facebook_business/adobjects/reachfrequencyestimatesplacementbreakdown.py index 08b957723..1d229c7cb 100644 --- a/facebook_business/adobjects/reachfrequencyestimatesplacementbreakdown.py +++ b/facebook_business/adobjects/reachfrequencyestimatesplacementbreakdown.py @@ -41,6 +41,9 @@ class Field(AbstractObject.Field): android = 'android' audience_network = 'audience_network' desktop = 'desktop' + facebook_search = 'facebook_search' + fb_reels = 'fb_reels' + fb_reels_overlay = 'fb_reels_overlay' ig_android = 'ig_android' ig_ios = 'ig_ios' ig_other = 'ig_other' @@ -56,6 +59,9 @@ class Field(AbstractObject.Field): 'android': 'list', 'audience_network': 'list', 'desktop': 'list', + 'facebook_search': 'list', + 'fb_reels': 'list', + 'fb_reels_overlay': 'list', 'ig_android': 'list', 'ig_ios': 'list', 'ig_other': 'list', diff --git a/facebook_business/adobjects/reachfrequencyprediction.py b/facebook_business/adobjects/reachfrequencyprediction.py index 115b270c8..4a1e55808 100644 --- a/facebook_business/adobjects/reachfrequencyprediction.py +++ b/facebook_business/adobjects/reachfrequencyprediction.py @@ -234,7 +234,7 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No 'curve_reach': 'list', 'daily_grp_curve': 'list', 'daily_impression_curve': 'list', - 'daily_impression_curve_map': 'map>', + 'daily_impression_curve_map': 'list>>', 'day_parting_schedule': 'list', 'destination_id': 'string', 'end_time': 'datetime', @@ -250,8 +250,8 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No 'external_reach': 'unsigned int', 'feed_ratio_0000': 'unsigned int', 'frequency_cap': 'unsigned int', - 'frequency_distribution_map': 'map>', - 'frequency_distribution_map_agg': 'map>', + 'frequency_distribution_map': 'list>>', + 'frequency_distribution_map_agg': 'list>>', 'grp_audience_size': 'float', 'grp_avg_probability_map': 'string', 'grp_country_audience_size': 'float', @@ -284,7 +284,7 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No 'optimization_goal_name': 'string', 'pause_periods': 'list', 'placement_breakdown': 'ReachFrequencyEstimatesPlacementBreakdown', - 'placement_breakdown_map': 'map', + 'placement_breakdown_map': 'list>', 'plan_name': 'string', 'plan_type': 'string', 'prediction_mode': 'unsigned int', diff --git a/facebook_business/adobjects/savedaudience.py b/facebook_business/adobjects/savedaudience.py index 3a47be643..6b5866843 100644 --- a/facebook_business/adobjects/savedaudience.py +++ b/facebook_business/adobjects/savedaudience.py @@ -46,7 +46,6 @@ class Field(AbstractObject.Field): approximate_count_upper_bound = 'approximate_count_upper_bound' delete_time = 'delete_time' description = 'description' - extra_info = 'extra_info' id = 'id' name = 'name' operation_status = 'operation_status' @@ -95,7 +94,6 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No 'approximate_count_upper_bound': 'int', 'delete_time': 'int', 'description': 'string', - 'extra_info': 'string', 'id': 'string', 'name': 'string', 'operation_status': 'CustomAudienceStatus', diff --git a/facebook_business/adobjects/splittestwinner.py b/facebook_business/adobjects/splittestwinner.py index 07dddfd5c..5c10e473c 100644 --- a/facebook_business/adobjects/splittestwinner.py +++ b/facebook_business/adobjects/splittestwinner.py @@ -44,7 +44,7 @@ class Field(AbstractObject.Field): _field_types = { 'ad_object_level': 'string', - 'confidences': 'map', + 'confidences': 'list>', 'winner_ad_object_id': 'string', } @classmethod diff --git a/facebook_business/adobjects/targetinggeolocationelectoraldistrict.py b/facebook_business/adobjects/targetinggeolocationelectoraldistrict.py index 46d8dbb37..873aab2c8 100644 --- a/facebook_business/adobjects/targetinggeolocationelectoraldistrict.py +++ b/facebook_business/adobjects/targetinggeolocationelectoraldistrict.py @@ -39,12 +39,14 @@ def __init__(self, api=None): class Field(AbstractObject.Field): country = 'country' + deprecation_code = 'deprecation_code' electoral_district = 'electoral_district' key = 'key' name = 'name' _field_types = { 'country': 'string', + 'deprecation_code': 'string', 'electoral_district': 'string', 'key': 'string', 'name': 'string', diff --git a/facebook_business/adobjects/unifiedthread.py b/facebook_business/adobjects/unifiedthread.py index 9a379f20d..a108ed83f 100644 --- a/facebook_business/adobjects/unifiedthread.py +++ b/facebook_business/adobjects/unifiedthread.py @@ -47,6 +47,7 @@ class Field(AbstractObject.Field): id = 'id' is_subscribed = 'is_subscribed' link = 'link' + linked_group = 'linked_group' message_count = 'message_count' name = 'name' participants = 'participants' @@ -134,6 +135,7 @@ def get_messages(self, fields=None, params=None, batch=None, success=None, failu 'id': 'string', 'is_subscribed': 'bool', 'link': 'string', + 'linked_group': 'Group', 'message_count': 'int', 'name': 'string', 'participants': 'Object', diff --git a/facebook_business/adobjects/url.py b/facebook_business/adobjects/url.py index 4d7b8c5ca..451a4340a 100644 --- a/facebook_business/adobjects/url.py +++ b/facebook_business/adobjects/url.py @@ -41,10 +41,8 @@ def __init__(self, fbid=None, parent_id=None, api=None): super(URL, self).__init__(fbid, parent_id, api) class Field(AbstractObject.Field): - development_instant_article = 'development_instant_article' engagement = 'engagement' id = 'id' - instant_article = 'instant_article' og_object = 'og_object' ownership_permissions = 'ownership_permissions' scopes = 'scopes' @@ -121,10 +119,8 @@ def api_update(self, fields=None, params=None, batch=None, success=None, failure return request.execute() _field_types = { - 'development_instant_article': 'InstantArticle', 'engagement': 'Object', 'id': 'string', - 'instant_article': 'InstantArticle', 'og_object': 'Object', 'ownership_permissions': 'Object', 'scopes': 'Object', diff --git a/facebook_business/adobjects/user.py b/facebook_business/adobjects/user.py index 0bb5298cd..61ad0de4e 100644 --- a/facebook_business/adobjects/user.py +++ b/facebook_business/adobjects/user.py @@ -44,6 +44,7 @@ class Field(AbstractObject.Field): about = 'about' age_range = 'age_range' birthday = 'birthday' + community = 'community' cover = 'cover' currency = 'currency' education = 'education' @@ -240,9 +241,9 @@ def create_access_token(self, fields=None, params=None, batch=None, success=None api_utils.warning('`success` and `failure` callback only work for batch call.') param_types = { 'business_app': 'int', - 'is_permanent_token': 'bool', 'page_id': 'string', 'scope': 'list', + 'set_token_expires_in_60_days': 'bool', } enums = { } @@ -305,7 +306,6 @@ def create_account(self, fields=None, params=None, batch=None, success=None, fai 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.page import Page param_types = { 'about': 'string', 'address': 'string', @@ -332,9 +332,9 @@ def create_account(self, fields=None, params=None, batch=None, success=None, fai endpoint='/accounts', api=self._api, param_checker=TypeChecker(param_types, enums), - target_class=Page, + target_class=AbstractCrudObject, api_type='EDGE', - response_parser=ObjectParser(target_class=Page, api=self._api), + response_parser=ObjectParser(target_class=AbstractCrudObject, api=self._api), ) request.add_params(params) request.add_fields(fields) @@ -2230,6 +2230,7 @@ def create_video(self, fields=None, params=None, batch=None, success=None, failu 'about': 'string', 'age_range': 'AgeRange', 'birthday': 'string', + 'community': 'Group', 'cover': 'UserCoverPhoto', 'currency': 'Currency', 'education': 'list', diff --git a/facebook_business/adobjects/vehicleoffer.py b/facebook_business/adobjects/vehicleoffer.py index f41db2af9..116150952 100644 --- a/facebook_business/adobjects/vehicleoffer.py +++ b/facebook_business/adobjects/vehicleoffer.py @@ -46,6 +46,7 @@ class Field(AbstractObject.Field): amount_price = 'amount_price' amount_qualifier = 'amount_qualifier' applinks = 'applinks' + availability = 'availability' body_style = 'body_style' cashback_currency = 'cashback_currency' cashback_price = 'cashback_price' @@ -55,11 +56,17 @@ class Field(AbstractObject.Field): downpayment_currency = 'downpayment_currency' downpayment_price = 'downpayment_price' downpayment_qualifier = 'downpayment_qualifier' + drivetrain = 'drivetrain' end_date = 'end_date' end_time = 'end_time' + exterior_color = 'exterior_color' + fuel_type = 'fuel_type' + generation = 'generation' id = 'id' image_fetch_status = 'image_fetch_status' images = 'images' + interior_color = 'interior_color' + interior_upholstery = 'interior_upholstery' make = 'make' model = 'model' offer_description = 'offer_description' @@ -72,6 +79,7 @@ class Field(AbstractObject.Field): term_length = 'term_length' term_qualifier = 'term_qualifier' title = 'title' + transmission = 'transmission' trim = 'trim' unit_price = 'unit_price' url = 'url' @@ -218,6 +226,7 @@ def get_videos_metadata(self, fields=None, params=None, batch=None, success=None 'amount_price': 'string', 'amount_qualifier': 'string', 'applinks': 'CatalogItemAppLinks', + 'availability': 'string', 'body_style': 'string', 'cashback_currency': 'string', 'cashback_price': 'string', @@ -227,11 +236,17 @@ def get_videos_metadata(self, fields=None, params=None, batch=None, success=None 'downpayment_currency': 'string', 'downpayment_price': 'string', 'downpayment_qualifier': 'string', + 'drivetrain': 'string', 'end_date': 'string', 'end_time': 'int', + 'exterior_color': 'string', + 'fuel_type': 'string', + 'generation': 'string', 'id': 'string', 'image_fetch_status': 'ImageFetchStatus', 'images': 'list', + 'interior_color': 'string', + 'interior_upholstery': 'string', 'make': 'string', 'model': 'string', 'offer_description': 'string', @@ -244,6 +259,7 @@ def get_videos_metadata(self, fields=None, params=None, batch=None, success=None 'term_length': 'unsigned int', 'term_qualifier': 'string', 'title': 'string', + 'transmission': 'string', 'trim': 'string', 'unit_price': 'Object', 'url': 'string', diff --git a/facebook_business/adobjects/whatsappbusinessaccount.py b/facebook_business/adobjects/whatsappbusinessaccount.py index 5bd3c3936..32a9a896a 100644 --- a/facebook_business/adobjects/whatsappbusinessaccount.py +++ b/facebook_business/adobjects/whatsappbusinessaccount.py @@ -65,9 +65,12 @@ class Tasks: manage = 'MANAGE' manage_extensions = 'MANAGE_EXTENSIONS' manage_phone = 'MANAGE_PHONE' + manage_phone_assets = 'MANAGE_PHONE_ASSETS' manage_templates = 'MANAGE_TEMPLATES' messaging = 'MESSAGING' view_cost = 'VIEW_COST' + view_phone_assets = 'VIEW_PHONE_ASSETS' + view_templates = 'VIEW_TEMPLATES' class Category: authentication = 'AUTHENTICATION' @@ -336,11 +339,42 @@ def get_extensions(self, fields=None, params=None, batch=None, success=None, fai self.assure_call() return request.execute() + def get_message_campaigns(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 = { + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/message_campaigns', + 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() + def delete_message_templates(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 = { + 'hsm_id': 'string', 'name': 'string', } enums = { @@ -427,8 +461,10 @@ def create_message_template(self, fields=None, params=None, batch=None, success= 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 = { + 'allow_category_change': 'bool', 'category': 'category_enum', 'components': 'list', + 'cta_url_link_tracking_opted_out': 'bool', 'language': 'string', 'name': 'string', } @@ -495,6 +531,7 @@ def create_phone_number(self, fields=None, params=None, batch=None, success=None 'cc': 'string', 'migrate_phone_number': 'bool', 'phone_number': 'string', + 'verified_name': 'string', } enums = { } @@ -736,6 +773,38 @@ def create_subscribed_app(self, fields=None, params=None, batch=None, success=No self.assure_call() return request.execute() + def get_template_performance_metrics(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 = { + 'name': 'string', + 'template_id': 'string', + } + enums = { + } + request = FacebookRequest( + node_id=self['id'], + method='GET', + endpoint='/template_performance_metrics', + 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() + _field_types = { 'account_review_status': 'string', 'analytics': 'Object', diff --git a/facebook_business/adobjects/jobsjob.py b/facebook_business/adobjects/whatsappbusinesspreverifiedphonenumber.py similarity index 62% rename from facebook_business/adobjects/jobsjob.py rename to facebook_business/adobjects/whatsappbusinesspreverifiedphonenumber.py index cd1269184..d36e0ec93 100644 --- a/facebook_business/adobjects/jobsjob.py +++ b/facebook_business/adobjects/whatsappbusinesspreverifiedphonenumber.py @@ -32,54 +32,27 @@ pull request for this class. """ -class JobsJob( +class WhatsAppBusinessPreVerifiedPhoneNumber( AbstractCrudObject, ): def __init__(self, fbid=None, parent_id=None, api=None): - self._isJobsJob = True - super(JobsJob, self).__init__(fbid, parent_id, api) + self._isWhatsAppBusinessPreVerifiedPhoneNumber = True + super(WhatsAppBusinessPreVerifiedPhoneNumber, self).__init__(fbid, parent_id, api) class Field(AbstractObject.Field): - address = 'address' - applinks = 'applinks' - category_specific_fields = 'category_specific_fields' - custom_label_0 = 'custom_label_0' - custom_label_1 = 'custom_label_1' - custom_label_2 = 'custom_label_2' - custom_label_3 = 'custom_label_3' - custom_label_4 = 'custom_label_4' - custom_label_5 = 'custom_label_5' - custom_label_6 = 'custom_label_6' - custom_number_0 = 'custom_number_0' - custom_number_1 = 'custom_number_1' - custom_number_2 = 'custom_number_2' - custom_number_3 = 'custom_number_3' - custom_number_4 = 'custom_number_4' - custom_number_5 = 'custom_number_5' - custom_number_6 = 'custom_number_6' + code_verification_status = 'code_verification_status' + code_verification_time = 'code_verification_time' id = 'id' - image_fetch_status = 'image_fetch_status' - images = 'images' - jobs_job_id = 'jobs_job_id' - sanitized_images = 'sanitized_images' - unit_price = 'unit_price' - url = 'url' - visibility = 'visibility' - - class ImageFetchStatus: - direct_upload = 'DIRECT_UPLOAD' - fetched = 'FETCHED' - fetch_failed = 'FETCH_FAILED' - no_status = 'NO_STATUS' - outdated = 'OUTDATED' - partial_fetch = 'PARTIAL_FETCH' - - class Visibility: - published = 'PUBLISHED' - staging = 'STAGING' + phone_number = 'phone_number' + verification_expiry_time = 'verification_expiry_time' - def api_get(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): + class CodeVerificationStatus: + expired = 'EXPIRED' + not_verified = 'NOT_VERIFIED' + verified = 'VERIFIED' + + def api_delete(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.') @@ -89,11 +62,11 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No } request = FacebookRequest( node_id=self['id'], - method='GET', + method='DELETE', endpoint='/', api=self._api, param_checker=TypeChecker(param_types, enums), - target_class=JobsJob, + target_class=AbstractCrudObject, api_type='NODE', response_parser=ObjectParser(reuse_object=self), ) @@ -109,7 +82,7 @@ def api_get(self, fields=None, params=None, batch=None, success=None, failure=No self.assure_call() return request.execute() - def get_augmented_realities_metadata(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): + def api_get(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.') @@ -120,12 +93,12 @@ def get_augmented_realities_metadata(self, fields=None, params=None, batch=None, request = FacebookRequest( node_id=self['id'], method='GET', - endpoint='/augmented_realities_metadata', + endpoint='/', api=self._api, param_checker=TypeChecker(param_types, enums), - target_class=AbstractCrudObject, - api_type='EDGE', - response_parser=ObjectParser(target_class=AbstractCrudObject, api=self._api), + target_class=WhatsAppBusinessPreVerifiedPhoneNumber, + api_type='NODE', + response_parser=ObjectParser(reuse_object=self), ) request.add_params(params) request.add_fields(fields) @@ -139,24 +112,29 @@ def get_augmented_realities_metadata(self, fields=None, params=None, batch=None, self.assure_call() return request.execute() - def get_channels_to_integrity_status(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): + def create_request_code(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.catalogitemchannelstointegritystatus import CatalogItemChannelsToIntegrityStatus param_types = { + 'code_method': 'code_method_enum', + 'language': 'Object', } enums = { + 'code_method_enum': [ + 'SMS', + 'VOICE', + ], } request = FacebookRequest( node_id=self['id'], - method='GET', - endpoint='/channels_to_integrity_status', + method='POST', + endpoint='/request_code', api=self._api, param_checker=TypeChecker(param_types, enums), - target_class=CatalogItemChannelsToIntegrityStatus, + target_class=AbstractCrudObject, api_type='EDGE', - response_parser=ObjectParser(target_class=CatalogItemChannelsToIntegrityStatus, api=self._api), + response_parser=ObjectParser(target_class=AbstractCrudObject, api=self._api), ) request.add_params(params) request.add_fields(fields) @@ -170,18 +148,19 @@ def get_channels_to_integrity_status(self, fields=None, params=None, batch=None, self.assure_call() return request.execute() - def get_videos_metadata(self, fields=None, params=None, batch=None, success=None, failure=None, pending=False): + def create_verify_code(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 = { + 'code': 'string', } enums = { } request = FacebookRequest( node_id=self['id'], - method='GET', - endpoint='/videos_metadata', + method='POST', + endpoint='/verify_code', api=self._api, param_checker=TypeChecker(param_types, enums), target_class=AbstractCrudObject, @@ -201,37 +180,16 @@ def get_videos_metadata(self, fields=None, params=None, batch=None, success=None return request.execute() _field_types = { - 'address': 'Object', - 'applinks': 'CatalogItemAppLinks', - 'category_specific_fields': 'CatalogSubVerticalList', - 'custom_label_0': 'string', - 'custom_label_1': 'string', - 'custom_label_2': 'string', - 'custom_label_3': 'string', - 'custom_label_4': 'string', - 'custom_label_5': 'string', - 'custom_label_6': 'string', - 'custom_number_0': 'unsigned int', - 'custom_number_1': 'unsigned int', - 'custom_number_2': 'unsigned int', - 'custom_number_3': 'unsigned int', - 'custom_number_4': 'unsigned int', - 'custom_number_5': 'unsigned int', - 'custom_number_6': 'unsigned int', + 'code_verification_status': 'string', + 'code_verification_time': 'datetime', 'id': 'string', - 'image_fetch_status': 'ImageFetchStatus', - 'images': 'list', - 'jobs_job_id': 'string', - 'sanitized_images': 'list', - 'unit_price': 'Object', - 'url': 'string', - 'visibility': 'Visibility', + 'phone_number': 'string', + 'verification_expiry_time': 'datetime', } @classmethod def _get_field_enum_info(cls): field_enum_info = {} - field_enum_info['ImageFetchStatus'] = JobsJob.ImageFetchStatus.__dict__.values() - field_enum_info['Visibility'] = JobsJob.Visibility.__dict__.values() + field_enum_info['CodeVerificationStatus'] = WhatsAppBusinessPreVerifiedPhoneNumber.CodeVerificationStatus.__dict__.values() return field_enum_info diff --git a/facebook_business/apiconfig.py b/facebook_business/apiconfig.py index 175ff0a16..b04f018c4 100644 --- a/facebook_business/apiconfig.py +++ b/facebook_business/apiconfig.py @@ -19,7 +19,7 @@ # DEALINGS IN THE SOFTWARE. ads_api_config = { - 'API_VERSION': 'v16.0', - 'SDK_VERSION': 'v16.0.2', + 'API_VERSION': 'v17.0', + 'SDK_VERSION': 'v17.0.0', 'STRICT_MODE': False } diff --git a/setup.py b/setup.py index bdbaaac0a..2d0317b26 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ requirements_filename = os.path.join(this_dir, 'requirements.txt') PACKAGE_NAME = 'facebook_business' -PACKAGE_VERSION = '16.0.2' +PACKAGE_VERSION = '17.0.0' PACKAGE_AUTHOR = 'Facebook' PACKAGE_AUTHOR_EMAIL = '' PACKAGE_URL = 'https://github.com/facebook/facebook-python-business-sdk'