airbyte-agent-klaviyo 0.1.0__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.
Files changed (57) hide show
  1. airbyte_agent_klaviyo/__init__.py +225 -0
  2. airbyte_agent_klaviyo/_vendored/__init__.py +1 -0
  3. airbyte_agent_klaviyo/_vendored/connector_sdk/__init__.py +82 -0
  4. airbyte_agent_klaviyo/_vendored/connector_sdk/auth_strategies.py +1171 -0
  5. airbyte_agent_klaviyo/_vendored/connector_sdk/auth_template.py +135 -0
  6. airbyte_agent_klaviyo/_vendored/connector_sdk/cloud_utils/__init__.py +5 -0
  7. airbyte_agent_klaviyo/_vendored/connector_sdk/cloud_utils/client.py +213 -0
  8. airbyte_agent_klaviyo/_vendored/connector_sdk/connector_model_loader.py +1120 -0
  9. airbyte_agent_klaviyo/_vendored/connector_sdk/constants.py +78 -0
  10. airbyte_agent_klaviyo/_vendored/connector_sdk/exceptions.py +23 -0
  11. airbyte_agent_klaviyo/_vendored/connector_sdk/executor/__init__.py +31 -0
  12. airbyte_agent_klaviyo/_vendored/connector_sdk/executor/hosted_executor.py +201 -0
  13. airbyte_agent_klaviyo/_vendored/connector_sdk/executor/local_executor.py +1854 -0
  14. airbyte_agent_klaviyo/_vendored/connector_sdk/executor/models.py +202 -0
  15. airbyte_agent_klaviyo/_vendored/connector_sdk/extensions.py +693 -0
  16. airbyte_agent_klaviyo/_vendored/connector_sdk/http/__init__.py +37 -0
  17. airbyte_agent_klaviyo/_vendored/connector_sdk/http/adapters/__init__.py +9 -0
  18. airbyte_agent_klaviyo/_vendored/connector_sdk/http/adapters/httpx_adapter.py +251 -0
  19. airbyte_agent_klaviyo/_vendored/connector_sdk/http/config.py +98 -0
  20. airbyte_agent_klaviyo/_vendored/connector_sdk/http/exceptions.py +119 -0
  21. airbyte_agent_klaviyo/_vendored/connector_sdk/http/protocols.py +114 -0
  22. airbyte_agent_klaviyo/_vendored/connector_sdk/http/response.py +104 -0
  23. airbyte_agent_klaviyo/_vendored/connector_sdk/http_client.py +693 -0
  24. airbyte_agent_klaviyo/_vendored/connector_sdk/introspection.py +481 -0
  25. airbyte_agent_klaviyo/_vendored/connector_sdk/logging/__init__.py +11 -0
  26. airbyte_agent_klaviyo/_vendored/connector_sdk/logging/logger.py +273 -0
  27. airbyte_agent_klaviyo/_vendored/connector_sdk/logging/types.py +93 -0
  28. airbyte_agent_klaviyo/_vendored/connector_sdk/observability/__init__.py +11 -0
  29. airbyte_agent_klaviyo/_vendored/connector_sdk/observability/config.py +179 -0
  30. airbyte_agent_klaviyo/_vendored/connector_sdk/observability/models.py +19 -0
  31. airbyte_agent_klaviyo/_vendored/connector_sdk/observability/redactor.py +81 -0
  32. airbyte_agent_klaviyo/_vendored/connector_sdk/observability/session.py +103 -0
  33. airbyte_agent_klaviyo/_vendored/connector_sdk/performance/__init__.py +6 -0
  34. airbyte_agent_klaviyo/_vendored/connector_sdk/performance/instrumentation.py +57 -0
  35. airbyte_agent_klaviyo/_vendored/connector_sdk/performance/metrics.py +93 -0
  36. airbyte_agent_klaviyo/_vendored/connector_sdk/schema/__init__.py +75 -0
  37. airbyte_agent_klaviyo/_vendored/connector_sdk/schema/base.py +201 -0
  38. airbyte_agent_klaviyo/_vendored/connector_sdk/schema/components.py +244 -0
  39. airbyte_agent_klaviyo/_vendored/connector_sdk/schema/connector.py +120 -0
  40. airbyte_agent_klaviyo/_vendored/connector_sdk/schema/extensions.py +301 -0
  41. airbyte_agent_klaviyo/_vendored/connector_sdk/schema/operations.py +156 -0
  42. airbyte_agent_klaviyo/_vendored/connector_sdk/schema/security.py +236 -0
  43. airbyte_agent_klaviyo/_vendored/connector_sdk/secrets.py +182 -0
  44. airbyte_agent_klaviyo/_vendored/connector_sdk/telemetry/__init__.py +10 -0
  45. airbyte_agent_klaviyo/_vendored/connector_sdk/telemetry/config.py +32 -0
  46. airbyte_agent_klaviyo/_vendored/connector_sdk/telemetry/events.py +59 -0
  47. airbyte_agent_klaviyo/_vendored/connector_sdk/telemetry/tracker.py +155 -0
  48. airbyte_agent_klaviyo/_vendored/connector_sdk/types.py +270 -0
  49. airbyte_agent_klaviyo/_vendored/connector_sdk/utils.py +60 -0
  50. airbyte_agent_klaviyo/_vendored/connector_sdk/validation.py +848 -0
  51. airbyte_agent_klaviyo/connector.py +1431 -0
  52. airbyte_agent_klaviyo/connector_model.py +2230 -0
  53. airbyte_agent_klaviyo/models.py +676 -0
  54. airbyte_agent_klaviyo/types.py +1319 -0
  55. airbyte_agent_klaviyo-0.1.0.dist-info/METADATA +151 -0
  56. airbyte_agent_klaviyo-0.1.0.dist-info/RECORD +57 -0
  57. airbyte_agent_klaviyo-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,676 @@
