airbyte-agent-facebook-marketing 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_facebook_marketing/__init__.py +221 -0
  2. airbyte_agent_facebook_marketing/_vendored/__init__.py +1 -0
  3. airbyte_agent_facebook_marketing/_vendored/connector_sdk/__init__.py +82 -0
  4. airbyte_agent_facebook_marketing/_vendored/connector_sdk/auth_strategies.py +1171 -0
  5. airbyte_agent_facebook_marketing/_vendored/connector_sdk/auth_template.py +135 -0
  6. airbyte_agent_facebook_marketing/_vendored/connector_sdk/cloud_utils/__init__.py +5 -0
  7. airbyte_agent_facebook_marketing/_vendored/connector_sdk/cloud_utils/client.py +213 -0
  8. airbyte_agent_facebook_marketing/_vendored/connector_sdk/connector_model_loader.py +1120 -0
  9. airbyte_agent_facebook_marketing/_vendored/connector_sdk/constants.py +78 -0
  10. airbyte_agent_facebook_marketing/_vendored/connector_sdk/exceptions.py +23 -0
  11. airbyte_agent_facebook_marketing/_vendored/connector_sdk/executor/__init__.py +31 -0
  12. airbyte_agent_facebook_marketing/_vendored/connector_sdk/executor/hosted_executor.py +201 -0
  13. airbyte_agent_facebook_marketing/_vendored/connector_sdk/executor/local_executor.py +1854 -0
  14. airbyte_agent_facebook_marketing/_vendored/connector_sdk/executor/models.py +202 -0
  15. airbyte_agent_facebook_marketing/_vendored/connector_sdk/extensions.py +693 -0
  16. airbyte_agent_facebook_marketing/_vendored/connector_sdk/http/__init__.py +37 -0
  17. airbyte_agent_facebook_marketing/_vendored/connector_sdk/http/adapters/__init__.py +9 -0
  18. airbyte_agent_facebook_marketing/_vendored/connector_sdk/http/adapters/httpx_adapter.py +251 -0
  19. airbyte_agent_facebook_marketing/_vendored/connector_sdk/http/config.py +98 -0
  20. airbyte_agent_facebook_marketing/_vendored/connector_sdk/http/exceptions.py +119 -0
  21. airbyte_agent_facebook_marketing/_vendored/connector_sdk/http/protocols.py +114 -0
  22. airbyte_agent_facebook_marketing/_vendored/connector_sdk/http/response.py +104 -0
  23. airbyte_agent_facebook_marketing/_vendored/connector_sdk/http_client.py +693 -0
  24. airbyte_agent_facebook_marketing/_vendored/connector_sdk/introspection.py +481 -0
  25. airbyte_agent_facebook_marketing/_vendored/connector_sdk/logging/__init__.py +11 -0
  26. airbyte_agent_facebook_marketing/_vendored/connector_sdk/logging/logger.py +273 -0
  27. airbyte_agent_facebook_marketing/_vendored/connector_sdk/logging/types.py +93 -0
  28. airbyte_agent_facebook_marketing/_vendored/connector_sdk/observability/__init__.py +11 -0
  29. airbyte_agent_facebook_marketing/_vendored/connector_sdk/observability/config.py +179 -0
  30. airbyte_agent_facebook_marketing/_vendored/connector_sdk/observability/models.py +19 -0
  31. airbyte_agent_facebook_marketing/_vendored/connector_sdk/observability/redactor.py +81 -0
  32. airbyte_agent_facebook_marketing/_vendored/connector_sdk/observability/session.py +103 -0
  33. airbyte_agent_facebook_marketing/_vendored/connector_sdk/performance/__init__.py +6 -0
  34. airbyte_agent_facebook_marketing/_vendored/connector_sdk/performance/instrumentation.py +57 -0
  35. airbyte_agent_facebook_marketing/_vendored/connector_sdk/performance/metrics.py +93 -0
  36. airbyte_agent_facebook_marketing/_vendored/connector_sdk/schema/__init__.py +75 -0
  37. airbyte_agent_facebook_marketing/_vendored/connector_sdk/schema/base.py +201 -0
  38. airbyte_agent_facebook_marketing/_vendored/connector_sdk/schema/components.py +244 -0
  39. airbyte_agent_facebook_marketing/_vendored/connector_sdk/schema/connector.py +120 -0
  40. airbyte_agent_facebook_marketing/_vendored/connector_sdk/schema/extensions.py +301 -0
  41. airbyte_agent_facebook_marketing/_vendored/connector_sdk/schema/operations.py +156 -0
  42. airbyte_agent_facebook_marketing/_vendored/connector_sdk/schema/security.py +236 -0
  43. airbyte_agent_facebook_marketing/_vendored/connector_sdk/secrets.py +182 -0
  44. airbyte_agent_facebook_marketing/_vendored/connector_sdk/telemetry/__init__.py +10 -0
  45. airbyte_agent_facebook_marketing/_vendored/connector_sdk/telemetry/config.py +32 -0
  46. airbyte_agent_facebook_marketing/_vendored/connector_sdk/telemetry/events.py +59 -0
  47. airbyte_agent_facebook_marketing/_vendored/connector_sdk/telemetry/tracker.py +155 -0
  48. airbyte_agent_facebook_marketing/_vendored/connector_sdk/types.py +270 -0
  49. airbyte_agent_facebook_marketing/_vendored/connector_sdk/utils.py +60 -0
  50. airbyte_agent_facebook_marketing/_vendored/connector_sdk/validation.py +848 -0
  51. airbyte_agent_facebook_marketing/connector.py +1553 -0
  52. airbyte_agent_facebook_marketing/connector_model.py +3120 -0
  53. airbyte_agent_facebook_marketing/models.py +814 -0
  54. airbyte_agent_facebook_marketing/types.py +1957 -0
  55. airbyte_agent_facebook_marketing-0.1.0.dist-info/METADATA +148 -0
  56. airbyte_agent_facebook_marketing-0.1.0.dist-info/RECORD +57 -0
  57. airbyte_agent_facebook_marketing-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,814 @@
