airbyte-agent-amazon-ads 0.1.24__py3-none-any.whl → 0.1.25__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airbyte_agent_amazon_ads/_vendored/connector_sdk/cloud_utils/client.py +72 -9
- airbyte_agent_amazon_ads/connector.py +91 -4
- {airbyte_agent_amazon_ads-0.1.24.dist-info → airbyte_agent_amazon_ads-0.1.25.dist-info}/METADATA +3 -3
- {airbyte_agent_amazon_ads-0.1.24.dist-info → airbyte_agent_amazon_ads-0.1.25.dist-info}/RECORD +5 -5
- {airbyte_agent_amazon_ads-0.1.24.dist-info → airbyte_agent_amazon_ads-0.1.25.dist-info}/WHEEL +0 -0
|
@@ -161,24 +161,80 @@ class AirbyteCloudClient:
|
|
|
161
161
|
connector_id = connectors[0]["id"]
|
|
162
162
|
return connector_id
|
|
163
163
|
|
|
164
|
+
async def initiate_oauth(
|
|
165
|
+
self,
|
|
166
|
+
definition_id: str,
|
|
167
|
+
external_user_id: str,
|
|
168
|
+
redirect_url: str,
|
|
169
|
+
) -> str:
|
|
170
|
+
"""Initiate a server-side OAuth flow.
|
|
171
|
+
|
|
172
|
+
Starts the OAuth flow for a connector. Returns a consent URL where the
|
|
173
|
+
end user should be redirected to grant access. After completing consent,
|
|
174
|
+
they'll be redirected to your redirect_url with a `server_side_oauth_secret_id`
|
|
175
|
+
query parameter that can be used with `create_source()`.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
definition_id: Connector definition UUID
|
|
179
|
+
external_user_id: Workspace identifier
|
|
180
|
+
redirect_url: URL where users will be redirected after OAuth consent
|
|
181
|
+
|
|
182
|
+
Returns:
|
|
183
|
+
The OAuth consent URL
|
|
184
|
+
|
|
185
|
+
Raises:
|
|
186
|
+
httpx.HTTPStatusError: If the request fails
|
|
187
|
+
|
|
188
|
+
Example:
|
|
189
|
+
consent_url = await client.initiate_oauth(
|
|
190
|
+
definition_id="d8313939-3782-41b0-be29-b3ca20d8dd3a",
|
|
191
|
+
external_user_id="my-workspace",
|
|
192
|
+
redirect_url="https://myapp.com/oauth/callback",
|
|
193
|
+
)
|
|
194
|
+
# Redirect user to: consent_url
|
|
195
|
+
# After consent: https://myapp.com/oauth/callback?server_side_oauth_secret_id=...
|
|
196
|
+
"""
|
|
197
|
+
token = await self.get_bearer_token()
|
|
198
|
+
url = f"{self.API_BASE_URL}/api/v1/integrations/connectors/oauth/initiate"
|
|
199
|
+
headers = {"Authorization": f"Bearer {token}"}
|
|
200
|
+
request_body = {
|
|
201
|
+
"external_user_id": external_user_id,
|
|
202
|
+
"definition_id": definition_id,
|
|
203
|
+
"redirect_url": redirect_url,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
response = await self._http_client.post(url, json=request_body, headers=headers)
|
|
207
|
+
response.raise_for_status()
|
|
208
|
+
return response.json()["consent_url"]
|
|
209
|
+
|
|
164
210
|
async def create_source(
|
|
165
211
|
self,
|
|
166
212
|
name: str,
|
|
167
213
|
connector_definition_id: str,
|
|
168
214
|
external_user_id: str,
|
|
169
|
-
credentials: dict[str, Any],
|
|
215
|
+
credentials: dict[str, Any] | None = None,
|
|
170
216
|
replication_config: dict[str, Any] | None = None,
|
|
217
|
+
server_side_oauth_secret_id: str | None = None,
|
|
218
|
+
source_template_id: str | None = None,
|
|
171
219
|
) -> str:
|
|
172
|
-
"""Create a new source on Airbyte
|
|
220
|
+
"""Create a new source on Airbyte Cloud.
|
|
221
|
+
|
|
222
|
+
Supports two authentication modes:
|
|
223
|
+
1. Direct credentials: Provide `credentials` dict
|
|
224
|
+
2. Server-side OAuth: Provide `server_side_oauth_secret_id` from OAuth flow
|
|
173
225
|
|
|
174
226
|
Args:
|
|
175
227
|
name: Source name
|
|
176
228
|
connector_definition_id: UUID of the connector definition
|
|
177
229
|
external_user_id: User identifier
|
|
178
|
-
credentials: Connector auth config dict
|
|
230
|
+
credentials: Connector auth config dict. Required unless using OAuth.
|
|
179
231
|
replication_config: Optional replication settings (e.g., start_date for
|
|
180
232
|
connectors with x-airbyte-replication-config). Required for REPLICATION
|
|
181
233
|
mode sources like Intercom.
|
|
234
|
+
server_side_oauth_secret_id: OAuth secret ID from initiate_oauth redirect.
|
|
235
|
+
When provided, credentials are not required.
|
|
236
|
+
source_template_id: Source template ID. Required when organization has
|
|
237
|
+
multiple source templates for this connector type.
|
|
182
238
|
|
|
183
239
|
Returns:
|
|
184
240
|
The created source ID (UUID string)
|
|
@@ -187,19 +243,21 @@ class AirbyteCloudClient:
|
|
|
187
243
|
httpx.HTTPStatusError: If creation fails
|
|
188
244
|
|
|
189
245
|
Example:
|
|
246
|
+
# With direct credentials:
|
|
190
247
|
source_id = await client.create_source(
|
|
191
|
-
name="My
|
|
192
|
-
connector_definition_id="
|
|
248
|
+
name="My Intercom Source",
|
|
249
|
+
connector_definition_id="d8313939-3782-41b0-be29-b3ca20d8dd3a",
|
|
193
250
|
external_user_id="my-workspace",
|
|
194
|
-
credentials={"
|
|
251
|
+
credentials={"access_token": "..."},
|
|
252
|
+
replication_config={"start_date": "2024-01-01T00:00:00Z"}
|
|
195
253
|
)
|
|
196
254
|
|
|
197
|
-
#
|
|
255
|
+
# With server-side OAuth:
|
|
198
256
|
source_id = await client.create_source(
|
|
199
257
|
name="My Intercom Source",
|
|
200
258
|
connector_definition_id="d8313939-3782-41b0-be29-b3ca20d8dd3a",
|
|
201
259
|
external_user_id="my-workspace",
|
|
202
|
-
|
|
260
|
+
server_side_oauth_secret_id="airbyte_oauth_..._secret_...",
|
|
203
261
|
replication_config={"start_date": "2024-01-01T00:00:00Z"}
|
|
204
262
|
)
|
|
205
263
|
"""
|
|
@@ -211,11 +269,16 @@ class AirbyteCloudClient:
|
|
|
211
269
|
"name": name,
|
|
212
270
|
"definition_id": connector_definition_id,
|
|
213
271
|
"external_user_id": external_user_id,
|
|
214
|
-
"credentials": credentials,
|
|
215
272
|
}
|
|
216
273
|
|
|
274
|
+
if credentials is not None:
|
|
275
|
+
request_body["credentials"] = credentials
|
|
217
276
|
if replication_config is not None:
|
|
218
277
|
request_body["replication_config"] = replication_config
|
|
278
|
+
if server_side_oauth_secret_id is not None:
|
|
279
|
+
request_body["server_side_oauth_secret_id"] = server_side_oauth_secret_id
|
|
280
|
+
if source_template_id is not None:
|
|
281
|
+
request_body["source_template_id"] = source_template_id
|
|
219
282
|
|
|
220
283
|
response = await self._http_client.post(url, json=request_body, headers=headers)
|
|
221
284
|
response.raise_for_status()
|
|
@@ -508,6 +508,59 @@ class AmazonAdsConnector:
|
|
|
508
508
|
|
|
509
509
|
# ===== HOSTED MODE FACTORY =====
|
|
510
510
|
|
|
511
|
+
@classmethod
|
|
512
|
+
async def initiate_oauth(
|
|
513
|
+
cls,
|
|
514
|
+
*,
|
|
515
|
+
external_user_id: str,
|
|
516
|
+
redirect_url: str,
|
|
517
|
+
airbyte_client_id: str,
|
|
518
|
+
airbyte_client_secret: str,
|
|
519
|
+
) -> str:
|
|
520
|
+
"""
|
|
521
|
+
Initiate server-side OAuth flow for this connector.
|
|
522
|
+
|
|
523
|
+
Returns a consent URL where the end user should be redirected to grant access.
|
|
524
|
+
After completing consent, they'll be redirected to your redirect_url with a
|
|
525
|
+
`server_side_oauth_secret_id` query parameter that can be used with `create_hosted()`.
|
|
526
|
+
|
|
527
|
+
Args:
|
|
528
|
+
external_user_id: Workspace identifier in Airbyte Cloud
|
|
529
|
+
redirect_url: URL where users will be redirected after OAuth consent
|
|
530
|
+
airbyte_client_id: Airbyte OAuth client ID
|
|
531
|
+
airbyte_client_secret: Airbyte OAuth client secret
|
|
532
|
+
|
|
533
|
+
Returns:
|
|
534
|
+
The OAuth consent URL
|
|
535
|
+
|
|
536
|
+
Example:
|
|
537
|
+
consent_url = await AmazonAdsConnector.initiate_oauth(
|
|
538
|
+
external_user_id="my-workspace",
|
|
539
|
+
redirect_url="https://myapp.com/oauth/callback",
|
|
540
|
+
airbyte_client_id="client_abc",
|
|
541
|
+
airbyte_client_secret="secret_xyz",
|
|
542
|
+
)
|
|
543
|
+
# Redirect user to: consent_url
|
|
544
|
+
# After consent, user arrives at: https://myapp.com/oauth/callback?server_side_oauth_secret_id=...
|
|
545
|
+
"""
|
|
546
|
+
from ._vendored.connector_sdk.cloud_utils import AirbyteCloudClient
|
|
547
|
+
|
|
548
|
+
client = AirbyteCloudClient(
|
|
549
|
+
client_id=airbyte_client_id,
|
|
550
|
+
client_secret=airbyte_client_secret,
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
try:
|
|
554
|
+
consent_url = await client.initiate_oauth(
|
|
555
|
+
definition_id=str(AmazonAdsConnectorModel.id),
|
|
556
|
+
external_user_id=external_user_id,
|
|
557
|
+
redirect_url=redirect_url,
|
|
558
|
+
)
|
|
559
|
+
finally:
|
|
560
|
+
await client.close()
|
|
561
|
+
|
|
562
|
+
return consent_url
|
|
563
|
+
|
|
511
564
|
@classmethod
|
|
512
565
|
async def create_hosted(
|
|
513
566
|
cls,
|
|
@@ -515,9 +568,11 @@ class AmazonAdsConnector:
|
|
|
515
568
|
external_user_id: str,
|
|
516
569
|
airbyte_client_id: str,
|
|
517
570
|
airbyte_client_secret: str,
|
|
518
|
-
auth_config: "AmazonAdsAuthConfig",
|
|
571
|
+
auth_config: "AmazonAdsAuthConfig" | None = None,
|
|
572
|
+
server_side_oauth_secret_id: str | None = None,
|
|
519
573
|
name: str | None = None,
|
|
520
574
|
replication_config: dict[str, Any] | None = None,
|
|
575
|
+
source_template_id: str | None = None,
|
|
521
576
|
) -> "AmazonAdsConnector":
|
|
522
577
|
"""
|
|
523
578
|
Create a new hosted connector on Airbyte Cloud.
|
|
@@ -526,18 +581,29 @@ class AmazonAdsConnector:
|
|
|
526
581
|
1. Creates a source on Airbyte Cloud with the provided credentials
|
|
527
582
|
2. Returns a connector configured with the new connector_id
|
|
528
583
|
|
|
584
|
+
Supports two authentication modes:
|
|
585
|
+
1. Direct credentials: Provide `auth_config` with typed credentials
|
|
586
|
+
2. Server-side OAuth: Provide `server_side_oauth_secret_id` from OAuth flow
|
|
587
|
+
|
|
529
588
|
Args:
|
|
530
589
|
external_user_id: Workspace identifier in Airbyte Cloud
|
|
531
590
|
airbyte_client_id: Airbyte OAuth client ID
|
|
532
591
|
airbyte_client_secret: Airbyte OAuth client secret
|
|
533
|
-
auth_config: Typed auth config
|
|
592
|
+
auth_config: Typed auth config. Required unless using server_side_oauth_secret_id.
|
|
593
|
+
server_side_oauth_secret_id: OAuth secret ID from initiate_oauth redirect.
|
|
594
|
+
When provided, auth_config is not required.
|
|
534
595
|
name: Optional source name (defaults to connector name + external_user_id)
|
|
535
596
|
replication_config: Optional replication settings dict.
|
|
536
597
|
Required for connectors with x-airbyte-replication-config (REPLICATION mode sources).
|
|
598
|
+
source_template_id: Source template ID. Required when organization has
|
|
599
|
+
multiple source templates for this connector type.
|
|
537
600
|
|
|
538
601
|
Returns:
|
|
539
602
|
A AmazonAdsConnector instance configured in hosted mode
|
|
540
603
|
|
|
604
|
+
Raises:
|
|
605
|
+
ValueError: If neither or both auth_config and server_side_oauth_secret_id provided
|
|
606
|
+
|
|
541
607
|
Example:
|
|
542
608
|
# Create a new hosted connector with API key auth
|
|
543
609
|
connector = await AmazonAdsConnector.create_hosted(
|
|
@@ -547,9 +613,27 @@ class AmazonAdsConnector:
|
|
|
547
613
|
auth_config=AmazonAdsAuthConfig(client_id="...", client_secret="...", refresh_token="..."),
|
|
548
614
|
)
|
|
549
615
|
|
|
616
|
+
# With server-side OAuth:
|
|
617
|
+
connector = await AmazonAdsConnector.create_hosted(
|
|
618
|
+
external_user_id="my-workspace",
|
|
619
|
+
airbyte_client_id="client_abc",
|
|
620
|
+
airbyte_client_secret="secret_xyz",
|
|
621
|
+
server_side_oauth_secret_id="airbyte_oauth_..._secret_...",
|
|
622
|
+
)
|
|
623
|
+
|
|
550
624
|
# Use the connector
|
|
551
625
|
result = await connector.execute("entity", "list", {})
|
|
552
626
|
"""
|
|
627
|
+
# Validate: exactly one of auth_config or server_side_oauth_secret_id required
|
|
628
|
+
if auth_config is None and server_side_oauth_secret_id is None:
|
|
629
|
+
raise ValueError(
|
|
630
|
+
"Either auth_config or server_side_oauth_secret_id must be provided"
|
|
631
|
+
)
|
|
632
|
+
if auth_config is not None and server_side_oauth_secret_id is not None:
|
|
633
|
+
raise ValueError(
|
|
634
|
+
"Cannot provide both auth_config and server_side_oauth_secret_id"
|
|
635
|
+
)
|
|
636
|
+
|
|
553
637
|
from ._vendored.connector_sdk.cloud_utils import AirbyteCloudClient
|
|
554
638
|
|
|
555
639
|
client = AirbyteCloudClient(
|
|
@@ -558,8 +642,8 @@ class AmazonAdsConnector:
|
|
|
558
642
|
)
|
|
559
643
|
|
|
560
644
|
try:
|
|
561
|
-
# Build credentials from auth_config
|
|
562
|
-
credentials = auth_config.model_dump(exclude_none=True)
|
|
645
|
+
# Build credentials from auth_config (if provided)
|
|
646
|
+
credentials = auth_config.model_dump(exclude_none=True) if auth_config else None
|
|
563
647
|
replication_config_dict = replication_config.model_dump(exclude_none=True) if replication_config else None
|
|
564
648
|
|
|
565
649
|
# Create source on Airbyte Cloud
|
|
@@ -570,6 +654,8 @@ class AmazonAdsConnector:
|
|
|
570
654
|
external_user_id=external_user_id,
|
|
571
655
|
credentials=credentials,
|
|
572
656
|
replication_config=replication_config_dict,
|
|
657
|
+
server_side_oauth_secret_id=server_side_oauth_secret_id,
|
|
658
|
+
source_template_id=source_template_id,
|
|
573
659
|
)
|
|
574
660
|
finally:
|
|
575
661
|
await client.close()
|
|
@@ -583,6 +669,7 @@ class AmazonAdsConnector:
|
|
|
583
669
|
|
|
584
670
|
|
|
585
671
|
|
|
672
|
+
|
|
586
673
|
class ProfilesQuery:
|
|
587
674
|
"""
|
|
588
675
|
Query class for Profiles entity operations.
|
{airbyte_agent_amazon_ads-0.1.24.dist-info → airbyte_agent_amazon_ads-0.1.25.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: airbyte-agent-amazon-ads
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.25
|
|
4
4
|
Summary: Airbyte Amazon-Ads Connector for AI platforms
|
|
5
5
|
Project-URL: Homepage, https://github.com/airbytehq/airbyte-agent-connectors
|
|
6
6
|
Project-URL: Documentation, https://docs.airbyte.com/ai-agents/
|
|
@@ -135,7 +135,7 @@ See the official [Amazon-Ads API reference](https://advertising.amazon.com/API/d
|
|
|
135
135
|
|
|
136
136
|
## Version information
|
|
137
137
|
|
|
138
|
-
- **Package version:** 0.1.
|
|
138
|
+
- **Package version:** 0.1.25
|
|
139
139
|
- **Connector version:** 1.0.5
|
|
140
|
-
- **Generated with Connector SDK commit SHA:**
|
|
140
|
+
- **Generated with Connector SDK commit SHA:** 9d9866b0aae8c3494d04d34e193b9bd860bfc1c6
|
|
141
141
|
- **Changelog:** [View changelog](https://github.com/airbytehq/airbyte-agent-connectors/blob/main/connectors/amazon-ads/CHANGELOG.md)
|
{airbyte_agent_amazon_ads-0.1.24.dist-info → airbyte_agent_amazon_ads-0.1.25.dist-info}/RECORD
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
airbyte_agent_amazon_ads/__init__.py,sha256=MICR9abWiXLcSQ0jd4W7S6xyo2KgwRjOPIZTeHpz67I,1950
|
|
2
|
-
airbyte_agent_amazon_ads/connector.py,sha256=
|
|
2
|
+
airbyte_agent_amazon_ads/connector.py,sha256=9r5mxeos61jzP-tTNJf4UB2h6XCXoMs5T5E7r2xhqFg,33158
|
|
3
3
|
airbyte_agent_amazon_ads/connector_model.py,sha256=QAxt_l2-RjUBxg2izmclOPTqVrjF9CL70fOkkYcwpTk,98041
|
|
4
4
|
airbyte_agent_amazon_ads/models.py,sha256=KmYWz46e-8HuQdnuz6FQT99uDKwpcToEc9Xda2M7FL4,9781
|
|
5
5
|
airbyte_agent_amazon_ads/types.py,sha256=EW-jvOmXyJQqe2ESiDCs7nCIIsFreDCIZBlA6aplxpA,6728
|
|
@@ -19,7 +19,7 @@ airbyte_agent_amazon_ads/_vendored/connector_sdk/utils.py,sha256=UYwYuSLhsDD-4C0
|
|
|
19
19
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/validation.py,sha256=w5WGnmILkdBslpXhAXhKhE-c8ANBc_OZQxr_fUeAgtc,39666
|
|
20
20
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/validation_replication.py,sha256=v7F5YWd5m4diIF7_4m4nOkC9crg97vqRUUkt9ka9HZ4,36043
|
|
21
21
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/cloud_utils/__init__.py,sha256=4799Hv9f2zxDVj1aLyQ8JpTEuFTp_oOZMRz-NZCdBJg,134
|
|
22
|
-
airbyte_agent_amazon_ads/_vendored/connector_sdk/cloud_utils/client.py,sha256
|
|
22
|
+
airbyte_agent_amazon_ads/_vendored/connector_sdk/cloud_utils/client.py,sha256=e0VLNCmesGGfo2uD0GiICgXsXTeTkh0GYiVgx_e4VEc,12296
|
|
23
23
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/executor/__init__.py,sha256=EmG9YQNAjSuYCVB4D5VoLm4qpD1KfeiiOf7bpALj8p8,702
|
|
24
24
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/executor/hosted_executor.py,sha256=tv0njAdy-gdHBg4izgcxhEWYbrNiBifEYEca9AWzaL0,8693
|
|
25
25
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/executor/local_executor.py,sha256=RtdTXFzfoJz5Coz9nwQi81Df1402BRgO1Mgd3ZzTkfw,76581
|
|
@@ -53,6 +53,6 @@ airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/__init__.py,sha256=Ra
|
|
|
53
53
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/config.py,sha256=tLmQwAFD0kP1WyBGWBS3ysaudN9H3e-3EopKZi6cGKg,885
|
|
54
54
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/events.py,sha256=8Y1NbXiwISX-V_wRofY7PqcwEXD0dLMnntKkY6XFU2s,1328
|
|
55
55
|
airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/tracker.py,sha256=SginFQbHqVUVYG82NnNzG34O-tAQ_wZYjGDcuo0q4Kk,5584
|
|
56
|
-
airbyte_agent_amazon_ads-0.1.
|
|
57
|
-
airbyte_agent_amazon_ads-0.1.
|
|
58
|
-
airbyte_agent_amazon_ads-0.1.
|
|
56
|
+
airbyte_agent_amazon_ads-0.1.25.dist-info/METADATA,sha256=mgsYZFR2QZ1zOj3x28WcdeuxnD6HibWamIMoq6vwF3o,5326
|
|
57
|
+
airbyte_agent_amazon_ads-0.1.25.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
58
|
+
airbyte_agent_amazon_ads-0.1.25.dist-info/RECORD,,
|
{airbyte_agent_amazon_ads-0.1.24.dist-info → airbyte_agent_amazon_ads-0.1.25.dist-info}/WHEEL
RENAMED
|
File without changes
|