1
+ """
2
+ Pydantic models for klaviyo connector.
3
+
4
+ This module contains Pydantic models used for authentication configuration
5
+ and response envelope types.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ from pydantic import BaseModel, ConfigDict, Field
11
+ from typing import TypeVar, Generic, Union, Any
12
+
13
+ # Authentication configuration
14
+
15
+ class KlaviyoAuthConfig(BaseModel):
16
+ """Authentication"""
17
+
18
+ model_config = ConfigDict(extra="forbid")
19
+
20
+ api_key: str
21
+ """Your Klaviyo private API key"""
22
+
23
+ # ===== RESPONSE TYPE DEFINITIONS (PYDANTIC) =====
24
+
25
+ class ProfileLinks(BaseModel):
26
+ """Related links"""
27
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
28
+
29
+ self: Union[str | None, Any] = Field(default=None)
30
+
31
+ class ProfileAttributesLocation(BaseModel):
32
+ """Location information"""
33
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
34
+
35
+ address1: Union[str | None, Any] = Field(default=None)
36
+ address2: Union[str | None, Any] = Field(default=None)
37
+ city: Union[str | None, Any] = Field(default=None)
38
+ country: Union[str | None, Any] = Field(default=None)
39
+ region: Union[str | None, Any] = Field(default=None)
40
+ zip: Union[str | None, Any] = Field(default=None)
41
+ timezone: Union[str | None, Any] = Field(default=None)
42
+ latitude: Union[float | None, Any] = Field(default=None)
43
+ longitude: Union[float | None, Any] = Field(default=None)
44
+
45
+ class ProfileAttributes(BaseModel):
46
+ """Profile attributes"""
47
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
48
+
49
+ email: Union[str | None, Any] = Field(default=None, description="Email address")
50
+ """Email address"""
51
+ phone_number: Union[str | None, Any] = Field(default=None, description="Phone number")
52
+ """Phone number"""
53
+ external_id: Union[str | None, Any] = Field(default=None, description="External identifier")
54
+ """External identifier"""
55
+ first_name: Union[str | None, Any] = Field(default=None, description="First name")
56
+ """First name"""
57
+ last_name: Union[str | None, Any] = Field(default=None, description="Last name")
58
+ """Last name"""
59
+ organization: Union[str | None, Any] = Field(default=None, description="Organization name")
60
+ """Organization name"""
61
+ title: Union[str | None, Any] = Field(default=None, description="Job title")
62
+ """Job title"""
63
+ image: Union[str | None, Any] = Field(default=None, description="Profile image URL")
64
+ """Profile image URL"""
65
+ created: Union[str | None, Any] = Field(default=None, description="Creation timestamp")
66
+ """Creation timestamp"""
67
+ updated: Union[str | None, Any] = Field(default=None, description="Last update timestamp")
68
+ """Last update timestamp"""
69
+ location: Union[ProfileAttributesLocation | None, Any] = Field(default=None, description="Location information")
70
+ """Location information"""
71
+ properties: Union[dict[str, Any] | None, Any] = Field(default=None, description="Custom properties")
72
+ """Custom properties"""
73
+
74
+ class Profile(BaseModel):
75
+ """A Klaviyo profile representing a contact"""
76
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
77
+
78
+ id: Union[str, Any] = Field(default=None)
79
+ type: Union[str | None, Any] = Field(default=None)
80
+ attributes: Union[ProfileAttributes | None, Any] = Field(default=None)
81
+ links: Union[ProfileLinks | None, Any] = Field(default=None)
82
+
83
+ class ProfilesListLinks(BaseModel):
84
+ """Nested schema for ProfilesList.links"""
85
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
86
+
87
+ self: Union[str | None, Any] = Field(default=None)
88
+ next: Union[str | None, Any] = Field(default=None)
89
+ prev: Union[str | None, Any] = Field(default=None)
90
+
91
+ class ProfilesList(BaseModel):
92
+ """Paginated list of profiles"""
93
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
94
+
95
+ data: Union[list[Profile], Any] = Field(default=None)
96
+ links: Union[ProfilesListLinks | None, Any] = Field(default=None)
97
+
98
+ class ListAttributes(BaseModel):
99
+ """List attributes"""
100
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
101
+
102
+ name: Union[str | None, Any] = Field(default=None, description="List name")
103
+ """List name"""
104
+ created: Union[str | None, Any] = Field(default=None, description="Creation timestamp")
105
+ """Creation timestamp"""
106
+ updated: Union[str | None, Any] = Field(default=None, description="Last update timestamp")
107
+ """Last update timestamp"""
108
+ opt_in_process: Union[str | None, Any] = Field(default=None, description="Opt-in process type")
109
+ """Opt-in process type"""
110
+
111
+ class ListLinks(BaseModel):
112
+ """Related links"""
113
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
114
+
115
+ self: Union[str | None, Any] = Field(default=None)
116
+
117
+ class List(BaseModel):
118
+ """A Klaviyo list for organizing profiles"""
119
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
120
+
121
+ id: Union[str, Any] = Field(default=None)
122
+ type: Union[str | None, Any] = Field(default=None)
123
+ attributes: Union[ListAttributes | None, Any] = Field(default=None)
124
+ links: Union[ListLinks | None, Any] = Field(default=None)
125
+
126
+ class ListsListLinks(BaseModel):
127
+ """Nested schema for ListsList.links"""
128
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
129
+
130
+ self: Union[str | None, Any] = Field(default=None)
131
+ next: Union[str | None, Any] = Field(default=None)
132
+ prev: Union[str | None, Any] = Field(default=None)
133
+
134
+ class ListsList(BaseModel):
135
+ """Paginated list of lists"""
136
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
137
+
138
+ data: Union[list[List], Any] = Field(default=None)
139
+ links: Union[ListsListLinks | None, Any] = Field(default=None)
140
+
141
+ class CampaignAttributes(BaseModel):
142
+ """Campaign attributes"""
143
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
144
+
145
+ name: Union[str | None, Any] = Field(default=None, description="Campaign name")
146
+ """Campaign name"""
147
+ status: Union[str | None, Any] = Field(default=None, description="Campaign status")
148
+ """Campaign status"""
149
+ archived: Union[bool | None, Any] = Field(default=None, description="Whether campaign is archived")
150
+ """Whether campaign is archived"""
151
+ audiences: Union[dict[str, Any] | None, Any] = Field(default=None, description="Target audiences")
152
+ """Target audiences"""
153
+ send_options: Union[dict[str, Any] | None, Any] = Field(default=None, description="Send options")
154
+ """Send options"""
155
+ tracking_options: Union[dict[str, Any] | None, Any] = Field(default=None, description="Tracking options")
156
+ """Tracking options"""
157
+ send_strategy: Union[dict[str, Any] | None, Any] = Field(default=None, description="Send strategy")
158
+ """Send strategy"""
159
+ created_at: Union[str | None, Any] = Field(default=None, description="Creation timestamp")
160
+ """Creation timestamp"""
161
+ scheduled_at: Union[str | None, Any] = Field(default=None, description="Scheduled send time")
162
+ """Scheduled send time"""
163
+ updated_at: Union[str | None, Any] = Field(default=None, description="Last update timestamp")
164
+ """Last update timestamp"""
165
+ send_time: Union[str | None, Any] = Field(default=None, description="Actual send time")
166
+ """Actual send time"""
167
+
168
+ class CampaignLinks(BaseModel):
169
+ """Related links"""
170
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
171
+
172
+ self: Union[str | None, Any] = Field(default=None)
173
+
174
+ class Campaign(BaseModel):
175
+ """A Klaviyo campaign"""
176
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
177
+
178
+ id: Union[str, Any] = Field(default=None)
179
+ type: Union[str | None, Any] = Field(default=None)
180
+ attributes: Union[CampaignAttributes | None, Any] = Field(default=None)
181
+ links: Union[CampaignLinks | None, Any] = Field(default=None)
182
+
183
+ class CampaignsListLinks(BaseModel):
184
+ """Nested schema for CampaignsList.links"""
185
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
186
+
187
+ self: Union[str | None, Any] = Field(default=None)
188
+ next: Union[str | None, Any] = Field(default=None)
189
+ prev: Union[str | None, Any] = Field(default=None)
190
+
191
+ class CampaignsList(BaseModel):
192
+ """Paginated list of campaigns"""
193
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
194
+
195
+ data: Union[list[Campaign], Any] = Field(default=None)
196
+ links: Union[CampaignsListLinks | None, Any] = Field(default=None)
197
+
198
+ class EventRelationshipsProfileData(BaseModel):
199
+ """Nested schema for EventRelationshipsProfile.data"""
200
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
201
+
202
+ type: Union[str | None, Any] = Field(default=None)
203
+ id: Union[str | None, Any] = Field(default=None)
204
+
205
+ class EventRelationshipsProfile(BaseModel):
206
+ """Nested schema for EventRelationships.profile"""
207
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
208
+
209
+ data: Union[EventRelationshipsProfileData | None, Any] = Field(default=None)
210
+
211
+ class EventRelationshipsMetricData(BaseModel):
212
+ """Nested schema for EventRelationshipsMetric.data"""
213
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
214
+
215
+ type: Union[str | None, Any] = Field(default=None)
216
+ id: Union[str | None, Any] = Field(default=None)
217
+
218
+ class EventRelationshipsMetric(BaseModel):
219
+ """Nested schema for EventRelationships.metric"""
220
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
221
+
222
+ data: Union[EventRelationshipsMetricData | None, Any] = Field(default=None)
223
+
224
+ class EventRelationships(BaseModel):
225
+ """Related resources"""
226
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
227
+
228
+ profile: Union[EventRelationshipsProfile | None, Any] = Field(default=None)
229
+ metric: Union[EventRelationshipsMetric | None, Any] = Field(default=None)
230
+
231
+ class EventLinks(BaseModel):
232
+ """Related links"""
233
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
234
+
235
+ self: Union[str | None, Any] = Field(default=None)
236
+
237
+ class EventAttributes(BaseModel):
238
+ """Event attributes"""
239
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
240
+
241
+ timestamp: Union[Any, Any] = Field(default=None, description="Event timestamp (can be ISO string or Unix timestamp)")
242
+ """Event timestamp (can be ISO string or Unix timestamp)"""
243
+ datetime: Union[str | None, Any] = Field(default=None, description="Event datetime")
244
+ """Event datetime"""
245
+ uuid: Union[str | None, Any] = Field(default=None, description="Event UUID")
246
+ """Event UUID"""
247
+ event_properties: Union[dict[str, Any] | None, Any] = Field(default=None, description="Custom event properties")
248
+ """Custom event properties"""
249
+
250
+ class Event(BaseModel):
251
+ """A Klaviyo event representing an action taken by a profile"""
252
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
253
+
254
+ id: Union[str, Any] = Field(default=None)
255
+ type: Union[str | None, Any] = Field(default=None)
256
+ attributes: Union[EventAttributes | None, Any] = Field(default=None)
257
+ relationships: Union[EventRelationships | None, Any] = Field(default=None)
258
+ links: Union[EventLinks | None, Any] = Field(default=None)
259
+
260
+ class EventsListLinks(BaseModel):
261
+ """Nested schema for EventsList.links"""
262
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
263
+
264
+ self: Union[str | None, Any] = Field(default=None)
265
+ next: Union[str | None, Any] = Field(default=None)
266
+ prev: Union[str | None, Any] = Field(default=None)
267
+
268
+ class EventsList(BaseModel):
269
+ """Paginated list of events"""
270
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
271
+
272
+ data: Union[list[Event], Any] = Field(default=None)
273
+ links: Union[EventsListLinks | None, Any] = Field(default=None)
274
+
275
+ class MetricLinks(BaseModel):
276
+ """Related links"""
277
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
278
+
279
+ self: Union[str | None, Any] = Field(default=None)
280
+
281
+ class MetricAttributesIntegration(BaseModel):
282
+ """Integration information"""
283
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
284
+
285
+ id: Union[str | None, Any] = Field(default=None)
286
+ name: Union[str | None, Any] = Field(default=None)
287
+ category: Union[str | None, Any] = Field(default=None)
288
+
289
+ class MetricAttributes(BaseModel):
290
+ """Metric attributes"""
291
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
292
+
293
+ name: Union[str | None, Any] = Field(default=None, description="Metric name")
294
+ """Metric name"""
295
+ created: Union[str | None, Any] = Field(default=None, description="Creation timestamp")
296
+ """Creation timestamp"""
297
+ updated: Union[str | None, Any] = Field(default=None, description="Last update timestamp")
298
+ """Last update timestamp"""
299
+ integration: Union[MetricAttributesIntegration | None, Any] = Field(default=None, description="Integration information")
300
+ """Integration information"""
301
+
302
+ class Metric(BaseModel):
303
+ """A Klaviyo metric (event type)"""
304
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
305
+
306
+ id: Union[str, Any] = Field(default=None)
307
+ type: Union[str | None, Any] = Field(default=None)
308
+ attributes: Union[MetricAttributes | None, Any] = Field(default=None)
309
+ links: Union[MetricLinks | None, Any] = Field(default=None)
310
+
311
+ class MetricsListLinks(BaseModel):
312
+ """Nested schema for MetricsList.links"""
313
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
314
+
315
+ self: Union[str | None, Any] = Field(default=None)
316
+ next: Union[str | None, Any] = Field(default=None)
317
+ prev: Union[str | None, Any] = Field(default=None)
318
+
319
+ class MetricsList(BaseModel):
320
+ """Paginated list of metrics"""
321
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
322
+
323
+ data: Union[list[Metric], Any] = Field(default=None)
324
+ links: Union[MetricsListLinks | None, Any] = Field(default=None)
325
+
326
+ class FlowLinks(BaseModel):
327
+ """Related links"""
328
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
329
+
330
+ self: Union[str | None, Any] = Field(default=None)
331
+
332
+ class FlowAttributes(BaseModel):
333
+ """Flow attributes"""
334
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
335
+
336
+ name: Union[str | None, Any] = Field(default=None, description="Flow name")
337
+ """Flow name"""
338
+ status: Union[str | None, Any] = Field(default=None, description="Flow status (draft, manual, live)")
339
+ """Flow status (draft, manual, live)"""
340
+ archived: Union[bool | None, Any] = Field(default=None, description="Whether flow is archived")
341
+ """Whether flow is archived"""
342
+ created: Union[str | None, Any] = Field(default=None, description="Creation timestamp")
343
+ """Creation timestamp"""
344
+ updated: Union[str | None, Any] = Field(default=None, description="Last update timestamp")
345
+ """Last update timestamp"""
346
+ trigger_type: Union[str | None, Any] = Field(default=None, description="Type of trigger for the flow")
347
+ """Type of trigger for the flow"""
348
+
349
+ class Flow(BaseModel):
350
+ """A Klaviyo flow (automated sequence)"""
351
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
352
+
353
+ id: Union[str, Any] = Field(default=None)
354
+ type: Union[str | None, Any] = Field(default=None)
355
+ attributes: Union[FlowAttributes | None, Any] = Field(default=None)
356
+ links: Union[FlowLinks | None, Any] = Field(default=None)
357
+
358
+ class FlowsListLinks(BaseModel):
359
+ """Nested schema for FlowsList.links"""
360
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
361
+
362
+ self: Union[str | None, Any] = Field(default=None)
363
+ next: Union[str | None, Any] = Field(default=None)
364
+ prev: Union[str | None, Any] = Field(default=None)
365
+
366
+ class FlowsList(BaseModel):
367
+ """Paginated list of flows"""
368
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
369
+
370
+ data: Union[list[Flow], Any] = Field(default=None)
371
+ links: Union[FlowsListLinks | None, Any] = Field(default=None)
372
+
373
+ class TemplateLinks(BaseModel):
374
+ """Related links"""
375
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
376
+
377
+ self: Union[str | None, Any] = Field(default=None)
378
+
379
+ class TemplateAttributes(BaseModel):
380
+ """Template attributes"""
381
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
382
+
383
+ name: Union[str | None, Any] = Field(default=None, description="Template name")
384
+ """Template name"""
385
+ editor_type: Union[str | None, Any] = Field(default=None, description="Editor type used to create template")
386
+ """Editor type used to create template"""
387
+ html: Union[str | None, Any] = Field(default=None, description="HTML content")
388
+ """HTML content"""
389
+ text: Union[str | None, Any] = Field(default=None, description="Plain text content")
390
+ """Plain text content"""
391
+ created: Union[str | None, Any] = Field(default=None, description="Creation timestamp")
392
+ """Creation timestamp"""
393
+ updated: Union[str | None, Any] = Field(default=None, description="Last update timestamp")
394
+ """Last update timestamp"""
395
+
396
+ class Template(BaseModel):
397
+ """A Klaviyo email template"""
398
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
399
+
400
+ id: Union[str, Any] = Field(default=None)
401
+ type: Union[str | None, Any] = Field(default=None)
402
+ attributes: Union[TemplateAttributes | None, Any] = Field(default=None)
403
+ links: Union[TemplateLinks | None, Any] = Field(default=None)
404
+
405
+ class TemplatesListLinks(BaseModel):
406
+ """Nested schema for TemplatesList.links"""
407
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
408
+
409
+ self: Union[str | None, Any] = Field(default=None)
410
+ next: Union[str | None, Any] = Field(default=None)
411
+ prev: Union[str | None, Any] = Field(default=None)
412
+
413
+ class TemplatesList(BaseModel):
414
+ """Paginated list of templates"""
415
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
416
+
417
+ data: Union[list[Template], Any] = Field(default=None)
418
+ links: Union[TemplatesListLinks | None, Any] = Field(default=None)
419
+
420
+ # ===== METADATA TYPE DEFINITIONS (PYDANTIC) =====
421
+ # Meta types for operations that extract metadata (e.g., pagination info)
422
+
423
+ # ===== CHECK RESULT MODEL =====
424
+
425
+ class KlaviyoCheckResult(BaseModel):
426
+ """Result of a health check operation.
427
+
428
+ Returned by the check() method to indicate connectivity and credential status.
429
+ """
430
+ model_config = ConfigDict(extra="forbid")
431
+
432
+ status: str
433
+ """Health check status: 'healthy' or 'unhealthy'."""
434
+ error: str | None = None
435
+ """Error message if status is 'unhealthy', None otherwise."""
436
+ checked_entity: str | None = None
437
+ """Entity name used for the health check."""
438
+ checked_action: str | None = None
439
+ """Action name used for the health check."""
440
+
441
+
442
+ # ===== RESPONSE ENVELOPE MODELS =====
443
+
444
+ # Type variables for generic envelope models
445
+ T = TypeVar('T')
446
+ S = TypeVar('S')
447
+
448
+
449
+ class KlaviyoExecuteResult(BaseModel, Generic[T]):
450
+ """Response envelope with data only.
451
+
452
+ Used for actions that return data without metadata.
453
+ """
454
+ model_config = ConfigDict(extra="forbid")
455
+
456
+ data: T
457
+ """Response data containing the result of the action."""
458
+
459
+
460
+ class KlaviyoExecuteResultWithMeta(KlaviyoExecuteResult[T], Generic[T, S]):
461
+ """Response envelope with data and metadata.
462
+
463
+ Used for actions that return both data and metadata (e.g., pagination info).
464
+ """
465
+ meta: S
466
+ """Metadata about the response (e.g., pagination cursors, record counts)."""
467
+
468
+ # ===== SEARCH DATA MODELS =====
469
+ # Entity-specific Pydantic models for search result data
470
+
471
+ # Type variable for search data generic
472
+ D = TypeVar('D')
473
+
474
+ class ProfilesSearchData(BaseModel):
475
+ """Search result data for profiles entity."""
476
+ model_config = ConfigDict(extra="allow")
477
+
478
+ attributes: dict[str, Any] | None = None
479
+ """"""
480
+ id: str | None = None
481
+ """"""
482
+ links: dict[str, Any] | None = None
483
+ """"""
484
+ relationships: dict[str, Any] | None = None
485
+ """"""
486
+ segments: dict[str, Any] | None = None
487
+ """"""
488
+ type: str | None = None
489
+ """"""
490
+ updated: str | None = None
491
+ """"""
492
+
493
+
494
+ class EventsSearchData(BaseModel):
495
+ """Search result data for events entity."""
496
+ model_config = ConfigDict(extra="allow")
497
+
498
+ attributes: dict[str, Any] | None = None
499
+ """"""
500
+ datetime: str | None = None
501
+ """"""
502
+ id: str | None = None
503
+ """"""
504
+ links: dict[str, Any] | None = None
505
+ """"""
506
+ relationships: dict[str, Any] | None = None
507
+ """"""
508
+ type: str | None = None
509
+ """"""
510
+
511
+
512
+ class EmailTemplatesSearchData(BaseModel):
513
+ """Search result data for email_templates entity."""
514
+ model_config = ConfigDict(extra="allow")
515
+
516
+ attributes: dict[str, Any] | None = None
517
+ """"""
518
+ id: str | None = None
519
+ """"""
520
+ links: dict[str, Any] | None = None
521
+ """"""
522
+ type: str | None = None
523
+ """"""
524
+ updated: str | None = None
525
+ """"""
526
+
527
+
528
+ class CampaignsSearchData(BaseModel):
529
+ """Search result data for campaigns entity."""
530
+ model_config = ConfigDict(extra="allow")
531
+
532
+ attributes: dict[str, Any] | None = None
533
+ """"""
534
+ id: str | None = None
535
+ """"""
536
+ links: dict[str, Any] | None = None
537
+ """"""
538
+ relationships: dict[str, Any] | None = None
539
+ """"""
540
+ type: str | None = None
541
+ """"""
542
+ updated_at: str | None = None
543
+ """"""
544
+
545
+
546
+ class FlowsSearchData(BaseModel):
547
+ """Search result data for flows entity."""
548
+ model_config = ConfigDict(extra="allow")
549
+
550
+ attributes: dict[str, Any] | None = None
551
+ """"""
552
+ id: str | None = None
553
+ """"""
554
+ links: dict[str, Any] | None = None
555
+ """"""
556
+ relationships: dict[str, Any] | None = None
557
+ """"""
558
+ type: str | None = None
559
+ """"""
560
+ updated: str | None = None
561
+ """"""
562
+
563
+
564
+ class MetricsSearchData(BaseModel):
565
+ """Search result data for metrics entity."""
566
+ model_config = ConfigDict(extra="allow")
567
+
568
+ attributes: dict[str, Any] | None = None
569
+ """"""
570
+ id: str | None = None
571
+ """"""
572
+ links: dict[str, Any] | None = None
573
+ """"""
574
+ relationships: dict[str, Any] | None = None
575
+ """"""
576
+ type: str | None = None
577
+ """"""
578
+ updated: str | None = None
579
+ """"""
580
+
581
+
582
+ class ListsSearchData(BaseModel):
583
+ """Search result data for lists entity."""
584
+ model_config = ConfigDict(extra="allow")
585
+
586
+ attributes: dict[str, Any] | None = None
587
+ """"""
588
+ id: str | None = None
589
+ """"""
590
+ links: dict[str, Any] | None = None
591
+ """"""
592
+ relationships: dict[str, Any] | None = None
593
+ """"""
594
+ type: str | None = None
595
+ """"""
596
+ updated: str | None = None
597
+ """"""
598
+
599
+
600
+ # ===== GENERIC SEARCH RESULT TYPES =====
601
+
602
+ class AirbyteSearchHit(BaseModel, Generic[D]):
603
+ """A single search result with typed data."""
604
+ model_config = ConfigDict(extra="allow")
605
+
606
+ id: str | None = None
607
+ """Unique identifier for the record."""
608
+ score: float | None = None
609
+ """Relevance score for the match."""
610
+ data: D
611
+ """The matched record data."""
612
+
613
+
614
+ class AirbyteSearchResult(BaseModel, Generic[D]):
615
+ """Result from Airbyte cache search operations with typed hits."""
616
+ model_config = ConfigDict(extra="allow")
617
+
618
+ hits: list[AirbyteSearchHit[D]] = Field(default_factory=list)
619
+ """List of matching records."""
620
+ next_cursor: str | None = None
621
+ """Cursor for fetching the next page of results."""
622
+ took_ms: int | None = None
623
+ """Time taken to execute the search in milliseconds."""
624
+
625
+
626
+ # ===== ENTITY-SPECIFIC SEARCH RESULT TYPE ALIASES =====
627
+
628
+ ProfilesSearchResult = AirbyteSearchResult[ProfilesSearchData]
629
+ """Search result type for profiles entity."""
630
+
631
+ EventsSearchResult = AirbyteSearchResult[EventsSearchData]
632
+ """Search result type for events entity."""
633
+
634
+ EmailTemplatesSearchResult = AirbyteSearchResult[EmailTemplatesSearchData]
635
+ """Search result type for email_templates entity."""
636
+
637
+ CampaignsSearchResult = AirbyteSearchResult[CampaignsSearchData]
638
+ """Search result type for campaigns entity."""
639
+
640
+ FlowsSearchResult = AirbyteSearchResult[FlowsSearchData]
641
+ """Search result type for flows entity."""
642
+
643
+ MetricsSearchResult = AirbyteSearchResult[MetricsSearchData]
644
+ """Search result type for metrics entity."""
645
+
646
+ ListsSearchResult = AirbyteSearchResult[ListsSearchData]
647
+ """Search result type for lists entity."""
648
+
649
+
650
+
651
+ # ===== OPERATION RESULT TYPE ALIASES =====
652
+
653
+ # Concrete type aliases for each operation result.
654
+ # These provide simpler, more readable type annotations than using the generic forms.
655
+
656
+ ProfilesListResult = KlaviyoExecuteResult[list[Profile]]
657
+ """Result type for profiles.list operation."""
658
+
659
+ ListsListResult = KlaviyoExecuteResult[list[List]]
660
+ """Result type for lists.list operation."""
661
+
662
+ CampaignsListResult = KlaviyoExecuteResult[list[Campaign]]
663
+ """Result type for campaigns.list operation."""
664
+
665
+ EventsListResult = KlaviyoExecuteResult[list[Event]]
666
+ """Result type for events.list operation."""
667
+
668
+ MetricsListResult = KlaviyoExecuteResult[list[Metric]]
669
+ """Result type for metrics.list operation."""
670
+
671
+ FlowsListResult = KlaviyoExecuteResult[list[Flow]]
672
+ """Result type for flows.list operation."""
673
+
674
+ EmailTemplatesListResult = KlaviyoExecuteResult[list[Template]]
675
+ """Result type for email_templates.list operation."""
676
+