We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Facebook Ads Provider uses a deprecated version of the API
### Apache Airflow Provider(s)

facebook

### Versions of Apache Airflow Providers

2.0.1

### Apache Airflow version

2.1.1

### Operating System

Ubuntu 20.04

### Deployment

Docker-Compose

### Deployment details

_No response_

### What happened

Task fails because the hook uses a deprecated Facebook API version. The hook is calling v6.0 which is longer supported.



### What you expected to happen

I expected this task to connected to the Facebook API and fetch the requested data. 

My log files for the failed task output the following message:

```
facebook_business.exceptions.FacebookRequestError: 

  Message: Call was not successful
  Method:  POST
  Path:    https://graph.facebook.com/v6.0/act_1210763848963620/insights
  Params:  {'level': 'ad', 'date_preset': 'yesterday', 'fields': '["campaign_name","campaign_id","ad_id","clicks","impressions"]'}

  Status:  400
  Response:
    {
      "error": {
        "message": "(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v11.0.",
        "type": "OAuthException",
        "code": 2635,
        "fbtrace_id": "AGRidwR5VhjU3kAJVUSkvuz"
      }
    }
```

Line 69 of https://github.com/apache/airflow/blob/main/airflow/providers/facebook/ads/hooks/ads.py should be changed to a newer API version.

### How to reproduce

Run the sample DAG posted here: https://airflow.apache.org/docs/apache-airflow-providers-google/stable/_modules/airflow/providers/google/cloud/example_dags/example_facebook_ads_to_gcs.html 

### Anything else

_No response_

### Are you willing to submit PR?