1
+ """
2
+ Pydantic models for facebook-marketing 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 FacebookMarketingAuthConfig(BaseModel):
16
+ """Facebook Marketing Authentication"""
17
+
18
+ model_config = ConfigDict(extra="forbid")
19
+
20
+ access_token: str
21
+ """Facebook Marketing API access token"""
22
+ account_id: str
23
+ """Facebook Ad Account ID (without the act_ prefix)"""
24
+
25
+ # ===== RESPONSE TYPE DEFINITIONS (PYDANTIC) =====
26
+
27
+ class IssueInfo(BaseModel):
28
+ """IssueInfo type definition"""
29
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
30
+
31
+ error_code: Union[str | None, Any] = Field(default=None)
32
+ error_message: Union[str | None, Any] = Field(default=None)
33
+ error_summary: Union[str | None, Any] = Field(default=None)
34
+ error_type: Union[str | None, Any] = Field(default=None)
35
+ level: Union[str | None, Any] = Field(default=None)
36
+
37
+ class AdLabel(BaseModel):
38
+ """AdLabel type definition"""
39
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
40
+
41
+ id: Union[str | None, Any] = Field(default=None)
42
+ name: Union[str | None, Any] = Field(default=None)
43
+ created_time: Union[str | None, Any] = Field(default=None)
44
+ updated_time: Union[str | None, Any] = Field(default=None)
45
+
46
+ class Campaign(BaseModel):
47
+ """Facebook Ad Campaign"""
48
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
49
+
50
+ id: Union[str, Any] = Field(default=None)
51
+ name: Union[str | None, Any] = Field(default=None)
52
+ account_id: Union[str | None, Any] = Field(default=None)
53
+ adlabels: Union[list[AdLabel] | None, Any] = Field(default=None)
54
+ bid_strategy: Union[str | None, Any] = Field(default=None)
55
+ boosted_object_id: Union[str | None, Any] = Field(default=None)
56
+ budget_rebalance_flag: Union[bool | None, Any] = Field(default=None)
57
+ budget_remaining: Union[float | None, Any] = Field(default=None)
58
+ buying_type: Union[str | None, Any] = Field(default=None)
59
+ daily_budget: Union[float | None, Any] = Field(default=None)
60
+ created_time: Union[str | None, Any] = Field(default=None)
61
+ configured_status: Union[str | None, Any] = Field(default=None)
62
+ effective_status: Union[str | None, Any] = Field(default=None)
63
+ issues_info: Union[list[IssueInfo] | None, Any] = Field(default=None)
64
+ lifetime_budget: Union[float | None, Any] = Field(default=None)
65
+ objective: Union[str | None, Any] = Field(default=None)
66
+ smart_promotion_type: Union[str | None, Any] = Field(default=None)
67
+ source_campaign_id: Union[str | None, Any] = Field(default=None)
68
+ special_ad_category: Union[str | None, Any] = Field(default=None)
69
+ special_ad_category_country: Union[list[str | None] | None, Any] = Field(default=None)
70
+ spend_cap: Union[float | None, Any] = Field(default=None)
71
+ start_time: Union[str | None, Any] = Field(default=None)
72
+ status: Union[str | None, Any] = Field(default=None)
73
+ stop_time: Union[str | None, Any] = Field(default=None)
74
+ updated_time: Union[str | None, Any] = Field(default=None)
75
+
76
+ class PagingCursors(BaseModel):
77
+ """Nested schema for Paging.cursors"""
78
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
79
+
80
+ before: Union[str | None, Any] = Field(default=None, description="Cursor for previous page")
81
+ """Cursor for previous page"""
82
+ after: Union[str | None, Any] = Field(default=None, description="Cursor for next page")
83
+ """Cursor for next page"""
84
+
85
+ class Paging(BaseModel):
86
+ """Paging type definition"""
87
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
88
+
89
+ cursors: Union[PagingCursors, Any] = Field(default=None)
90
+ next: Union[str | None, Any] = Field(default=None)
91
+ previous: Union[str | None, Any] = Field(default=None)
92
+
93
+ class CampaignsList(BaseModel):
94
+ """CampaignsList type definition"""
95
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
96
+
97
+ data: Union[list[Campaign], Any] = Field(default=None)
98
+ paging: Union[Paging, Any] = Field(default=None)
99
+
100
+ class AdSet(BaseModel):
101
+ """Facebook Ad Set"""
102
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
103
+
104
+ id: Union[str, Any] = Field(default=None)
105
+ name: Union[str | None, Any] = Field(default=None)
106
+ account_id: Union[str | None, Any] = Field(default=None)
107
+ adlabels: Union[list[AdLabel] | None, Any] = Field(default=None)
108
+ bid_amount: Union[float | None, Any] = Field(default=None)
109
+ bid_info: Union[Any, Any] = Field(default=None)
110
+ bid_strategy: Union[str | None, Any] = Field(default=None)
111
+ bid_constraints: Union[Any, Any] = Field(default=None)
112
+ budget_remaining: Union[float | None, Any] = Field(default=None)
113
+ campaign_id: Union[str | None, Any] = Field(default=None)
114
+ created_time: Union[str | None, Any] = Field(default=None)
115
+ daily_budget: Union[float | None, Any] = Field(default=None)
116
+ effective_status: Union[str | None, Any] = Field(default=None)
117
+ end_time: Union[str | None, Any] = Field(default=None)
118
+ learning_stage_info: Union[Any, Any] = Field(default=None)
119
+ lifetime_budget: Union[float | None, Any] = Field(default=None)
120
+ promoted_object: Union[Any, Any] = Field(default=None)
121
+ start_time: Union[str | None, Any] = Field(default=None)
122
+ targeting: Union[dict[str, Any] | None, Any] = Field(default=None)
123
+ updated_time: Union[str | None, Any] = Field(default=None)
124
+
125
+ class AdSetsList(BaseModel):
126
+ """AdSetsList type definition"""
127
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
128
+
129
+ data: Union[list[AdSet], Any] = Field(default=None)
130
+ paging: Union[Paging, Any] = Field(default=None)
131
+
132
+ class Recommendation(BaseModel):
133
+ """Recommendation type definition"""
134
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
135
+
136
+ blame_field: Union[str | None, Any] = Field(default=None)
137
+ code: Union[int | None, Any] = Field(default=None)
138
+ confidence: Union[str | None, Any] = Field(default=None)
139
+ importance: Union[str | None, Any] = Field(default=None)
140
+ message: Union[str | None, Any] = Field(default=None)
141
+ title: Union[str | None, Any] = Field(default=None)
142
+
143
+ class Ad(BaseModel):
144
+ """Facebook Ad"""
145
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
146
+
147
+ id: Union[str, Any] = Field(default=None)
148
+ name: Union[str | None, Any] = Field(default=None)
149
+ account_id: Union[str | None, Any] = Field(default=None)
150
+ adset_id: Union[str | None, Any] = Field(default=None)
151
+ campaign_id: Union[str | None, Any] = Field(default=None)
152
+ adlabels: Union[list[AdLabel] | None, Any] = Field(default=None)
153
+ bid_amount: Union[int | None, Any] = Field(default=None)
154
+ bid_info: Union[Any, Any] = Field(default=None)
155
+ bid_type: Union[str | None, Any] = Field(default=None)
156
+ configured_status: Union[str | None, Any] = Field(default=None)
157
+ conversion_specs: Union[list[dict[str, Any]] | None, Any] = Field(default=None)
158
+ created_time: Union[str | None, Any] = Field(default=None)
159
+ creative: Union[Any, Any] = Field(default=None)
160
+ effective_status: Union[str | None, Any] = Field(default=None)
161
+ last_updated_by_app_id: Union[str | None, Any] = Field(default=None)
162
+ recommendations: Union[list[Recommendation] | None, Any] = Field(default=None)
163
+ source_ad_id: Union[str | None, Any] = Field(default=None)
164
+ status: Union[str | None, Any] = Field(default=None)
165
+ tracking_specs: Union[list[dict[str, Any]] | None, Any] = Field(default=None)
166
+ updated_time: Union[str | None, Any] = Field(default=None)
167
+
168
+ class AdsList(BaseModel):
169
+ """AdsList type definition"""
170
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
171
+
172
+ data: Union[list[Ad], Any] = Field(default=None)
173
+ paging: Union[Paging, Any] = Field(default=None)
174
+
175
+ class AdCreative(BaseModel):
176
+ """Facebook Ad Creative"""
177
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
178
+
179
+ id: Union[str, Any] = Field(default=None)
180
+ name: Union[str | None, Any] = Field(default=None)
181
+ account_id: Union[str | None, Any] = Field(default=None)
182
+ actor_id: Union[str | None, Any] = Field(default=None)
183
+ body: Union[str | None, Any] = Field(default=None)
184
+ call_to_action_type: Union[str | None, Any] = Field(default=None)
185
+ effective_object_story_id: Union[str | None, Any] = Field(default=None)
186
+ image_hash: Union[str | None, Any] = Field(default=None)
187
+ image_url: Union[str | None, Any] = Field(default=None)
188
+ link_url: Union[str | None, Any] = Field(default=None)
189
+ object_story_id: Union[str | None, Any] = Field(default=None)
190
+ object_story_spec: Union[dict[str, Any] | None, Any] = Field(default=None)
191
+ object_type: Union[str | None, Any] = Field(default=None)
192
+ status: Union[str | None, Any] = Field(default=None)
193
+ thumbnail_url: Union[str | None, Any] = Field(default=None)
194
+ title: Union[str | None, Any] = Field(default=None)
195
+ url_tags: Union[str | None, Any] = Field(default=None)
196
+
197
+ class AdCreativesList(BaseModel):
198
+ """AdCreativesList type definition"""
199
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
200
+
201
+ data: Union[list[AdCreative], Any] = Field(default=None)
202
+ paging: Union[Paging, Any] = Field(default=None)
203
+
204
+ class AdsInsight(BaseModel):
205
+ """Facebook Ads Insight"""
206
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
207
+
208
+ account_id: Union[str | None, Any] = Field(default=None)
209
+ account_name: Union[str | None, Any] = Field(default=None)
210
+ campaign_id: Union[str | None, Any] = Field(default=None)
211
+ campaign_name: Union[str | None, Any] = Field(default=None)
212
+ adset_id: Union[str | None, Any] = Field(default=None)
213
+ adset_name: Union[str | None, Any] = Field(default=None)
214
+ ad_id: Union[str | None, Any] = Field(default=None)
215
+ ad_name: Union[str | None, Any] = Field(default=None)
216
+ clicks: Union[int | None, Any] = Field(default=None)
217
+ impressions: Union[int | None, Any] = Field(default=None)
218
+ reach: Union[int | None, Any] = Field(default=None)
219
+ spend: Union[float | None, Any] = Field(default=None)
220
+ cpc: Union[float | None, Any] = Field(default=None)
221
+ cpm: Union[float | None, Any] = Field(default=None)
222
+ ctr: Union[float | None, Any] = Field(default=None)
223
+ date_start: Union[str | None, Any] = Field(default=None)
224
+ date_stop: Union[str | None, Any] = Field(default=None)
225
+
226
+ class AdsInsightsList(BaseModel):
227
+ """AdsInsightsList type definition"""
228
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
229
+
230
+ data: Union[list[AdsInsight], Any] = Field(default=None)
231
+ paging: Union[Paging, Any] = Field(default=None)
232
+
233
+ class DataSource(BaseModel):
234
+ """DataSource type definition"""
235
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
236
+
237
+ id: Union[str | None, Any] = Field(default=None)
238
+ source_type: Union[str | None, Any] = Field(default=None)
239
+ name: Union[str | None, Any] = Field(default=None)
240
+
241
+ class CustomConversion(BaseModel):
242
+ """Facebook Custom Conversion"""
243
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
244
+
245
+ id: Union[str, Any] = Field(default=None)
246
+ name: Union[str | None, Any] = Field(default=None)
247
+ account_id: Union[str | None, Any] = Field(default=None)
248
+ business: Union[str | None, Any] = Field(default=None)
249
+ creation_time: Union[str | None, Any] = Field(default=None)
250
+ custom_event_type: Union[str | None, Any] = Field(default=None)
251
+ data_sources: Union[list[DataSource] | None, Any] = Field(default=None)
252
+ default_conversion_value: Union[float | None, Any] = Field(default=None)
253
+ description: Union[str | None, Any] = Field(default=None)
254
+ event_source_type: Union[str | None, Any] = Field(default=None)
255
+ first_fired_time: Union[str | None, Any] = Field(default=None)
256
+ is_archived: Union[bool | None, Any] = Field(default=None)
257
+ is_unavailable: Union[bool | None, Any] = Field(default=None)
258
+ last_fired_time: Union[str | None, Any] = Field(default=None)
259
+ offline_conversion_data_set: Union[str | None, Any] = Field(default=None)
260
+ retention_days: Union[float | None, Any] = Field(default=None)
261
+ rule: Union[str | None, Any] = Field(default=None)
262
+
263
+ class CustomConversionsList(BaseModel):
264
+ """CustomConversionsList type definition"""
265
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
266
+
267
+ data: Union[list[CustomConversion], Any] = Field(default=None)
268
+ paging: Union[Paging, Any] = Field(default=None)
269
+
270
+ class Image(BaseModel):
271
+ """Image type definition"""
272
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
273
+
274
+ id: Union[str | None, Any] = Field(default=None)
275
+ name: Union[str | None, Any] = Field(default=None)
276
+ account_id: Union[str | None, Any] = Field(default=None)
277
+ created_time: Union[str | None, Any] = Field(default=None)
278
+ creatives: Union[list[str | None] | None, Any] = Field(default=None)
279
+ filename: Union[str | None, Any] = Field(default=None)
280
+ hash: Union[str | None, Any] = Field(default=None)
281
+ height: Union[int | None, Any] = Field(default=None)
282
+ is_associated_creatives_in_adgroups: Union[bool | None, Any] = Field(default=None)
283
+ original_height: Union[int | None, Any] = Field(default=None)
284
+ original_width: Union[int | None, Any] = Field(default=None)
285
+ permalink_url: Union[str | None, Any] = Field(default=None)
286
+ status: Union[str | None, Any] = Field(default=None)
287
+ updated_time: Union[str | None, Any] = Field(default=None)
288
+ url: Union[str | None, Any] = Field(default=None)
289
+ url_128: Union[str | None, Any] = Field(default=None)
290
+ width: Union[int | None, Any] = Field(default=None)
291
+
292
+ class ImagesList(BaseModel):
293
+ """ImagesList type definition"""
294
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
295
+
296
+ data: Union[list[Image], Any] = Field(default=None)
297
+ paging: Union[Paging, Any] = Field(default=None)
298
+
299
+ class VideoFormat(BaseModel):
300
+ """VideoFormat type definition"""
301
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
302
+
303
+ filter: Union[str | None, Any] = Field(default=None)
304
+ embed_html: Union[str | None, Any] = Field(default=None)
305
+ width: Union[int | None, Any] = Field(default=None)
306
+ height: Union[int | None, Any] = Field(default=None)
307
+ picture: Union[str | None, Any] = Field(default=None)
308
+
309
+ class Video(BaseModel):
310
+ """Video type definition"""
311
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
312
+
313
+ id: Union[str, Any] = Field(default=None)
314
+ title: Union[str | None, Any] = Field(default=None)
315
+ account_id: Union[str | None, Any] = Field(default=None)
316
+ ad_breaks: Union[list[int] | None, Any] = Field(default=None)
317
+ backdated_time: Union[str | None, Any] = Field(default=None)
318
+ backdated_time_granularity: Union[str | None, Any] = Field(default=None)
319
+ content_category: Union[str | None, Any] = Field(default=None)
320
+ content_tags: Union[list[str] | None, Any] = Field(default=None)
321
+ created_time: Union[str | None, Any] = Field(default=None)
322
+ custom_labels: Union[list[str] | None, Any] = Field(default=None)
323
+ description: Union[str | None, Any] = Field(default=None)
324
+ embed_html: Union[str | None, Any] = Field(default=None)
325
+ embeddable: Union[bool | None, Any] = Field(default=None)
326
+ format: Union[list[VideoFormat] | None, Any] = Field(default=None)
327
+ icon: Union[str | None, Any] = Field(default=None)
328
+ is_crosspost_video: Union[bool | None, Any] = Field(default=None)
329
+ is_crossposting_eligible: Union[bool | None, Any] = Field(default=None)
330
+ is_episode: Union[bool | None, Any] = Field(default=None)
331
+ is_instagram_eligible: Union[bool | None, Any] = Field(default=None)
332
+ length: Union[float | None, Any] = Field(default=None)
333
+ live_status: Union[str | None, Any] = Field(default=None)
334
+ permalink_url: Union[str | None, Any] = Field(default=None)
335
+ post_views: Union[int | None, Any] = Field(default=None)
336
+ premiere_living_room_status: Union[bool | None, Any] = Field(default=None)
337
+ published: Union[bool | None, Any] = Field(default=None)
338
+ scheduled_publish_time: Union[str | None, Any] = Field(default=None)
339
+ source: Union[str | None, Any] = Field(default=None)
340
+ universal_video_id: Union[str | None, Any] = Field(default=None)
341
+ updated_time: Union[str | None, Any] = Field(default=None)
342
+ views: Union[int | None, Any] = Field(default=None)
343
+
344
+ class VideosList(BaseModel):
345
+ """VideosList type definition"""
346
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
347
+
348
+ data: Union[list[Video], Any] = Field(default=None)
349
+ paging: Union[Paging, Any] = Field(default=None)
350
+
351
+ class BidInfo(BaseModel):
352
+ """BidInfo type definition"""
353
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
354
+
355
+ clicks: Union[int | None, Any] = Field(default=None, alias="CLICKS")
356
+ actions: Union[int | None, Any] = Field(default=None, alias="ACTIONS")
357
+ reach: Union[int | None, Any] = Field(default=None, alias="REACH")
358
+ impressions: Union[int | None, Any] = Field(default=None, alias="IMPRESSIONS")
359
+ social: Union[int | None, Any] = Field(default=None, alias="SOCIAL")
360
+
361
+ class BidConstraints(BaseModel):
362
+ """BidConstraints type definition"""
363
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
364
+
365
+ roas_average_floor: Union[int | None, Any] = Field(default=None)
366
+
367
+ class LearningStageInfo(BaseModel):
368
+ """LearningStageInfo type definition"""
369
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
370
+
371
+ status: Union[str | None, Any] = Field(default=None)
372
+ conversions: Union[int | None, Any] = Field(default=None)
373
+ last_sig_edit_ts: Union[int | None, Any] = Field(default=None)
374
+ attribution_windows: Union[list[str | None] | None, Any] = Field(default=None)
375
+
376
+ class PromotedObject(BaseModel):
377
+ """PromotedObject type definition"""
378
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
379
+
380
+ custom_event_type: Union[str | None, Any] = Field(default=None)
381
+ pixel_id: Union[str | None, Any] = Field(default=None)
382
+ pixel_rule: Union[str | None, Any] = Field(default=None)
383
+ page_id: Union[str | None, Any] = Field(default=None)
384
+ object_store_url: Union[str | None, Any] = Field(default=None)
385
+ application_id: Union[str | None, Any] = Field(default=None)
386
+ product_set_id: Union[str | None, Any] = Field(default=None)
387
+ offer_id: Union[str | None, Any] = Field(default=None)
388
+
389
+ class AdCreativeRef(BaseModel):
390
+ """AdCreativeRef type definition"""
391
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
392
+
393
+ id: Union[str | None, Any] = Field(default=None)
394
+ creative_id: Union[str | None, Any] = Field(default=None)
395
+
396
+ # ===== METADATA TYPE DEFINITIONS (PYDANTIC) =====
397
+ # Meta types for operations that extract metadata (e.g., pagination info)
398
+
399
+ class CampaignsListResultMeta(BaseModel):
400
+ """Metadata for campaigns.Action.LIST operation"""
401
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
402
+
403
+ after: Union[str | None, Any] = Field(default=None)
404
+
405
+ class AdSetsListResultMeta(BaseModel):
406
+ """Metadata for ad_sets.Action.LIST operation"""
407
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
408
+
409
+ after: Union[str | None, Any] = Field(default=None)
410
+
411
+ class AdsListResultMeta(BaseModel):
412
+ """Metadata for ads.Action.LIST operation"""
413
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
414
+
415
+ after: Union[str | None, Any] = Field(default=None)
416
+
417
+ class AdCreativesListResultMeta(BaseModel):
418
+ """Metadata for ad_creatives.Action.LIST operation"""
419
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
420
+
421
+ after: Union[str | None, Any] = Field(default=None)
422
+
423
+ class AdsInsightsListResultMeta(BaseModel):
424
+ """Metadata for ads_insights.Action.LIST operation"""
425
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
426
+
427
+ after: Union[str | None, Any] = Field(default=None)
428
+
429
+ class CustomConversionsListResultMeta(BaseModel):
430
+ """Metadata for custom_conversions.Action.LIST operation"""
431
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
432
+
433
+ after: Union[str | None, Any] = Field(default=None)
434
+
435
+ class ImagesListResultMeta(BaseModel):
436
+ """Metadata for images.Action.LIST operation"""
437
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
438
+
439
+ after: Union[str | None, Any] = Field(default=None)
440
+
441
+ class VideosListResultMeta(BaseModel):
442
+ """Metadata for videos.Action.LIST operation"""
443
+ model_config = ConfigDict(extra="allow", populate_by_name=True)
444
+
445
+ after: Union[str | None, Any] = Field(default=None)
446
+
447
+ # ===== CHECK RESULT MODEL =====
448
+
449
+ class FacebookMarketingCheckResult(BaseModel):
450
+ """Result of a health check operation.
451
+
452
+ Returned by the check() method to indicate connectivity and credential status.
453
+ """
454
+ model_config = ConfigDict(extra="forbid")
455
+
456
+ status: str
457
+ """Health check status: 'healthy' or 'unhealthy'."""
458
+ error: str | None = None
459
+ """Error message if status is 'unhealthy', None otherwise."""
460
+ checked_entity: str | None = None
461
+ """Entity name used for the health check."""
462
+ checked_action: str | None = None
463
+ """Action name used for the health check."""
464
+
465
+
466
+ # ===== RESPONSE ENVELOPE MODELS =====
467
+
468
+ # Type variables for generic envelope models
469
+ T = TypeVar('T')
470
+ S = TypeVar('S')
471
+
472
+
473
+ class FacebookMarketingExecuteResult(BaseModel, Generic[T]):
474
+ """Response envelope with data only.
475
+
476
+ Used for actions that return data without metadata.
477
+ """
478
+ model_config = ConfigDict(extra="forbid")
479
+
480
+ data: T
481
+ """Response data containing the result of the action."""
482
+
483
+
484
+ class FacebookMarketingExecuteResultWithMeta(FacebookMarketingExecuteResult[T], Generic[T, S]):
485
+ """Response envelope with data and metadata.
486
+
487
+ Used for actions that return both data and metadata (e.g., pagination info).
488
+ """
489
+ meta: S
490
+ """Metadata about the response (e.g., pagination cursors, record counts)."""
491
+
492
+ # ===== SEARCH DATA MODELS =====
493
+ # Entity-specific Pydantic models for search result data
494
+
495
+ # Type variable for search data generic
496
+ D = TypeVar('D')
497
+
498
+ class CampaignsSearchData(BaseModel):
499
+ """Search result data for campaigns entity."""
500
+ model_config = ConfigDict(extra="allow")
501
+
502
+ id: str | None = None
503
+ """Campaign ID"""
504
+ name: str | None = None
505
+ """Campaign name"""
506
+ account_id: str | None = None
507
+ """Ad account ID"""
508
+ status: str | None = None
509
+ """Campaign status"""
510
+ effective_status: str | None = None
511
+ """Effective status"""
512
+ objective: str | None = None
513
+ """Campaign objective"""
514
+ daily_budget: float | None = None
515
+ """Daily budget in account currency"""
516
+ lifetime_budget: float | None = None
517
+ """Lifetime budget"""
518
+ budget_remaining: float | None = None
519
+ """Remaining budget"""
520
+ created_time: str | None = None
521
+ """Campaign creation time"""
522
+ start_time: str | None = None
523
+ """Campaign start time"""
524
+ stop_time: str | None = None
525
+ """Campaign stop time"""
526
+ updated_time: str | None = None
527
+ """Last update time"""
528
+
529
+
530
+ class AdSetsSearchData(BaseModel):
531
+ """Search result data for ad_sets entity."""
532
+ model_config = ConfigDict(extra="allow")
533
+
534
+ id: str | None = None
535
+ """Ad Set ID"""
536
+ name: str | None = None
537
+ """Ad Set name"""
538
+ account_id: str | None = None
539
+ """Ad account ID"""
540
+ campaign_id: str | None = None
541
+ """Parent campaign ID"""
542
+ effective_status: str | None = None
543
+ """Effective status"""
544
+ daily_budget: float | None = None
545
+ """Daily budget"""
546
+ lifetime_budget: float | None = None
547
+ """Lifetime budget"""
548
+ budget_remaining: float | None = None
549
+ """Remaining budget"""
550
+ bid_amount: float | None = None
551
+ """Bid amount"""
552
+ bid_strategy: str | None = None
553
+ """Bid strategy"""
554
+ created_time: str | None = None
555
+ """Ad set creation time"""
556
+ start_time: str | None = None
557
+ """Ad set start time"""
558
+ end_time: str | None = None
559
+ """Ad set end time"""
560
+ updated_time: str | None = None
561
+ """Last update time"""
562
+
563
+
564
+ class AdsSearchData(BaseModel):
565
+ """Search result data for ads entity."""
566
+ model_config = ConfigDict(extra="allow")
567
+
568
+ id: str | None = None
569
+ """Ad ID"""
570
+ name: str | None = None
571
+ """Ad name"""
572
+ account_id: str | None = None
573
+ """Ad account ID"""
574
+ adset_id: str | None = None
575
+ """Parent ad set ID"""
576
+ campaign_id: str | None = None
577
+ """Parent campaign ID"""
578
+ status: str | None = None
579
+ """Ad status"""
580
+ effective_status: str | None = None
581
+ """Effective status"""
582
+ created_time: str | None = None
583
+ """Ad creation time"""
584
+ updated_time: str | None = None
585
+ """Last update time"""
586
+
587
+
588
+ class AdCreativesSearchData(BaseModel):
589
+ """Search result data for ad_creatives entity."""
590
+ model_config = ConfigDict(extra="allow")
591
+
592
+ id: str | None = None
593
+ """Ad Creative ID"""
594
+ name: str | None = None
595
+ """Ad Creative name"""
596
+ account_id: str | None = None
597
+ """Ad account ID"""
598
+ body: str | None = None
599
+ """Ad body text"""
600
+ title: str | None = None
601
+ """Ad title"""
602
+ status: str | None = None
603
+ """Creative status"""
604
+ image_url: str | None = None
605
+ """Image URL"""
606
+ thumbnail_url: str | None = None
607
+ """Thumbnail URL"""
608
+ link_url: str | None = None
609
+ """Link URL"""
610
+ call_to_action_type: str | None = None
611
+ """Call to action type"""
612
+
613
+
614
+ class AdsInsightsSearchData(BaseModel):
615
+ """Search result data for ads_insights entity."""
616
+ model_config = ConfigDict(extra="allow")
617
+
618
+ account_id: str | None = None
619
+ """Ad account ID"""
620
+ account_name: str | None = None
621
+ """Ad account name"""
622
+ campaign_id: str | None = None
623
+ """Campaign ID"""
624
+ campaign_name: str | None = None
625
+ """Campaign name"""
626
+ adset_id: str | None = None
627
+ """Ad set ID"""
628
+ adset_name: str | None = None
629
+ """Ad set name"""
630
+ ad_id: str | None = None
631
+ """Ad ID"""
632
+ ad_name: str | None = None
633
+ """Ad name"""
634
+ clicks: int | None = None
635
+ """Number of clicks"""
636
+ impressions: int | None = None
637
+ """Number of impressions"""
638
+ reach: int | None = None
639
+ """Number of unique people reached"""
640
+ spend: float | None = None
641
+ """Amount spent"""
642
+ cpc: float | None = None
643
+ """Cost per click"""
644
+ cpm: float | None = None
645
+ """Cost per 1000 impressions"""
646
+ ctr: float | None = None
647
+ """Click-through rate"""
648
+ date_start: str | None = None
649
+ """Start date of the reporting period"""
650
+ date_stop: str | None = None
651
+ """End date of the reporting period"""
652
+
653
+
654
+ class CustomConversionsSearchData(BaseModel):
655
+ """Search result data for custom_conversions entity."""
656
+ model_config = ConfigDict(extra="allow")
657
+
658
+ id: str | None = None
659
+ """Custom Conversion ID"""
660
+ name: str | None = None
661
+ """Custom Conversion name"""
662
+ account_id: str | None = None
663
+ """Ad account ID"""
664
+ description: str | None = None
665
+ """Description"""
666
+ custom_event_type: str | None = None
667
+ """Custom event type"""
668
+ creation_time: str | None = None
669
+ """Creation time"""
670
+ first_fired_time: str | None = None
671
+ """First fired time"""
672
+ last_fired_time: str | None = None
673
+ """Last fired time"""
674
+ is_archived: bool | None = None
675
+ """Whether the conversion is archived"""
676
+
677
+
678
+ class ImagesSearchData(BaseModel):
679
+ """Search result data for images entity."""
680
+ model_config = ConfigDict(extra="allow")
681
+
682
+ id: str | None = None
683
+ """Image ID"""
684
+ name: str | None = None
685
+ """Image name"""
686
+ account_id: str | None = None
687
+ """Ad account ID"""
688
+ hash: str | None = None
689
+ """Image hash"""
690
+ url: str | None = None
691
+ """Image URL"""
692
+ permalink_url: str | None = None
693
+ """Permalink URL"""
694
+ width: int | None = None
695
+ """Image width"""
696
+ height: int | None = None
697
+ """Image height"""
698
+ status: str | None = None
699
+ """Image status"""
700
+ created_time: str | None = None
701
+ """Creation time"""
702
+ updated_time: str | None = None
703
+ """Last update time"""
704
+
705
+
706
+ class VideosSearchData(BaseModel):
707
+ """Search result data for videos entity."""
708
+ model_config = ConfigDict(extra="allow")
709
+
710
+ id: str | None = None
711
+ """Video ID"""
712
+ title: str | None = None
713
+ """Video title"""
714
+ account_id: str | None = None
715
+ """Ad account ID"""
716
+ description: str | None = None
717
+ """Video description"""
718
+ length: float | None = None
719
+ """Video length in seconds"""
720
+ source: str | None = None
721
+ """Video source URL"""
722
+ permalink_url: str | None = None
723
+ """Permalink URL"""
724
+ views: int | None = None
725
+ """Number of views"""
726
+ created_time: str | None = None
727
+ """Creation time"""
728
+ updated_time: str | None = None
729
+ """Last update time"""
730
+
731
+
732
+ # ===== GENERIC SEARCH RESULT TYPES =====
733
+
734
+ class AirbyteSearchHit(BaseModel, Generic[D]):
735
+ """A single search result with typed data."""
736
+ model_config = ConfigDict(extra="allow")
737
+
738
+ id: str | None = None
739
+ """Unique identifier for the record."""
740
+ score: float | None = None
741
+ """Relevance score for the match."""
742
+ data: D
743
+ """The matched record data."""
744
+
745
+
746
+ class AirbyteSearchResult(BaseModel, Generic[D]):
747
+ """Result from Airbyte cache search operations with typed hits."""
748
+ model_config = ConfigDict(extra="allow")
749
+
750
+ hits: list[AirbyteSearchHit[D]] = Field(default_factory=list)
751
+ """List of matching records."""
752
+ next_cursor: str | None = None
753
+ """Cursor for fetching the next page of results."""
754
+ took_ms: int | None = None
755
+ """Time taken to execute the search in milliseconds."""
756
+
757
+
758
+ # ===== ENTITY-SPECIFIC SEARCH RESULT TYPE ALIASES =====
759
+
760
+ CampaignsSearchResult = AirbyteSearchResult[CampaignsSearchData]
761
+ """Search result type for campaigns entity."""
762
+
763
+ AdSetsSearchResult = AirbyteSearchResult[AdSetsSearchData]
764
+ """Search result type for ad_sets entity."""
765
+
766
+ AdsSearchResult = AirbyteSearchResult[AdsSearchData]
767
+ """Search result type for ads entity."""
768
+
769
+ AdCreativesSearchResult = AirbyteSearchResult[AdCreativesSearchData]
770
+ """Search result type for ad_creatives entity."""
771
+
772
+ AdsInsightsSearchResult = AirbyteSearchResult[AdsInsightsSearchData]
773
+ """Search result type for ads_insights entity."""
774
+
775
+ CustomConversionsSearchResult = AirbyteSearchResult[CustomConversionsSearchData]
776
+ """Search result type for custom_conversions entity."""
777
+
778
+ ImagesSearchResult = AirbyteSearchResult[ImagesSearchData]
779
+ """Search result type for images entity."""
780
+
781
+ VideosSearchResult = AirbyteSearchResult[VideosSearchData]
782
+ """Search result type for videos entity."""
783
+
784
+
785
+
786
+ # ===== OPERATION RESULT TYPE ALIASES =====
787
+
788
+ # Concrete type aliases for each operation result.
789
+ # These provide simpler, more readable type annotations than using the generic forms.
790
+
791
+ CampaignsListResult = FacebookMarketingExecuteResultWithMeta[list[Campaign], CampaignsListResultMeta]
792
+ """Result type for campaigns.list operation with data and metadata."""
793
+
794
+ AdSetsListResult = FacebookMarketingExecuteResultWithMeta[list[AdSet], AdSetsListResultMeta]
795
+ """Result type for ad_sets.list operation with data and metadata."""
796
+
797
+ AdsListResult = FacebookMarketingExecuteResultWithMeta[list[Ad], AdsListResultMeta]
798
+ """Result type for ads.list operation with data and metadata."""
799
+
800
+ AdCreativesListResult = FacebookMarketingExecuteResultWithMeta[list[AdCreative], AdCreativesListResultMeta]
801
+ """Result type for ad_creatives.list operation with data and metadata."""
802
+
803
+ AdsInsightsListResult = FacebookMarketingExecuteResultWithMeta[list[AdsInsight], AdsInsightsListResultMeta]
804
+ """Result type for ads_insights.list operation with data and metadata."""
805
+
806
+ CustomConversionsListResult = FacebookMarketingExecuteResultWithMeta[list[CustomConversion], CustomConversionsListResultMeta]
807
+ """Result type for custom_conversions.list operation with data and metadata."""
808
+
809
+ ImagesListResult = FacebookMarketingExecuteResultWithMeta[list[Image], ImagesListResultMeta]
810
+ """Result type for images.list operation with data and metadata."""
811
+
812
+ VideosListResult = FacebookMarketingExecuteResultWithMeta[list[Video], VideosListResultMeta]
813
+ """Result type for videos.list operation with data and metadata."""
814
+