Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Source Facebook Marketing: migrate to advancedAuth #26941

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]


LABEL io.airbyte.version=0.4.0
LABEL io.airbyte.version=0.4.1
LABEL io.airbyte.name=airbyte/source-facebook-marketing
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,31 @@
},
"supportsIncremental": true,
"supported_destination_sync_modes": ["append"],
"authSpecification": {
"auth_type": "oauth2.0",
"oauth2Specification": {
"rootObject": [],
"oauthFlowInitParameters": [],
"oauthFlowOutputParameters": [["access_token"]]
"advanced_auth": {
"auth_flow_type": "oauth2.0",
"oauth_config_specification": {
"complete_oauth_output_specification": {
"type": "object",
"properties": {
"access_token": {
"type": "string",
"path_in_connector_config": [
"access_token"
]
}
}
},
"complete_oauth_server_input_specification": {
"type": "object",
"properties": {
"client_id": {
"type": "string"
},
"client_secret": {
"type": "string"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: e7778cfc-e97c-4458-9ecb-b4f2bba8946c
dockerImageTag: 0.4.0
dockerImageTag: 0.4.1
dockerRepository: airbyte/source-facebook-marketing
githubIssueLabel: source-facebook-marketing
icon: facebook.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
import facebook_business
import pendulum
import requests
from airbyte_cdk.models import AuthSpecification, ConnectorSpecification, DestinationSyncMode, FailureType, OAuth2Specification
from airbyte_cdk.models import (
AdvancedAuth,
AuthFlowType,
ConnectorSpecification,
DestinationSyncMode,
FailureType,
OAuthConfigSpecification,
)
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.utils import AirbyteTracedException
Expand All @@ -22,25 +29,25 @@
Ads,
AdSets,
AdsInsights,
AdsInsightsActionType,
AdsInsightsAgeAndGender,
AdsInsightsCountry,
AdsInsightsDma,
AdsInsightsPlatformAndDevice,
AdsInsightsRegion,
AdsInsightsActionCarouselCard,
AdsInsightsActionConversionDevice,
AdsInsightsActionProductID,
AdsInsightsActionReaction,
AdsInsightsActionType,
AdsInsightsActionVideoSound,
AdsInsightsActionVideoType,
AdsInsightsAgeAndGender,
AdsInsightsCountry,
AdsInsightsDeliveryDevice,
AdsInsightsDeliveryPlatform,
AdsInsightsDeliveryPlatformAndDevicePlatform,
AdsInsightsDemographicsAge,
AdsInsightsDemographicsCountry,
AdsInsightsDemographicsDMARegion,
AdsInsightsDemographicsGender,
AdsInsightsDma,
AdsInsightsPlatformAndDevice,
AdsInsightsRegion,
Campaigns,
CustomConversions,
Images,
Expand Down Expand Up @@ -203,12 +210,25 @@ def spec(self, *args, **kwargs) -> ConnectorSpecification:
supportsIncremental=True,
supported_destination_sync_modes=[DestinationSyncMode.append],
connectionSpecification=ConnectorConfig.schema(),
authSpecification=AuthSpecification(
auth_type="oauth2.0",
oauth2Specification=OAuth2Specification(
rootObject=[], oauthFlowInitParameters=[], oauthFlowOutputParameters=[["access_token"]]
advanced_auth=AdvancedAuth(
auth_flow_type=AuthFlowType.oauth2_0,
oauth_config_specification=OAuthConfigSpecification(
complete_oauth_output_specification={
"type": "object",
"properties": {
"access_token": {
"type": "string",
"path_in_connector_config": ["access_token"],
}
},
},
complete_oauth_server_input_specification={
"type": "object",
"properties": {"client_id": {"type": "string"}, "client_secret": {"type": "string"}},
},
),
),
authSpecification=None,
)

def get_custom_insights_streams(self, api: API, config: ConnectorConfig) -> List[Type[Stream]]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@
Ads,
AdSets,
AdsInsights,
AdsInsightsActionType,
AdsInsightsAgeAndGender,
AdsInsightsCountry,
AdsInsightsDma,
AdsInsightsPlatformAndDevice,
AdsInsightsRegion,
AdsInsightsActionCarouselCard,
AdsInsightsActionConversionDevice,
AdsInsightsActionProductID,
AdsInsightsActionReaction,
AdsInsightsActionType,
AdsInsightsActionVideoSound,
AdsInsightsActionVideoType,
AdsInsightsAgeAndGender,
AdsInsightsCountry,
AdsInsightsDeliveryDevice,
AdsInsightsDeliveryPlatform,
AdsInsightsDeliveryPlatformAndDevicePlatform,
AdsInsightsDemographicsAge,
AdsInsightsDemographicsCountry,
AdsInsightsDemographicsDMARegion,
AdsInsightsDemographicsGender,
AdsInsightsDma,
AdsInsightsPlatformAndDevice,
AdsInsightsRegion,
Campaigns,
CustomConversions,
Images,
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/facebook-marketing.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Please be informed that the connector uses the `lookback_window` parameter to pe

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 0.4.1 | 2023-06-02 | [26941](https://github.com/airbytehq/airbyte/pull/26941) | Remove `authSpecification` from spec.json, use `advanced_auth` instead |
| 0.4.0 | 2023-05-29 | [26720](https://github.com/airbytehq/airbyte/pull/26720) | Add Prebuilt Ad Insights reports |
| 0.3.7 | 2023-05-12 | [26000](https://github.com/airbytehq/airbyte/pull/26000) | Handle config errors |
| 0.3.6 | 2023-04-27 | [22999](https://github.com/airbytehq/airbyte/pull/22999) | Specified date formatting in specification |
Expand Down
Loading