- [X] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `airflow/providers/facebook/ads/hooks/ads.py`
Content:
```
1 #
2 # Licensed to the Apache Software Foundation (ASF) under one
3 # or more contributor license agreements.  See the NOTICE file
4 # distributed with this work for additional information
5 # regarding copyright ownership.  The ASF licenses this file
6 # to you under the Apache License, Version 2.0 (the
7 # "License"); you may not use this file except in compliance
8 # with the License.  You may obtain a copy of the License at
9 #
10 #   http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing,
13 # software distributed under the License is distributed on an
14 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 # KIND, either express or implied.  See the License for the
16 # specific language governing permissions and limitations
17 # under the License.
18 """This module contains Facebook Ads Reporting hooks"""
19 import time
20 from enum import Enum
21 from typing import Any, Dict, List
22 
23 try:
24     from functools import cached_property
25 except ImportError:
26     from cached_property import cached_property
27 from facebook_business.adobjects.adaccount import AdAccount
28 from facebook_business.adobjects.adreportrun import AdReportRun
29 from facebook_business.adobjects.adsinsights import AdsInsights
30 from facebook_business.api import FacebookAdsApi
31 
32 from airflow.exceptions import AirflowException
33 from airflow.hooks.base import BaseHook
34 
35 
36 class JobStatus(Enum):
37     """Available options for facebook async task status"""
38 
39     COMPLETED = 'Job Completed'
40     STARTED = 'Job Started'
41     RUNNING = 'Job Running'
42     FAILED = 'Job Failed'
43     SKIPPED = 'Job Skipped'
44 
45 
46 class FacebookAdsReportingHook(BaseHook):
47     """
48     Hook for the Facebook Ads API
49 
50     .. seealso::
51         For more information on the Facebook Ads API, take a look at the API docs:
52         https://developers.facebook.com/docs/marketing-apis/
53 
54     :param facebook_conn_id: Airflow Facebook Ads connection ID
55     :type facebook_conn_id: str
56     :param api_version: The version of Facebook API. Default to v6.0
57     :type api_version: str
58 
59     """
60 
61     conn_name_attr = 'facebook_conn_id'
62     default_conn_name = 'facebook_default'
63     conn_type = 'facebook_social'
64     hook_name = 'Facebook Ads'
65 
66     def __init__(
67         self,
68         facebook_conn_id: str = default_conn_name,
69         api_version: str = "v6.0",
70     ) -> None:
71         super().__init__()
72         self.facebook_conn_id = facebook_conn_id
73         self.api_version = api_version
74         self.client_required_fields = ["app_id", "app_secret", "access_token", "account_id"]
75 
76     def _get_service(self) -> FacebookAdsApi:
77         """Returns Facebook Ads Client using a service account"""
78         config = self.facebook_ads_config
79         return FacebookAdsApi.init(
80             app_id=config["app_id"],
81             app_secret=config["app_secret"],
82             access_token=config["access_token"],
83             account_id=config["account_id"],
84             api_version=self.api_version,
85         )
86 
87     @cached_property
88     def facebook_ads_config(self) -> Dict:
89         """
90         Gets Facebook ads connection from meta db and sets
91         facebook_ads_config attribute with returned config file
92         """
93         self.log.info("Fetching fb connection: %s", self.facebook_conn_id)
94         conn = self.get_connection(self.facebook_conn_id)
95         config = conn.extra_dejson
96         missing_keys = self.client_required_fields - config.keys()
97         if missing_keys:
98             message = f"{missing_keys} fields are missing"
99             raise AirflowException(message)
100         return config
101 
102     def bulk_facebook_report(
103         self,
104         params: Dict[str, Any],
105         fields: List[str],
106         sleep_time: int = 5,
107     ) -> List[AdsInsights]:
108         """
109         Pulls data from the Facebook Ads API
110 
111         :param fields: List of fields that is obtained from Facebook. Found in AdsInsights.Field class.
112             https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0
113         :type fields: List[str]
114         :param params: Parameters that determine the query for Facebook
115             https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0
116         :type fields: Dict[str, Any]
117         :param sleep_time: Time to sleep when async call is happening
118         :type sleep_time: int
119 
120         :return: Facebook Ads API response, converted to Facebook Ads Row objects
121         :rtype: List[AdsInsights]
122         """
123         api = self._get_service()
124         ad_account = AdAccount(api.get_default_account_id(), api=api)
125         _async = ad_account.get_insights(params=params, fields=fields, is_async=True)
126         while True:
127             request = _async.api_get()
128             async_status = request[AdReportRun.Field.async_status]
129             percent = request[AdReportRun.Field.async_percent_completion]
130             self.log.info("%s %s completed, async_status: %s", percent, "%", async_status)
131             if async_status == JobStatus.COMPLETED.value:
132                 self.log.info("Job run completed")
133                 break
134             if async_status in [JobStatus.SKIPPED.value, JobStatus.FAILED.value]:
135                 message = f"{async_status}. Please retry."
136                 raise AirflowException(message)
137             time.sleep(sleep_time)
138         report_run_id = _async.api_get()["report_run_id"]
139         report_object = AdReportRun(report_run_id, api=api)
140         insights = report_object.get_insights()
141         self.log.info("Extracting data from returned Facebook Ads Iterators")
142         return list(insights)
143
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/airflow/providers/facebook/ads/hooks/ads.py b/airflow/providers/facebook/ads/hooks/ads.py
--- a/airflow/providers/facebook/ads/hooks/ads.py
+++ b/airflow/providers/facebook/ads/hooks/ads.py
@@ -18,7 +18,7 @@
 """This module contains Facebook Ads Reporting hooks"""
 import time
 from enum import Enum
-from typing import Any, Dict, List
+from typing import Any, Dict, List, Optional
 
 try:
     from functools import cached_property
@@ -53,8 +53,9 @@
 
     :param facebook_conn_id: Airflow Facebook Ads connection ID
     :type facebook_conn_id: str
-    :param api_version: The version of Facebook API. Default to v6.0
-    :type api_version: str
+    :param api_version: The version of Facebook API. Default to None. If it is None,
+        it will use the Facebook business SDK default version.
+    :type api_version: Optional[str]
 
     """
 
@@ -66,7 +67,7 @@
     def __init__(
         self,
         facebook_conn_id: str = default_conn_name,
-        api_version: str = "v6.0",
+        api_version: Optional[str] = None,
     ) -> None:
         super().__init__()
         self.facebook_conn_id = facebook_conn_id

{"golden_diff": "diff --git a/airflow/providers/facebook/ads/hooks/ads.py b/airflow/providers/facebook/ads/hooks/ads.py\n--- a/airflow/providers/facebook/ads/hooks/ads.py\n+++ b/airflow/providers/facebook/ads/hooks/ads.py\n@@ -18,7 +18,7 @@\n \"\"\"This module contains Facebook Ads Reporting hooks\"\"\"\n import time\n from enum import Enum\n-from typing import Any, Dict, List\n+from typing import Any, Dict, List, Optional\n \n try:\n     from functools import cached_property\n@@ -53,8 +53,9 @@\n \n     :param facebook_conn_id: Airflow Facebook Ads connection ID\n     :type facebook_conn_id: str\n-    :param api_version: The version of Facebook API. Default to v6.0\n-    :type api_version: str\n+    :param api_version: The version of Facebook API. Default to None. If it is None,\n+        it will use the Facebook business SDK default version.\n+    :type api_version: Optional[str]\n \n     \"\"\"\n \n@@ -66,7 +67,7 @@\n     def __init__(\n         self,\n         facebook_conn_id: str = default_conn_name,\n-        api_version: str = \"v6.0\",\n+        api_version: Optional[str] = None,\n     ) -> None:\n         super().__init__()\n         self.facebook_conn_id = facebook_conn_id\n", "issue": "Facebook Ads Provider uses a deprecated version of the API\n### Apache Airflow Provider(s)\n\nfacebook\n\n### Versions of Apache Airflow Providers\n\n2.0.1\n\n### Apache Airflow version\n\n2.1.1\n\n### Operating System\n\nUbuntu 20.04\n\n### Deployment\n\nDocker-Compose\n\n### Deployment details\n\n_No response_\n\n### What happened\n\nTask fails because the hook uses a deprecated Facebook API version. The hook is calling v6.0 which is longer supported.\r\n\r\n\n\n### What you expected to happen\n\nI expected this task to connected to the Facebook API and fetch the requested data. \r\n\r\nMy log files for the failed task output the following message:\r\n\r\n```\r\nfacebook_business.exceptions.FacebookRequestError: \r\n\r\n  Message: Call was not successful\r\n  Method:  POST\r\n  Path:    https://graph.facebook.com/v6.0/act_1210763848963620/insights\r\n  Params:  {'level': 'ad', 'date_preset': 'yesterday', 'fields': '[\"campaign_name\",\"campaign_id\",\"ad_id\",\"clicks\",\"impressions\"]'}\r\n\r\n  Status:  400\r\n  Response:\r\n    {\r\n      \"error\": {\r\n        \"message\": \"(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v11.0.\",\r\n        \"type\": \"OAuthException\",\r\n        \"code\": 2635,\r\n        \"fbtrace_id\": \"AGRidwR5VhjU3kAJVUSkvuz\"\r\n      }\r\n    }\r\n```\r\n\r\nLine 69 of https://github.com/apache/airflow/blob/main/airflow/providers/facebook/ads/hooks/ads.py should be changed to a newer API version.\n\n### How to reproduce\n\nRun the sample DAG posted here: https://airflow.apache.org/docs/apache-airflow-providers-google/stable/_modules/airflow/providers/google/cloud/example_dags/example_facebook_ads_to_gcs.html \n\n### Anything else\n\n_No response_\n\n### Are you willing to submit PR?\n\n- [X] Yes I am willing to submit a PR!\n\n### Code of Conduct\n\n- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)\n\n", "before_files": [{"content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\"\"\"This module contains Facebook Ads Reporting hooks\"\"\"\nimport time\nfrom enum import Enum\nfrom typing import Any, Dict, List\n\ntry:\n    from functools import cached_property\nexcept ImportError:\n    from cached_property import cached_property\nfrom facebook_business.adobjects.adaccount import AdAccount\nfrom facebook_business.adobjects.adreportrun import AdReportRun\nfrom facebook_business.adobjects.adsinsights import AdsInsights\nfrom facebook_business.api import FacebookAdsApi\n\nfrom airflow.exceptions import AirflowException\nfrom airflow.hooks.base import BaseHook\n\n\nclass JobStatus(Enum):\n    \"\"\"Available options for facebook async task status\"\"\"\n\n    COMPLETED = 'Job Completed'\n    STARTED = 'Job Started'\n    RUNNING = 'Job Running'\n    FAILED = 'Job Failed'\n    SKIPPED = 'Job Skipped'\n\n\nclass FacebookAdsReportingHook(BaseHook):\n    \"\"\"\n    Hook for the Facebook Ads API\n\n    .. seealso::\n        For more information on the Facebook Ads API, take a look at the API docs:\n        https://developers.facebook.com/docs/marketing-apis/\n\n    :param facebook_conn_id: Airflow Facebook Ads connection ID\n    :type facebook_conn_id: str\n    :param api_version: The version of Facebook API. Default to v6.0\n    :type api_version: str\n\n    \"\"\"\n\n    conn_name_attr = 'facebook_conn_id'\n    default_conn_name = 'facebook_default'\n    conn_type = 'facebook_social'\n    hook_name = 'Facebook Ads'\n\n    def __init__(\n        self,\n        facebook_conn_id: str = default_conn_name,\n        api_version: str = \"v6.0\",\n    ) -> None:\n        super().__init__()\n        self.facebook_conn_id = facebook_conn_id\n        self.api_version = api_version\n        self.client_required_fields = [\"app_id\", \"app_secret\", \"access_token\", \"account_id\"]\n\n    def _get_service(self) -> FacebookAdsApi:\n        \"\"\"Returns Facebook Ads Client using a service account\"\"\"\n        config = self.facebook_ads_config\n        return FacebookAdsApi.init(\n            app_id=config[\"app_id\"],\n            app_secret=config[\"app_secret\"],\n            access_token=config[\"access_token\"],\n            account_id=config[\"account_id\"],\n            api_version=self.api_version,\n        )\n\n    @cached_property\n    def facebook_ads_config(self) -> Dict:\n        \"\"\"\n        Gets Facebook ads connection from meta db and sets\n        facebook_ads_config attribute with returned config file\n        \"\"\"\n        self.log.info(\"Fetching fb connection: %s\", self.facebook_conn_id)\n        conn = self.get_connection(self.facebook_conn_id)\n        config = conn.extra_dejson\n        missing_keys = self.client_required_fields - config.keys()\n        if missing_keys:\n            message = f\"{missing_keys} fields are missing\"\n            raise AirflowException(message)\n        return config\n\n    def bulk_facebook_report(\n        self,\n        params: Dict[str, Any],\n        fields: List[str],\n        sleep_time: int = 5,\n    ) -> List[AdsInsights]:\n        \"\"\"\n        Pulls data from the Facebook Ads API\n\n        :param fields: List of fields that is obtained from Facebook. Found in AdsInsights.Field class.\n            https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0\n        :type fields: List[str]\n        :param params: Parameters that determine the query for Facebook\n            https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0\n        :type fields: Dict[str, Any]\n        :param sleep_time: Time to sleep when async call is happening\n        :type sleep_time: int\n\n        :return: Facebook Ads API response, converted to Facebook Ads Row objects\n        :rtype: List[AdsInsights]\n        \"\"\"\n        api = self._get_service()\n        ad_account = AdAccount(api.get_default_account_id(), api=api)\n        _async = ad_account.get_insights(params=params, fields=fields, is_async=True)\n        while True:\n            request = _async.api_get()\n            async_status = request[AdReportRun.Field.async_status]\n            percent = request[AdReportRun.Field.async_percent_completion]\n            self.log.info(\"%s %s completed, async_status: %s\", percent, \"%\", async_status)\n            if async_status == JobStatus.COMPLETED.value:\n                self.log.info(\"Job run completed\")\n                break\n            if async_status in [JobStatus.SKIPPED.value, JobStatus.FAILED.value]:\n                message = f\"{async_status}. Please retry.\"\n                raise AirflowException(message)\n            time.sleep(sleep_time)\n        report_run_id = _async.api_get()[\"report_run_id\"]\n        report_object = AdReportRun(report_run_id, api=api)\n        insights = report_object.get_insights()\n        self.log.info(\"Extracting data from returned Facebook Ads Iterators\")\n        return list(insights)\n", "path": "airflow/providers/facebook/ads/hooks/ads.py"}], "after_files": [{"content": "#\n# Licensed to the Apache Software Foundation (ASF) under one\n# or more contributor license agreements.  See the NOTICE file\n# distributed with this work for additional information\n# regarding copyright ownership.  The ASF licenses this file\n# to you under the Apache License, Version 2.0 (the\n# \"License\"); you may not use this file except in compliance\n# with the License.  You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\"\"\"This module contains Facebook Ads Reporting hooks\"\"\"\nimport time\nfrom enum import Enum\nfrom typing import Any, Dict, List, Optional\n\ntry:\n    from functools import cached_property\nexcept ImportError:\n    from cached_property import cached_property\nfrom facebook_business.adobjects.adaccount import AdAccount\nfrom facebook_business.adobjects.adreportrun import AdReportRun\nfrom facebook_business.adobjects.adsinsights import AdsInsights\nfrom facebook_business.api import FacebookAdsApi\n\nfrom airflow.exceptions import AirflowException\nfrom airflow.hooks.base import BaseHook\n\n\nclass JobStatus(Enum):\n    \"\"\"Available options for facebook async task status\"\"\"\n\n    COMPLETED = 'Job Completed'\n    STARTED = 'Job Started'\n    RUNNING = 'Job Running'\n    FAILED = 'Job Failed'\n    SKIPPED = 'Job Skipped'\n\n\nclass FacebookAdsReportingHook(BaseHook):\n    \"\"\"\n    Hook for the Facebook Ads API\n\n    .. seealso::\n        For more information on the Facebook Ads API, take a look at the API docs:\n        https://developers.facebook.com/docs/marketing-apis/\n\n    :param facebook_conn_id: Airflow Facebook Ads connection ID\n    :type facebook_conn_id: str\n    :param api_version: The version of Facebook API. Default to None. If it is None,\n        it will use the Facebook business SDK default version.\n    :type api_version: Optional[str]\n\n    \"\"\"\n\n    conn_name_attr = 'facebook_conn_id'\n    default_conn_name = 'facebook_default'\n    conn_type = 'facebook_social'\n    hook_name = 'Facebook Ads'\n\n    def __init__(\n        self,\n        facebook_conn_id: str = default_conn_name,\n        api_version: Optional[str] = None,\n    ) -> None:\n        super().__init__()\n        self.facebook_conn_id = facebook_conn_id\n        self.api_version = api_version\n        self.client_required_fields = [\"app_id\", \"app_secret\", \"access_token\", \"account_id\"]\n\n    def _get_service(self) -> FacebookAdsApi:\n        \"\"\"Returns Facebook Ads Client using a service account\"\"\"\n        config = self.facebook_ads_config\n        return FacebookAdsApi.init(\n            app_id=config[\"app_id\"],\n            app_secret=config[\"app_secret\"],\n            access_token=config[\"access_token\"],\n            account_id=config[\"account_id\"],\n            api_version=self.api_version,\n        )\n\n    @cached_property\n    def facebook_ads_config(self) -> Dict:\n        \"\"\"\n        Gets Facebook ads connection from meta db and sets\n        facebook_ads_config attribute with returned config file\n        \"\"\"\n        self.log.info(\"Fetching fb connection: %s\", self.facebook_conn_id)\n        conn = self.get_connection(self.facebook_conn_id)\n        config = conn.extra_dejson\n        missing_keys = self.client_required_fields - config.keys()\n        if missing_keys:\n            message = f\"{missing_keys} fields are missing\"\n            raise AirflowException(message)\n        return config\n\n    def bulk_facebook_report(\n        self,\n        params: Dict[str, Any],\n        fields: List[str],\n        sleep_time: int = 5,\n    ) -> List[AdsInsights]:\n        \"\"\"\n        Pulls data from the Facebook Ads API\n\n        :param fields: List of fields that is obtained from Facebook. Found in AdsInsights.Field class.\n            https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0\n        :type fields: List[str]\n        :param params: Parameters that determine the query for Facebook\n            https://developers.facebook.com/docs/marketing-api/insights/parameters/v6.0\n        :type fields: Dict[str, Any]\n        :param sleep_time: Time to sleep when async call is happening\n        :type sleep_time: int\n\n        :return: Facebook Ads API response, converted to Facebook Ads Row objects\n        :rtype: List[AdsInsights]\n        \"\"\"\n        api = self._get_service()\n        ad_account = AdAccount(api.get_default_account_id(), api=api)\n        _async = ad_account.get_insights(params=params, fields=fields, is_async=True)\n        while True:\n            request = _async.api_get()\n            async_status = request[AdReportRun.Field.async_status]\n            percent = request[AdReportRun.Field.async_percent_completion]\n            self.log.info(\"%s %s completed, async_status: %s\", percent, \"%\", async_status)\n            if async_status == JobStatus.COMPLETED.value:\n                self.log.info(\"Job run completed\")\n                break\n            if async_status in [JobStatus.SKIPPED.value, JobStatus.FAILED.value]:\n                message = f\"{async_status}. Please retry.\"\n                raise AirflowException(message)\n            time.sleep(sleep_time)\n        report_run_id = _async.api_get()[\"report_run_id\"]\n        report_object = AdReportRun(report_run_id, api=api)\n        insights = report_object.get_insights()\n        self.log.info(\"Extracting data from returned Facebook Ads Iterators\")\n        return list(insights)\n", "path": "airflow/providers/facebook/ads/hooks/ads.py"}]}