airbyte-agent-zendesk-support 0.18.76__py3-none-any.whl → 0.18.78__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_zendesk_support/_vendored/connector_sdk/cloud_utils/client.py +125 -0
- airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/hosted_executor.py +54 -25
- airbyte_agent_zendesk_support/connector.py +199 -9
- {airbyte_agent_zendesk_support-0.18.76.dist-info → airbyte_agent_zendesk_support-0.18.78.dist-info}/METADATA +3 -3
- {airbyte_agent_zendesk_support-0.18.76.dist-info → airbyte_agent_zendesk_support-0.18.78.dist-info}/RECORD +6 -6
- {airbyte_agent_zendesk_support-0.18.76.dist-info → airbyte_agent_zendesk_support-0.18.78.dist-info}/WHEEL +0 -0
|
@@ -161,6 +161,131 @@ 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
|
+
|
|
210
|
+
async def create_source(
|
|
211
|
+
self,
|
|
212
|
+
name: str,
|
|
213
|
+
connector_definition_id: str,
|
|
214
|
+
external_user_id: str,
|
|
215
|
+
credentials: dict[str, Any] | None = None,
|
|
216
|
+
replication_config: dict[str, Any] | None = None,
|
|
217
|
+
server_side_oauth_secret_id: str | None = None,
|
|
218
|
+
source_template_id: str | None = None,
|
|
219
|
+
) -> str:
|
|
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
|
|
225
|
+
|
|
226
|
+
Args:
|
|
227
|
+
name: Source name
|
|
228
|
+
connector_definition_id: UUID of the connector definition
|
|
229
|
+
external_user_id: User identifier
|
|
230
|
+
credentials: Connector auth config dict. Required unless using OAuth.
|
|
231
|
+
replication_config: Optional replication settings (e.g., start_date for
|
|
232
|
+
connectors with x-airbyte-replication-config). Required for REPLICATION
|
|
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.
|
|
238
|
+
|
|
239
|
+
Returns:
|
|
240
|
+
The created source ID (UUID string)
|
|
241
|
+
|
|
242
|
+
Raises:
|
|
243
|
+
httpx.HTTPStatusError: If creation fails
|
|
244
|
+
|
|
245
|
+
Example:
|
|
246
|
+
# With direct credentials:
|
|
247
|
+
source_id = await client.create_source(
|
|
248
|
+
name="My Intercom Source",
|
|
249
|
+
connector_definition_id="d8313939-3782-41b0-be29-b3ca20d8dd3a",
|
|
250
|
+
external_user_id="my-workspace",
|
|
251
|
+
credentials={"access_token": "..."},
|
|
252
|
+
replication_config={"start_date": "2024-01-01T00:00:00Z"}
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
# With server-side OAuth:
|
|
256
|
+
source_id = await client.create_source(
|
|
257
|
+
name="My Intercom Source",
|
|
258
|
+
connector_definition_id="d8313939-3782-41b0-be29-b3ca20d8dd3a",
|
|
259
|
+
external_user_id="my-workspace",
|
|
260
|
+
server_side_oauth_secret_id="airbyte_oauth_..._secret_...",
|
|
261
|
+
replication_config={"start_date": "2024-01-01T00:00:00Z"}
|
|
262
|
+
)
|
|
263
|
+
"""
|
|
264
|
+
token = await self.get_bearer_token()
|
|
265
|
+
url = f"{self.API_BASE_URL}/v1/integrations/connectors"
|
|
266
|
+
headers = {"Authorization": f"Bearer {token}"}
|
|
267
|
+
|
|
268
|
+
request_body: dict[str, Any] = {
|
|
269
|
+
"name": name,
|
|
270
|
+
"definition_id": connector_definition_id,
|
|
271
|
+
"external_user_id": external_user_id,
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
if credentials is not None:
|
|
275
|
+
request_body["credentials"] = credentials
|
|
276
|
+
if replication_config is not None:
|
|
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
|
|
282
|
+
|
|
283
|
+
response = await self._http_client.post(url, json=request_body, headers=headers)
|
|
284
|
+
response.raise_for_status()
|
|
285
|
+
|
|
286
|
+
data = response.json()
|
|
287
|
+
return data["id"]
|
|
288
|
+
|
|
164
289
|
async def execute_connector(
|
|
165
290
|
self,
|
|
166
291
|
connector_id: str,
|
|
@@ -19,19 +19,26 @@ class HostedExecutor:
|
|
|
19
19
|
instead of directly calling external services. The cloud API handles all
|
|
20
20
|
connector logic, secrets management, and execution.
|
|
21
21
|
|
|
22
|
-
The executor
|
|
22
|
+
The executor uses the AirbyteCloudClient to:
|
|
23
23
|
1. Authenticate with the Airbyte Platform (bearer token with caching)
|
|
24
|
-
2. Look up the user's connector
|
|
24
|
+
2. Look up the user's connector (if connector_id not provided)
|
|
25
25
|
3. Execute the connector operation via the cloud API
|
|
26
26
|
|
|
27
27
|
Implements ExecutorProtocol.
|
|
28
28
|
|
|
29
29
|
Example:
|
|
30
|
-
# Create executor with
|
|
30
|
+
# Create executor with explicit connector_id (no lookup needed)
|
|
31
|
+
executor = HostedExecutor(
|
|
32
|
+
airbyte_client_id="client_abc123",
|
|
33
|
+
airbyte_client_secret="secret_xyz789",
|
|
34
|
+
connector_id="existing-source-uuid",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# Or create executor with user ID for lookup
|
|
31
38
|
executor = HostedExecutor(
|
|
32
|
-
external_user_id="user-123",
|
|
33
39
|
airbyte_client_id="client_abc123",
|
|
34
40
|
airbyte_client_secret="secret_xyz789",
|
|
41
|
+
external_user_id="user-123",
|
|
35
42
|
connector_definition_id="abc123-def456-ghi789",
|
|
36
43
|
)
|
|
37
44
|
|
|
@@ -51,28 +58,48 @@ class HostedExecutor:
|
|
|
51
58
|
|
|
52
59
|
def __init__(
|
|
53
60
|
self,
|
|
54
|
-
external_user_id: str,
|
|
55
61
|
airbyte_client_id: str,
|
|
56
62
|
airbyte_client_secret: str,
|
|
57
|
-
|
|
63
|
+
connector_id: str | None = None,
|
|
64
|
+
external_user_id: str | None = None,
|
|
65
|
+
connector_definition_id: str | None = None,
|
|
58
66
|
):
|
|
59
67
|
"""Initialize hosted executor.
|
|
60
68
|
|
|
69
|
+
Either provide connector_id directly OR (external_user_id + connector_definition_id)
|
|
70
|
+
for lookup.
|
|
71
|
+
|
|
61
72
|
Args:
|
|
62
|
-
external_user_id: User identifier in the Airbyte system
|
|
63
73
|
airbyte_client_id: Airbyte client ID for authentication
|
|
64
74
|
airbyte_client_secret: Airbyte client secret for authentication
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
connector_id: Direct connector/source ID (skips lookup if provided)
|
|
76
|
+
external_user_id: User identifier in the Airbyte system (for lookup)
|
|
77
|
+
connector_definition_id: Connector definition ID (for lookup)
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
ValueError: If neither connector_id nor (external_user_id + connector_definition_id) provided
|
|
67
81
|
|
|
68
82
|
Example:
|
|
83
|
+
# With explicit connector_id (no lookup)
|
|
84
|
+
executor = HostedExecutor(
|
|
85
|
+
airbyte_client_id="client_abc123",
|
|
86
|
+
airbyte_client_secret="secret_xyz789",
|
|
87
|
+
connector_id="existing-source-uuid",
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
# With lookup by user + definition
|
|
69
91
|
executor = HostedExecutor(
|
|
70
|
-
external_user_id="user-123",
|
|
71
92
|
airbyte_client_id="client_abc123",
|
|
72
93
|
airbyte_client_secret="secret_xyz789",
|
|
94
|
+
external_user_id="user-123",
|
|
73
95
|
connector_definition_id="abc123-def456-ghi789",
|
|
74
96
|
)
|
|
75
97
|
"""
|
|
98
|
+
# Validate: either connector_id OR (external_user_id + connector_definition_id) required
|
|
99
|
+
if not connector_id and not (external_user_id and connector_definition_id):
|
|
100
|
+
raise ValueError("Either connector_id OR (external_user_id + connector_definition_id) must be provided")
|
|
101
|
+
|
|
102
|
+
self._connector_id = connector_id
|
|
76
103
|
self._external_user_id = external_user_id
|
|
77
104
|
self._connector_definition_id = connector_definition_id
|
|
78
105
|
|
|
@@ -86,10 +113,9 @@ class HostedExecutor:
|
|
|
86
113
|
"""Execute connector via cloud API (ExecutorProtocol implementation).
|
|
87
114
|
|
|
88
115
|
Flow:
|
|
89
|
-
1.
|
|
90
|
-
2.
|
|
91
|
-
3.
|
|
92
|
-
4. Parse the response into ExecutionResult
|
|
116
|
+
1. Use provided connector_id or look up from external_user_id + definition_id
|
|
117
|
+
2. Execute the connector operation via the cloud API
|
|
118
|
+
3. Parse the response into ExecutionResult
|
|
93
119
|
|
|
94
120
|
Args:
|
|
95
121
|
config: Execution configuration (entity, action, params)
|
|
@@ -98,7 +124,7 @@ class HostedExecutor:
|
|
|
98
124
|
ExecutionResult with success/failure status
|
|
99
125
|
|
|
100
126
|
Raises:
|
|
101
|
-
ValueError: If no connector or multiple connectors found for user
|
|
127
|
+
ValueError: If no connector or multiple connectors found for user (when doing lookup)
|
|
102
128
|
httpx.HTTPStatusError: If API returns 4xx/5xx status code
|
|
103
129
|
httpx.RequestError: If network request fails
|
|
104
130
|
|
|
@@ -114,23 +140,26 @@ class HostedExecutor:
|
|
|
114
140
|
|
|
115
141
|
with tracer.start_as_current_span("airbyte.hosted_executor.execute") as span:
|
|
116
142
|
# Add span attributes for observability
|
|
117
|
-
|
|
143
|
+
if self._connector_definition_id:
|
|
144
|
+
span.set_attribute("connector.definition_id", self._connector_definition_id)
|
|
118
145
|
span.set_attribute("connector.entity", config.entity)
|
|
119
146
|
span.set_attribute("connector.action", config.action)
|
|
120
|
-
|
|
147
|
+
if self._external_user_id:
|
|
148
|
+
span.set_attribute("user.external_id", self._external_user_id)
|
|
121
149
|
if config.params:
|
|
122
150
|
# Only add non-sensitive param keys
|
|
123
151
|
span.set_attribute("connector.param_keys", list(config.params.keys()))
|
|
124
152
|
|
|
125
153
|
try:
|
|
126
|
-
#
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
154
|
+
# Use provided connector_id or look it up
|
|
155
|
+
if self._connector_id:
|
|
156
|
+
connector_id = self._connector_id
|
|
157
|
+
else:
|
|
158
|
+
# Look up connector by external_user_id + definition_id
|
|
159
|
+
connector_id = await self._cloud_client.get_connector_id(
|
|
160
|
+
external_user_id=self._external_user_id, # type: ignore[arg-type]
|
|
161
|
+
connector_definition_id=self._connector_definition_id, # type: ignore[arg-type]
|
|
162
|
+
)
|
|
134
163
|
|
|
135
164
|
span.set_attribute("connector.connector_id", connector_id)
|
|
136
165
|
|
|
@@ -84,6 +84,7 @@ from .types import (
|
|
|
84
84
|
)
|
|
85
85
|
if TYPE_CHECKING:
|
|
86
86
|
from .models import ZendeskSupportAuthConfig
|
|
87
|
+
|
|
87
88
|
# Import specific auth config classes for multi-auth isinstance checks
|
|
88
89
|
from .models import ZendeskSupportOauth20AuthConfig, ZendeskSupportApiTokenAuthConfig
|
|
89
90
|
# Import response models and envelope models at runtime
|
|
@@ -305,6 +306,7 @@ class ZendeskSupportConnector:
|
|
|
305
306
|
external_user_id: str | None = None,
|
|
306
307
|
airbyte_client_id: str | None = None,
|
|
307
308
|
airbyte_client_secret: str | None = None,
|
|
309
|
+
connector_id: str | None = None,
|
|
308
310
|
on_token_refresh: Any | None = None,
|
|
309
311
|
subdomain: str | None = None ):
|
|
310
312
|
"""
|
|
@@ -312,20 +314,28 @@ class ZendeskSupportConnector:
|
|
|
312
314
|
|
|
313
315
|
Supports both local and hosted execution modes:
|
|
314
316
|
- Local mode: Provide `auth_config` for direct API calls
|
|
315
|
-
- Hosted mode: Provide
|
|
317
|
+
- Hosted mode: Provide Airbyte credentials with either `connector_id` or `external_user_id`
|
|
316
318
|
|
|
317
319
|
Args:
|
|
318
320
|
auth_config: Typed authentication configuration (required for local mode)
|
|
319
|
-
external_user_id: External user ID (
|
|
321
|
+
external_user_id: External user ID (for hosted mode lookup)
|
|
320
322
|
airbyte_client_id: Airbyte OAuth client ID (required for hosted mode)
|
|
321
323
|
airbyte_client_secret: Airbyte OAuth client secret (required for hosted mode)
|
|
324
|
+
connector_id: Specific connector/source ID (for hosted mode, skips lookup)
|
|
322
325
|
on_token_refresh: Optional callback for OAuth2 token refresh persistence.
|
|
323
326
|
Called with new_tokens dict when tokens are refreshed. Can be sync or async.
|
|
324
327
|
Example: lambda tokens: save_to_database(tokens) subdomain: Your Zendesk subdomain
|
|
325
328
|
Examples:
|
|
326
329
|
# Local mode (direct API calls)
|
|
327
330
|
connector = ZendeskSupportConnector(auth_config=ZendeskSupportAuthConfig(access_token="...", refresh_token="..."))
|
|
328
|
-
# Hosted mode (
|
|
331
|
+
# Hosted mode with explicit connector_id (no lookup needed)
|
|
332
|
+
connector = ZendeskSupportConnector(
|
|
333
|
+
airbyte_client_id="client_abc123",
|
|
334
|
+
airbyte_client_secret="secret_xyz789",
|
|
335
|
+
connector_id="existing-source-uuid"
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
# Hosted mode with lookup by external_user_id
|
|
329
339
|
connector = ZendeskSupportConnector(
|
|
330
340
|
external_user_id="user-123",
|
|
331
341
|
airbyte_client_id="client_abc123",
|
|
@@ -343,21 +353,24 @@ class ZendeskSupportConnector:
|
|
|
343
353
|
on_token_refresh=save_tokens
|
|
344
354
|
)
|
|
345
355
|
"""
|
|
346
|
-
# Hosted mode:
|
|
347
|
-
|
|
356
|
+
# Hosted mode: Airbyte credentials + either connector_id OR external_user_id
|
|
357
|
+
is_hosted = airbyte_client_id and airbyte_client_secret and (connector_id or external_user_id)
|
|
358
|
+
|
|
359
|
+
if is_hosted:
|
|
348
360
|
from ._vendored.connector_sdk.executor import HostedExecutor
|
|
349
361
|
self._executor = HostedExecutor(
|
|
350
|
-
external_user_id=external_user_id,
|
|
351
362
|
airbyte_client_id=airbyte_client_id,
|
|
352
363
|
airbyte_client_secret=airbyte_client_secret,
|
|
353
|
-
|
|
364
|
+
connector_id=connector_id,
|
|
365
|
+
external_user_id=external_user_id,
|
|
366
|
+
connector_definition_id=str(ZendeskSupportConnectorModel.id) if not connector_id else None,
|
|
354
367
|
)
|
|
355
368
|
else:
|
|
356
369
|
# Local mode: auth_config required
|
|
357
370
|
if not auth_config:
|
|
358
371
|
raise ValueError(
|
|
359
|
-
"Either provide (
|
|
360
|
-
"or auth_config for local mode"
|
|
372
|
+
"Either provide Airbyte credentials (airbyte_client_id, airbyte_client_secret) with "
|
|
373
|
+
"connector_id or external_user_id for hosted mode, or auth_config for local mode"
|
|
361
374
|
)
|
|
362
375
|
|
|
363
376
|
from ._vendored.connector_sdk.executor import LocalExecutor
|
|
@@ -957,6 +970,183 @@ class ZendeskSupportConnector:
|
|
|
957
970
|
)
|
|
958
971
|
return entity_def.entity_schema if entity_def else None
|
|
959
972
|
|
|
973
|
+
@property
|
|
974
|
+
def connector_id(self) -> str | None:
|
|
975
|
+
"""Get the connector/source ID (only available in hosted mode).
|
|
976
|
+
|
|
977
|
+
Returns:
|
|
978
|
+
The connector ID if in hosted mode, None if in local mode.
|
|
979
|
+
|
|
980
|
+
Example:
|
|
981
|
+
connector = await ZendeskSupportConnector.create_hosted(...)
|
|
982
|
+
print(f"Created connector: {connector.connector_id}")
|
|
983
|
+
"""
|
|
984
|
+
if hasattr(self, '_executor') and hasattr(self._executor, '_connector_id'):
|
|
985
|
+
return self._executor._connector_id
|
|
986
|
+
return None
|
|
987
|
+
|
|
988
|
+
# ===== HOSTED MODE FACTORY =====
|
|
989
|
+
|
|
990
|
+
@classmethod
|
|
991
|
+
async def initiate_oauth(
|
|
992
|
+
cls,
|
|
993
|
+
*,
|
|
994
|
+
external_user_id: str,
|
|
995
|
+
redirect_url: str,
|
|
996
|
+
airbyte_client_id: str,
|
|
997
|
+
airbyte_client_secret: str,
|
|
998
|
+
) -> str:
|
|
999
|
+
"""
|
|
1000
|
+
Initiate server-side OAuth flow for this connector.
|
|
1001
|
+
|
|
1002
|
+
Returns a consent URL where the end user should be redirected to grant access.
|
|
1003
|
+
After completing consent, they'll be redirected to your redirect_url with a
|
|
1004
|
+
`server_side_oauth_secret_id` query parameter that can be used with `create_hosted()`.
|
|
1005
|
+
|
|
1006
|
+
Args:
|
|
1007
|
+
external_user_id: Workspace identifier in Airbyte Cloud
|
|
1008
|
+
redirect_url: URL where users will be redirected after OAuth consent
|
|
1009
|
+
airbyte_client_id: Airbyte OAuth client ID
|
|
1010
|
+
airbyte_client_secret: Airbyte OAuth client secret
|
|
1011
|
+
|
|
1012
|
+
Returns:
|
|
1013
|
+
The OAuth consent URL
|
|
1014
|
+
|
|
1015
|
+
Example:
|
|
1016
|
+
consent_url = await ZendeskSupportConnector.initiate_oauth(
|
|
1017
|
+
external_user_id="my-workspace",
|
|
1018
|
+
redirect_url="https://myapp.com/oauth/callback",
|
|
1019
|
+
airbyte_client_id="client_abc",
|
|
1020
|
+
airbyte_client_secret="secret_xyz",
|
|
1021
|
+
)
|
|
1022
|
+
# Redirect user to: consent_url
|
|
1023
|
+
# After consent, user arrives at: https://myapp.com/oauth/callback?server_side_oauth_secret_id=...
|
|
1024
|
+
"""
|
|
1025
|
+
from ._vendored.connector_sdk.cloud_utils import AirbyteCloudClient
|
|
1026
|
+
|
|
1027
|
+
client = AirbyteCloudClient(
|
|
1028
|
+
client_id=airbyte_client_id,
|
|
1029
|
+
client_secret=airbyte_client_secret,
|
|
1030
|
+
)
|
|
1031
|
+
|
|
1032
|
+
try:
|
|
1033
|
+
consent_url = await client.initiate_oauth(
|
|
1034
|
+
definition_id=str(ZendeskSupportConnectorModel.id),
|
|
1035
|
+
external_user_id=external_user_id,
|
|
1036
|
+
redirect_url=redirect_url,
|
|
1037
|
+
)
|
|
1038
|
+
finally:
|
|
1039
|
+
await client.close()
|
|
1040
|
+
|
|
1041
|
+
return consent_url
|
|
1042
|
+
|
|
1043
|
+
@classmethod
|
|
1044
|
+
async def create_hosted(
|
|
1045
|
+
cls,
|
|
1046
|
+
*,
|
|
1047
|
+
external_user_id: str,
|
|
1048
|
+
airbyte_client_id: str,
|
|
1049
|
+
airbyte_client_secret: str,
|
|
1050
|
+
auth_config: "ZendeskSupportAuthConfig" | None = None,
|
|
1051
|
+
server_side_oauth_secret_id: str | None = None,
|
|
1052
|
+
name: str | None = None,
|
|
1053
|
+
replication_config: dict[str, Any] | None = None,
|
|
1054
|
+
source_template_id: str | None = None,
|
|
1055
|
+
) -> "ZendeskSupportConnector":
|
|
1056
|
+
"""
|
|
1057
|
+
Create a new hosted connector on Airbyte Cloud.
|
|
1058
|
+
|
|
1059
|
+
This factory method:
|
|
1060
|
+
1. Creates a source on Airbyte Cloud with the provided credentials
|
|
1061
|
+
2. Returns a connector configured with the new connector_id
|
|
1062
|
+
|
|
1063
|
+
Supports two authentication modes:
|
|
1064
|
+
1. Direct credentials: Provide `auth_config` with typed credentials
|
|
1065
|
+
2. Server-side OAuth: Provide `server_side_oauth_secret_id` from OAuth flow
|
|
1066
|
+
|
|
1067
|
+
Args:
|
|
1068
|
+
external_user_id: Workspace identifier in Airbyte Cloud
|
|
1069
|
+
airbyte_client_id: Airbyte OAuth client ID
|
|
1070
|
+
airbyte_client_secret: Airbyte OAuth client secret
|
|
1071
|
+
auth_config: Typed auth config. Required unless using server_side_oauth_secret_id.
|
|
1072
|
+
server_side_oauth_secret_id: OAuth secret ID from initiate_oauth redirect.
|
|
1073
|
+
When provided, auth_config is not required.
|
|
1074
|
+
name: Optional source name (defaults to connector name + external_user_id)
|
|
1075
|
+
replication_config: Optional replication settings dict.
|
|
1076
|
+
Required for connectors with x-airbyte-replication-config (REPLICATION mode sources).
|
|
1077
|
+
source_template_id: Source template ID. Required when organization has
|
|
1078
|
+
multiple source templates for this connector type.
|
|
1079
|
+
|
|
1080
|
+
Returns:
|
|
1081
|
+
A ZendeskSupportConnector instance configured in hosted mode
|
|
1082
|
+
|
|
1083
|
+
Raises:
|
|
1084
|
+
ValueError: If neither or both auth_config and server_side_oauth_secret_id provided
|
|
1085
|
+
|
|
1086
|
+
Example:
|
|
1087
|
+
# Create a new hosted connector with API key auth
|
|
1088
|
+
connector = await ZendeskSupportConnector.create_hosted(
|
|
1089
|
+
external_user_id="my-workspace",
|
|
1090
|
+
airbyte_client_id="client_abc",
|
|
1091
|
+
airbyte_client_secret="secret_xyz",
|
|
1092
|
+
auth_config=ZendeskSupportAuthConfig(access_token="...", refresh_token="..."),
|
|
1093
|
+
)
|
|
1094
|
+
|
|
1095
|
+
# With server-side OAuth:
|
|
1096
|
+
connector = await ZendeskSupportConnector.create_hosted(
|
|
1097
|
+
external_user_id="my-workspace",
|
|
1098
|
+
airbyte_client_id="client_abc",
|
|
1099
|
+
airbyte_client_secret="secret_xyz",
|
|
1100
|
+
server_side_oauth_secret_id="airbyte_oauth_..._secret_...",
|
|
1101
|
+
)
|
|
1102
|
+
|
|
1103
|
+
# Use the connector
|
|
1104
|
+
result = await connector.execute("entity", "list", {})
|
|
1105
|
+
"""
|
|
1106
|
+
# Validate: exactly one of auth_config or server_side_oauth_secret_id required
|
|
1107
|
+
if auth_config is None and server_side_oauth_secret_id is None:
|
|
1108
|
+
raise ValueError(
|
|
1109
|
+
"Either auth_config or server_side_oauth_secret_id must be provided"
|
|
1110
|
+
)
|
|
1111
|
+
if auth_config is not None and server_side_oauth_secret_id is not None:
|
|
1112
|
+
raise ValueError(
|
|
1113
|
+
"Cannot provide both auth_config and server_side_oauth_secret_id"
|
|
1114
|
+
)
|
|
1115
|
+
|
|
1116
|
+
from ._vendored.connector_sdk.cloud_utils import AirbyteCloudClient
|
|
1117
|
+
|
|
1118
|
+
client = AirbyteCloudClient(
|
|
1119
|
+
client_id=airbyte_client_id,
|
|
1120
|
+
client_secret=airbyte_client_secret,
|
|
1121
|
+
)
|
|
1122
|
+
|
|
1123
|
+
try:
|
|
1124
|
+
# Build credentials from auth_config (if provided)
|
|
1125
|
+
credentials = auth_config.model_dump(exclude_none=True) if auth_config else None
|
|
1126
|
+
replication_config_dict = replication_config.model_dump(exclude_none=True) if replication_config else None
|
|
1127
|
+
|
|
1128
|
+
# Create source on Airbyte Cloud
|
|
1129
|
+
source_name = name or f"{cls.connector_name} - {external_user_id}"
|
|
1130
|
+
source_id = await client.create_source(
|
|
1131
|
+
name=source_name,
|
|
1132
|
+
connector_definition_id=str(ZendeskSupportConnectorModel.id),
|
|
1133
|
+
external_user_id=external_user_id,
|
|
1134
|
+
credentials=credentials,
|
|
1135
|
+
replication_config=replication_config_dict,
|
|
1136
|
+
server_side_oauth_secret_id=server_side_oauth_secret_id,
|
|
1137
|
+
source_template_id=source_template_id,
|
|
1138
|
+
)
|
|
1139
|
+
finally:
|
|
1140
|
+
await client.close()
|
|
1141
|
+
|
|
1142
|
+
# Return connector configured with the new connector_id
|
|
1143
|
+
return cls(
|
|
1144
|
+
airbyte_client_id=airbyte_client_id,
|
|
1145
|
+
airbyte_client_secret=airbyte_client_secret,
|
|
1146
|
+
connector_id=source_id,
|
|
1147
|
+
)
|
|
1148
|
+
|
|
1149
|
+
|
|
960
1150
|
|
|
961
1151
|
|
|
962
1152
|
class TicketsQuery:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: airbyte-agent-zendesk-support
|
|
3
|
-
Version: 0.18.
|
|
3
|
+
Version: 0.18.78
|
|
4
4
|
Summary: Airbyte Zendesk-Support 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/
|
|
@@ -157,7 +157,7 @@ See the official [Zendesk-Support API reference](https://developer.zendesk.com/a
|
|
|
157
157
|
|
|
158
158
|
## Version information
|
|
159
159
|
|
|
160
|
-
- **Package version:** 0.18.
|
|
160
|
+
- **Package version:** 0.18.78
|
|
161
161
|
- **Connector version:** 0.1.11
|
|
162
|
-
- **Generated with Connector SDK commit SHA:**
|
|
162
|
+
- **Generated with Connector SDK commit SHA:** 9d9866b0aae8c3494d04d34e193b9bd860bfc1c6
|
|
163
163
|
- **Changelog:** [View changelog](https://github.com/airbytehq/airbyte-agent-connectors/blob/main/connectors/zendesk-support/CHANGELOG.md)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
airbyte_agent_zendesk_support/__init__.py,sha256=EPmmOaWdjLG3KwnHva6OL2c7fSxAwr6av_qlnh57S44,9515
|
|
2
|
-
airbyte_agent_zendesk_support/connector.py,sha256=
|
|
2
|
+
airbyte_agent_zendesk_support/connector.py,sha256=lF31Wp5S8Itk69PSuR_Gwlu-ISIk5iPYlXD_sCTbmec,121652
|
|
3
3
|
airbyte_agent_zendesk_support/connector_model.py,sha256=4GSYPVJ9QuEiMe0wOmlgfjfNBFMrq_iuHFQg47DzpOU,248743
|
|
4
4
|
airbyte_agent_zendesk_support/models.py,sha256=c1vEifMBpVvBhjxXbJEhnEBhM3A_HNNVcfy35CNO8xA,63953
|
|
5
5
|
airbyte_agent_zendesk_support/types.py,sha256=ZNi-YzBv9K0Tmkm5xfEomuWyG59VG4zxTsxh9q9zcHw,162971
|
|
@@ -19,9 +19,9 @@ airbyte_agent_zendesk_support/_vendored/connector_sdk/utils.py,sha256=UYwYuSLhsD
|
|
|
19
19
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/validation.py,sha256=w5WGnmILkdBslpXhAXhKhE-c8ANBc_OZQxr_fUeAgtc,39666
|
|
20
20
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/validation_replication.py,sha256=v7F5YWd5m4diIF7_4m4nOkC9crg97vqRUUkt9ka9HZ4,36043
|
|
21
21
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/cloud_utils/__init__.py,sha256=4799Hv9f2zxDVj1aLyQ8JpTEuFTp_oOZMRz-NZCdBJg,134
|
|
22
|
-
airbyte_agent_zendesk_support/_vendored/connector_sdk/cloud_utils/client.py,sha256=
|
|
22
|
+
airbyte_agent_zendesk_support/_vendored/connector_sdk/cloud_utils/client.py,sha256=e0VLNCmesGGfo2uD0GiICgXsXTeTkh0GYiVgx_e4VEc,12296
|
|
23
23
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/__init__.py,sha256=EmG9YQNAjSuYCVB4D5VoLm4qpD1KfeiiOf7bpALj8p8,702
|
|
24
|
-
airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/hosted_executor.py,sha256=
|
|
24
|
+
airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/hosted_executor.py,sha256=tv0njAdy-gdHBg4izgcxhEWYbrNiBifEYEca9AWzaL0,8693
|
|
25
25
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/local_executor.py,sha256=RtdTXFzfoJz5Coz9nwQi81Df1402BRgO1Mgd3ZzTkfw,76581
|
|
26
26
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/executor/models.py,sha256=mUUBnuShKXxVIfsTOhMiI2rn2a-50jJG7SFGKT_P6Jk,6281
|
|
27
27
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/http/__init__.py,sha256=y8fbzZn-3yV9OxtYz8Dy6FFGI5v6TOqADd1G3xHH3Hw,911
|
|
@@ -53,6 +53,6 @@ airbyte_agent_zendesk_support/_vendored/connector_sdk/telemetry/__init__.py,sha2
|
|
|
53
53
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/telemetry/config.py,sha256=tLmQwAFD0kP1WyBGWBS3ysaudN9H3e-3EopKZi6cGKg,885
|
|
54
54
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/telemetry/events.py,sha256=8Y1NbXiwISX-V_wRofY7PqcwEXD0dLMnntKkY6XFU2s,1328
|
|
55
55
|
airbyte_agent_zendesk_support/_vendored/connector_sdk/telemetry/tracker.py,sha256=SginFQbHqVUVYG82NnNzG34O-tAQ_wZYjGDcuo0q4Kk,5584
|
|
56
|
-
airbyte_agent_zendesk_support-0.18.
|
|
57
|
-
airbyte_agent_zendesk_support-0.18.
|
|
58
|
-
airbyte_agent_zendesk_support-0.18.
|
|
56
|
+
airbyte_agent_zendesk_support-0.18.78.dist-info/METADATA,sha256=M2v7ozqBlA-O5GyF48nXCLE7oJrgWVnviUGv23hnZ3s,7433
|
|
57
|
+
airbyte_agent_zendesk_support-0.18.78.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
58
|
+
airbyte_agent_zendesk_support-0.18.78.dist-info/RECORD,,
|
|
File without changes
|