adcp 1.6.1__py3-none-any.whl → 2.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.
- adcp/__init__.py +110 -189
- adcp/adagents.py +11 -12
- adcp/client.py +16 -11
- adcp/py.typed +0 -0
- adcp/types/aliases.py +209 -0
- adcp/types/generated.py +540 -1134
- adcp/types/generated_poc/__init__.py +3 -0
- adcp/types/generated_poc/activate_signal_request.py +34 -0
- adcp/types/generated_poc/activate_signal_response.py +57 -0
- adcp/types/generated_poc/activation_key.py +30 -0
- adcp/types/generated_poc/adagents.py +266 -0
- adcp/types/generated_poc/asset_type.py +100 -0
- adcp/types/generated_poc/audio_asset.py +26 -0
- adcp/types/generated_poc/brand_manifest.py +260 -0
- adcp/types/generated_poc/brand_manifest_ref.py +361 -0
- adcp/types/generated_poc/build_creative_request.py +43 -0
- adcp/types/generated_poc/build_creative_response.py +57 -0
- adcp/types/generated_poc/channels.py +19 -0
- adcp/types/generated_poc/cpc_option.py +39 -0
- adcp/types/generated_poc/cpcv_option.py +41 -0
- adcp/types/generated_poc/cpm_auction_option.py +54 -0
- adcp/types/generated_poc/cpm_fixed_option.py +39 -0
- adcp/types/generated_poc/cpp_option.py +60 -0
- adcp/types/generated_poc/cpv_option.py +73 -0
- adcp/types/generated_poc/create_media_buy_request.py +96 -0
- adcp/types/generated_poc/create_media_buy_response.py +66 -0
- adcp/types/generated_poc/creative_asset.py +83 -0
- adcp/types/generated_poc/creative_assignment.py +27 -0
- adcp/types/generated_poc/creative_manifest.py +61 -0
- adcp/types/generated_poc/creative_policy.py +34 -0
- adcp/types/generated_poc/creative_status.py +14 -0
- adcp/types/generated_poc/css_asset.py +20 -0
- adcp/types/generated_poc/daast_asset.py +76 -0
- adcp/types/generated_poc/delivery_metrics.py +111 -0
- adcp/types/generated_poc/delivery_type.py +12 -0
- adcp/types/generated_poc/deployment.py +78 -0
- adcp/types/generated_poc/destination.py +43 -0
- adcp/types/generated_poc/error.py +29 -0
- adcp/types/generated_poc/flat_rate_option.py +93 -0
- adcp/types/generated_poc/format.py +260 -0
- adcp/types/generated_poc/format_id.py +29 -0
- adcp/types/generated_poc/frequency_cap.py +19 -0
- adcp/types/generated_poc/frequency_cap_scope.py +16 -0
- adcp/types/generated_poc/get_media_buy_delivery_request.py +65 -0
- adcp/types/generated_poc/get_media_buy_delivery_response.py +220 -0
- adcp/types/generated_poc/get_products_request.py +83 -0
- adcp/types/generated_poc/get_products_response.py +29 -0
- adcp/types/generated_poc/get_signals_request.py +77 -0
- adcp/types/generated_poc/get_signals_response.py +65 -0
- adcp/types/generated_poc/html_asset.py +18 -0
- adcp/types/generated_poc/identifier_types.py +29 -0
- adcp/types/generated_poc/image_asset.py +23 -0
- adcp/types/generated_poc/index.py +17 -0
- adcp/types/generated_poc/javascript_asset.py +25 -0
- adcp/types/generated_poc/list_authorized_properties_request.py +39 -0
- adcp/types/generated_poc/list_authorized_properties_response.py +85 -0
- adcp/types/generated_poc/list_creative_formats_request.py +93 -0
- adcp/types/generated_poc/list_creative_formats_response.py +63 -0
- adcp/types/generated_poc/list_creatives_request.py +154 -0
- adcp/types/generated_poc/list_creatives_response.py +234 -0
- adcp/types/generated_poc/markdown_asset.py +43 -0
- adcp/types/generated_poc/measurement.py +40 -0
- adcp/types/generated_poc/media_buy.py +37 -0
- adcp/types/generated_poc/media_buy_status.py +14 -0
- adcp/types/generated_poc/pacing.py +13 -0
- adcp/types/generated_poc/package.py +61 -0
- adcp/types/generated_poc/package_request.py +61 -0
- adcp/types/generated_poc/package_status.py +14 -0
- adcp/types/generated_poc/performance_feedback.py +89 -0
- adcp/types/generated_poc/placement.py +37 -0
- adcp/types/generated_poc/preview_creative_request.py +163 -0
- adcp/types/generated_poc/preview_creative_response.py +175 -0
- adcp/types/generated_poc/preview_render.py +144 -0
- adcp/types/generated_poc/pricing_model.py +17 -0
- adcp/types/generated_poc/pricing_option.py +365 -0
- adcp/types/generated_poc/product.py +211 -0
- adcp/types/generated_poc/promoted_offerings.py +102 -0
- adcp/types/generated_poc/promoted_products.py +38 -0
- adcp/types/generated_poc/property.py +79 -0
- adcp/types/generated_poc/protocol_envelope.py +61 -0
- adcp/types/generated_poc/provide_performance_feedback_request.py +85 -0
- adcp/types/generated_poc/provide_performance_feedback_response.py +59 -0
- adcp/types/generated_poc/publisher_identifier_types.py +15 -0
- adcp/types/generated_poc/push_notification_config.py +55 -0
- adcp/types/generated_poc/reporting_capabilities.py +68 -0
- adcp/types/generated_poc/response.py +24 -0
- adcp/types/generated_poc/standard_format_ids.py +45 -0
- adcp/types/generated_poc/start_timing.py +13 -0
- adcp/types/generated_poc/sub_asset.py +55 -0
- adcp/types/generated_poc/sync_creatives_request.py +69 -0
- adcp/types/generated_poc/sync_creatives_response.py +117 -0
- adcp/types/generated_poc/targeting.py +53 -0
- adcp/types/generated_poc/task_status.py +19 -0
- adcp/types/generated_poc/task_type.py +15 -0
- adcp/types/generated_poc/tasks_get_request.py +29 -0
- adcp/types/generated_poc/tasks_get_response.py +112 -0
- adcp/types/generated_poc/tasks_list_request.py +121 -0
- adcp/types/generated_poc/tasks_list_response.py +122 -0
- adcp/types/generated_poc/text_asset.py +20 -0
- adcp/types/generated_poc/update_media_buy_request.py +160 -0
- adcp/types/generated_poc/update_media_buy_response.py +67 -0
- adcp/types/generated_poc/url_asset.py +33 -0
- adcp/types/generated_poc/vast_asset.py +86 -0
- adcp/types/generated_poc/vcpm_auction_option.py +57 -0
- adcp/types/generated_poc/vcpm_fixed_option.py +43 -0
- adcp/types/generated_poc/video_asset.py +28 -0
- adcp/types/generated_poc/webhook_asset.py +65 -0
- adcp/types/generated_poc/webhook_payload.py +102 -0
- adcp/utils/preview_cache.py +54 -41
- adcp/validation.py +172 -0
- {adcp-1.6.1.dist-info → adcp-2.1.0.dist-info}/METADATA +42 -3
- adcp-2.1.0.dist-info/RECORD +132 -0
- adcp/types/tasks.py +0 -511
- adcp-1.6.1.dist-info/RECORD +0 -28
- {adcp-1.6.1.dist-info → adcp-2.1.0.dist-info}/WHEEL +0 -0
- {adcp-1.6.1.dist-info → adcp-2.1.0.dist-info}/entry_points.txt +0 -0
- {adcp-1.6.1.dist-info → adcp-2.1.0.dist-info}/licenses/LICENSE +0 -0
- {adcp-1.6.1.dist-info → adcp-2.1.0.dist-info}/top_level.txt +0 -0
adcp/__init__.py
CHANGED
|
@@ -48,122 +48,87 @@ from adcp.testing import (
|
|
|
48
48
|
test_agent_client,
|
|
49
49
|
test_agent_no_auth,
|
|
50
50
|
)
|
|
51
|
+
|
|
52
|
+
# Import all generated types - users can import what they need from adcp.types.generated
|
|
53
|
+
from adcp.types import aliases, generated
|
|
54
|
+
|
|
55
|
+
# Re-export semantic type aliases for better ergonomics
|
|
56
|
+
from adcp.types.aliases import (
|
|
57
|
+
ActivateSignalErrorResponse,
|
|
58
|
+
ActivateSignalSuccessResponse,
|
|
59
|
+
BuildCreativeErrorResponse,
|
|
60
|
+
BuildCreativeSuccessResponse,
|
|
61
|
+
CreateMediaBuyErrorResponse,
|
|
62
|
+
CreateMediaBuySuccessResponse,
|
|
63
|
+
PreviewCreativeFormatRequest,
|
|
64
|
+
PreviewCreativeInteractiveResponse,
|
|
65
|
+
PreviewCreativeManifestRequest,
|
|
66
|
+
PreviewCreativeStaticResponse,
|
|
67
|
+
PreviewRenderHtml,
|
|
68
|
+
PreviewRenderIframe,
|
|
69
|
+
PreviewRenderImage,
|
|
70
|
+
PropertyIdActivationKey,
|
|
71
|
+
PropertyTagActivationKey,
|
|
72
|
+
ProvidePerformanceFeedbackErrorResponse,
|
|
73
|
+
ProvidePerformanceFeedbackSuccessResponse,
|
|
74
|
+
SyncCreativesErrorResponse,
|
|
75
|
+
SyncCreativesSuccessResponse,
|
|
76
|
+
UpdateMediaBuyErrorResponse,
|
|
77
|
+
UpdateMediaBuyPackagesRequest,
|
|
78
|
+
UpdateMediaBuyPropertiesRequest,
|
|
79
|
+
UpdateMediaBuySuccessResponse,
|
|
80
|
+
)
|
|
51
81
|
from adcp.types.core import AgentConfig, Protocol, TaskResult, TaskStatus, WebhookMetadata
|
|
82
|
+
|
|
83
|
+
# Re-export commonly-used request/response types for convenience
|
|
84
|
+
# Users should import from main package (e.g., `from adcp import GetProductsRequest`)
|
|
85
|
+
# rather than internal modules for better API stability
|
|
52
86
|
from adcp.types.generated import (
|
|
53
|
-
|
|
54
|
-
# Request/Response types
|
|
87
|
+
# Audience & Targeting
|
|
55
88
|
ActivateSignalRequest,
|
|
56
89
|
ActivateSignalResponse,
|
|
57
|
-
|
|
58
|
-
ActivationKey,
|
|
59
|
-
AgentDeployment,
|
|
60
|
-
AgentDestination,
|
|
61
|
-
BothPreviewRender,
|
|
62
|
-
# Brand types
|
|
63
|
-
BrandManifest,
|
|
64
|
-
BrandManifestRef,
|
|
90
|
+
# Creative Operations
|
|
65
91
|
BuildCreativeRequest,
|
|
66
92
|
BuildCreativeResponse,
|
|
67
|
-
#
|
|
68
|
-
Channels,
|
|
69
|
-
CreateMediaBuyError,
|
|
93
|
+
# Media Buy Operations
|
|
70
94
|
CreateMediaBuyRequest,
|
|
71
95
|
CreateMediaBuyResponse,
|
|
72
|
-
|
|
73
|
-
# Creative types
|
|
74
|
-
CreativeAsset,
|
|
75
|
-
CreativeAssignment,
|
|
76
|
-
CreativeManifest,
|
|
77
|
-
CreativePolicy,
|
|
78
|
-
DaastAsset,
|
|
79
|
-
# Metrics types
|
|
80
|
-
DeliveryMetrics,
|
|
81
|
-
# Delivery types
|
|
82
|
-
DeliveryType,
|
|
83
|
-
Deployment,
|
|
84
|
-
# Deployment types
|
|
85
|
-
Destination,
|
|
96
|
+
# Common data types
|
|
86
97
|
Error,
|
|
87
98
|
Format,
|
|
88
|
-
FormatId,
|
|
89
|
-
FrequencyCap,
|
|
90
99
|
GetMediaBuyDeliveryRequest,
|
|
91
100
|
GetMediaBuyDeliveryResponse,
|
|
92
101
|
GetProductsRequest,
|
|
93
102
|
GetProductsResponse,
|
|
94
103
|
GetSignalsRequest,
|
|
95
104
|
GetSignalsResponse,
|
|
96
|
-
HtmlPreviewRender,
|
|
97
|
-
InlineDaastAsset,
|
|
98
|
-
InlineVastAsset,
|
|
99
|
-
Key_valueActivationKey,
|
|
100
105
|
ListAuthorizedPropertiesRequest,
|
|
101
106
|
ListAuthorizedPropertiesResponse,
|
|
102
107
|
ListCreativeFormatsRequest,
|
|
103
108
|
ListCreativeFormatsResponse,
|
|
104
109
|
ListCreativesRequest,
|
|
105
110
|
ListCreativesResponse,
|
|
106
|
-
Measurement,
|
|
107
|
-
# Core domain types
|
|
108
|
-
MediaBuy,
|
|
109
|
-
# Status enums
|
|
110
|
-
MediaBuyStatus,
|
|
111
|
-
# Sub-asset types
|
|
112
|
-
MediaSubAsset,
|
|
113
|
-
Pacing,
|
|
114
|
-
Package,
|
|
115
|
-
PackageStatus,
|
|
116
|
-
PerformanceFeedback,
|
|
117
|
-
Placement,
|
|
118
|
-
PlatformDeployment,
|
|
119
|
-
PlatformDestination,
|
|
120
111
|
PreviewCreativeRequest,
|
|
121
112
|
PreviewCreativeResponse,
|
|
122
|
-
# Preview render types
|
|
123
|
-
PreviewRender,
|
|
124
|
-
PricingModel,
|
|
125
|
-
# Pricing types
|
|
126
|
-
PricingOption,
|
|
127
113
|
Product,
|
|
128
|
-
PromotedProducts,
|
|
129
|
-
# Property and placement types
|
|
130
114
|
Property,
|
|
131
|
-
ProtocolEnvelope,
|
|
132
115
|
ProvidePerformanceFeedbackRequest,
|
|
133
116
|
ProvidePerformanceFeedbackResponse,
|
|
134
|
-
PushNotificationConfig,
|
|
135
|
-
ReportingCapabilities,
|
|
136
|
-
Response,
|
|
137
|
-
Segment_idActivationKey,
|
|
138
|
-
StandardFormatIds,
|
|
139
|
-
StartTiming,
|
|
140
|
-
SubAsset,
|
|
141
|
-
SyncCreativesError,
|
|
142
117
|
SyncCreativesRequest,
|
|
143
118
|
SyncCreativesResponse,
|
|
144
|
-
SyncCreativesSuccess,
|
|
145
|
-
# Targeting types
|
|
146
|
-
Targeting,
|
|
147
|
-
# Task types
|
|
148
|
-
TaskType,
|
|
149
|
-
TextSubAsset,
|
|
150
|
-
UpdateMediaBuyError,
|
|
151
119
|
UpdateMediaBuyRequest,
|
|
152
120
|
UpdateMediaBuyResponse,
|
|
153
|
-
UpdateMediaBuySuccess,
|
|
154
|
-
UrlDaastAsset,
|
|
155
|
-
UrlPreviewRender,
|
|
156
|
-
UrlVastAsset,
|
|
157
|
-
# Asset delivery types (VAST/DAAST)
|
|
158
|
-
VastAsset,
|
|
159
|
-
# Protocol types
|
|
160
|
-
WebhookPayload,
|
|
161
121
|
)
|
|
162
|
-
from adcp.types.generated import
|
|
163
|
-
|
|
122
|
+
from adcp.types.generated import TaskStatus as GeneratedTaskStatus
|
|
123
|
+
from adcp.validation import (
|
|
124
|
+
ValidationError,
|
|
125
|
+
validate_adagents,
|
|
126
|
+
validate_agent_authorization,
|
|
127
|
+
validate_product,
|
|
128
|
+
validate_publisher_properties_item,
|
|
164
129
|
)
|
|
165
130
|
|
|
166
|
-
__version__ = "1.
|
|
131
|
+
__version__ = "2.1.0"
|
|
167
132
|
|
|
168
133
|
__all__ = [
|
|
169
134
|
# Client classes
|
|
@@ -175,6 +140,37 @@ __all__ = [
|
|
|
175
140
|
"TaskResult",
|
|
176
141
|
"TaskStatus",
|
|
177
142
|
"WebhookMetadata",
|
|
143
|
+
# Common request/response types (re-exported for convenience)
|
|
144
|
+
"CreateMediaBuyRequest",
|
|
145
|
+
"CreateMediaBuyResponse",
|
|
146
|
+
"GetMediaBuyDeliveryRequest",
|
|
147
|
+
"GetMediaBuyDeliveryResponse",
|
|
148
|
+
"GetProductsRequest",
|
|
149
|
+
"GetProductsResponse",
|
|
150
|
+
"UpdateMediaBuyRequest",
|
|
151
|
+
"UpdateMediaBuyResponse",
|
|
152
|
+
"BuildCreativeRequest",
|
|
153
|
+
"BuildCreativeResponse",
|
|
154
|
+
"ListCreativeFormatsRequest",
|
|
155
|
+
"ListCreativeFormatsResponse",
|
|
156
|
+
"ListCreativesRequest",
|
|
157
|
+
"ListCreativesResponse",
|
|
158
|
+
"PreviewCreativeRequest",
|
|
159
|
+
"PreviewCreativeResponse",
|
|
160
|
+
"SyncCreativesRequest",
|
|
161
|
+
"SyncCreativesResponse",
|
|
162
|
+
"ActivateSignalRequest",
|
|
163
|
+
"ActivateSignalResponse",
|
|
164
|
+
"GetSignalsRequest",
|
|
165
|
+
"GetSignalsResponse",
|
|
166
|
+
"ListAuthorizedPropertiesRequest",
|
|
167
|
+
"ListAuthorizedPropertiesResponse",
|
|
168
|
+
"ProvidePerformanceFeedbackRequest",
|
|
169
|
+
"ProvidePerformanceFeedbackResponse",
|
|
170
|
+
"Error",
|
|
171
|
+
"Format",
|
|
172
|
+
"Product",
|
|
173
|
+
"Property",
|
|
178
174
|
# Adagents validation
|
|
179
175
|
"fetch_adagents",
|
|
180
176
|
"verify_agent_authorization",
|
|
@@ -210,113 +206,38 @@ __all__ = [
|
|
|
210
206
|
"AdagentsValidationError",
|
|
211
207
|
"AdagentsNotFoundError",
|
|
212
208
|
"AdagentsTimeoutError",
|
|
213
|
-
#
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
|
|
220
|
-
"
|
|
221
|
-
"
|
|
222
|
-
"BuildCreativeResponse",
|
|
223
|
-
"CreateMediaBuyRequest",
|
|
224
|
-
"CreateMediaBuyResponse",
|
|
225
|
-
"CreateMediaBuySuccess",
|
|
226
|
-
"CreateMediaBuyError",
|
|
227
|
-
"GetMediaBuyDeliveryRequest",
|
|
228
|
-
"GetMediaBuyDeliveryResponse",
|
|
229
|
-
"GetProductsRequest",
|
|
230
|
-
"GetProductsResponse",
|
|
231
|
-
"GetSignalsRequest",
|
|
232
|
-
"GetSignalsResponse",
|
|
233
|
-
"ListAuthorizedPropertiesRequest",
|
|
234
|
-
"ListAuthorizedPropertiesResponse",
|
|
235
|
-
"ListCreativeFormatsRequest",
|
|
236
|
-
"ListCreativeFormatsResponse",
|
|
237
|
-
"ListCreativesRequest",
|
|
238
|
-
"ListCreativesResponse",
|
|
239
|
-
"PreviewCreativeRequest",
|
|
240
|
-
"PreviewCreativeResponse",
|
|
241
|
-
"ProvidePerformanceFeedbackRequest",
|
|
242
|
-
"ProvidePerformanceFeedbackResponse",
|
|
243
|
-
"SyncCreativesRequest",
|
|
244
|
-
"SyncCreativesResponse",
|
|
245
|
-
"SyncCreativesSuccess",
|
|
246
|
-
"SyncCreativesError",
|
|
247
|
-
"UpdateMediaBuyRequest",
|
|
248
|
-
"UpdateMediaBuyResponse",
|
|
249
|
-
"UpdateMediaBuySuccess",
|
|
250
|
-
"UpdateMediaBuyError",
|
|
251
|
-
# Core domain types
|
|
252
|
-
"MediaBuy",
|
|
253
|
-
"Product",
|
|
254
|
-
"Package",
|
|
255
|
-
"Error",
|
|
256
|
-
# Creative types
|
|
257
|
-
"CreativeAsset",
|
|
258
|
-
"CreativeManifest",
|
|
259
|
-
"CreativeAssignment",
|
|
260
|
-
"CreativePolicy",
|
|
261
|
-
"Format",
|
|
262
|
-
"FormatId",
|
|
263
|
-
# Property and placement types
|
|
264
|
-
"Property",
|
|
265
|
-
"Placement",
|
|
266
|
-
# Targeting types
|
|
267
|
-
"Targeting",
|
|
268
|
-
"FrequencyCap",
|
|
269
|
-
"Pacing",
|
|
270
|
-
# Brand types
|
|
271
|
-
"BrandManifest",
|
|
272
|
-
"BrandManifestRef",
|
|
273
|
-
# Metrics types
|
|
274
|
-
"DeliveryMetrics",
|
|
275
|
-
"Measurement",
|
|
276
|
-
"PerformanceFeedback",
|
|
277
|
-
# Status enums
|
|
278
|
-
"MediaBuyStatus",
|
|
279
|
-
"PackageStatus",
|
|
280
|
-
# Pricing types
|
|
281
|
-
"PricingOption",
|
|
282
|
-
"PricingModel",
|
|
283
|
-
# Delivery types
|
|
284
|
-
"DeliveryType",
|
|
285
|
-
"StartTiming",
|
|
286
|
-
# Channel types
|
|
287
|
-
"Channels",
|
|
288
|
-
"StandardFormatIds",
|
|
289
|
-
# Protocol types
|
|
290
|
-
"WebhookPayload",
|
|
291
|
-
"ProtocolEnvelope",
|
|
292
|
-
"Response",
|
|
293
|
-
"PromotedProducts",
|
|
294
|
-
"PushNotificationConfig",
|
|
295
|
-
"ReportingCapabilities",
|
|
296
|
-
# Deployment types
|
|
297
|
-
"Destination",
|
|
298
|
-
"Deployment",
|
|
299
|
-
"PlatformDestination",
|
|
300
|
-
"AgentDestination",
|
|
301
|
-
"PlatformDeployment",
|
|
302
|
-
"AgentDeployment",
|
|
303
|
-
# Sub-asset types
|
|
304
|
-
"MediaSubAsset",
|
|
305
|
-
"SubAsset",
|
|
306
|
-
"TextSubAsset",
|
|
307
|
-
# Asset delivery types (VAST/DAAST)
|
|
308
|
-
"VastAsset",
|
|
309
|
-
"UrlVastAsset",
|
|
310
|
-
"InlineVastAsset",
|
|
311
|
-
"DaastAsset",
|
|
312
|
-
"UrlDaastAsset",
|
|
313
|
-
"InlineDaastAsset",
|
|
314
|
-
# Preview render types
|
|
315
|
-
"PreviewRender",
|
|
316
|
-
"UrlPreviewRender",
|
|
317
|
-
"HtmlPreviewRender",
|
|
318
|
-
"BothPreviewRender",
|
|
319
|
-
# Task types
|
|
320
|
-
"TaskType",
|
|
209
|
+
# Validation utilities
|
|
210
|
+
"ValidationError",
|
|
211
|
+
"validate_adagents",
|
|
212
|
+
"validate_agent_authorization",
|
|
213
|
+
"validate_product",
|
|
214
|
+
"validate_publisher_properties_item",
|
|
215
|
+
# Generated types modules
|
|
216
|
+
"generated",
|
|
217
|
+
"aliases",
|
|
321
218
|
"GeneratedTaskStatus",
|
|
219
|
+
# Semantic type aliases (for better API ergonomics)
|
|
220
|
+
"ActivateSignalSuccessResponse",
|
|
221
|
+
"ActivateSignalErrorResponse",
|
|
222
|
+
"BuildCreativeSuccessResponse",
|
|
223
|
+
"BuildCreativeErrorResponse",
|
|
224
|
+
"CreateMediaBuySuccessResponse",
|
|
225
|
+
"CreateMediaBuyErrorResponse",
|
|
226
|
+
"ProvidePerformanceFeedbackSuccessResponse",
|
|
227
|
+
"ProvidePerformanceFeedbackErrorResponse",
|
|
228
|
+
"SyncCreativesSuccessResponse",
|
|
229
|
+
"SyncCreativesErrorResponse",
|
|
230
|
+
"UpdateMediaBuySuccessResponse",
|
|
231
|
+
"UpdateMediaBuyErrorResponse",
|
|
232
|
+
"PreviewCreativeFormatRequest",
|
|
233
|
+
"PreviewCreativeManifestRequest",
|
|
234
|
+
"PreviewCreativeStaticResponse",
|
|
235
|
+
"PreviewCreativeInteractiveResponse",
|
|
236
|
+
"PreviewRenderImage",
|
|
237
|
+
"PreviewRenderHtml",
|
|
238
|
+
"PreviewRenderIframe",
|
|
239
|
+
"PropertyIdActivationKey",
|
|
240
|
+
"PropertyTagActivationKey",
|
|
241
|
+
"UpdateMediaBuyPackagesRequest",
|
|
242
|
+
"UpdateMediaBuyPropertiesRequest",
|
|
322
243
|
]
|
adcp/adagents.py
CHANGED
|
@@ -14,6 +14,7 @@ from urllib.parse import urlparse
|
|
|
14
14
|
import httpx
|
|
15
15
|
|
|
16
16
|
from adcp.exceptions import AdagentsNotFoundError, AdagentsTimeoutError, AdagentsValidationError
|
|
17
|
+
from adcp.validation import ValidationError, validate_adagents
|
|
17
18
|
|
|
18
19
|
|
|
19
20
|
def _normalize_domain(domain: str) -> str:
|
|
@@ -56,9 +57,7 @@ def _validate_publisher_domain(domain: str) -> str:
|
|
|
56
57
|
suspicious_chars = ["\\", "@", "\n", "\r", "\t"]
|
|
57
58
|
for char in suspicious_chars:
|
|
58
59
|
if char in domain:
|
|
59
|
-
raise AdagentsValidationError(
|
|
60
|
-
f"Invalid character in publisher domain: {char!r}"
|
|
61
|
-
)
|
|
60
|
+
raise AdagentsValidationError(f"Invalid character in publisher domain: {char!r}")
|
|
62
61
|
|
|
63
62
|
domain = domain.strip()
|
|
64
63
|
|
|
@@ -70,9 +69,7 @@ def _validate_publisher_domain(domain: str) -> str:
|
|
|
70
69
|
|
|
71
70
|
# Check for spaces after stripping leading/trailing whitespace
|
|
72
71
|
if " " in domain:
|
|
73
|
-
raise AdagentsValidationError(
|
|
74
|
-
"Invalid character in publisher domain: ' '"
|
|
75
|
-
)
|
|
72
|
+
raise AdagentsValidationError("Invalid character in publisher domain: ' '")
|
|
76
73
|
|
|
77
74
|
# Remove protocol if present (common user error) - do this BEFORE checking for slashes
|
|
78
75
|
if "://" in domain:
|
|
@@ -87,9 +84,7 @@ def _validate_publisher_domain(domain: str) -> str:
|
|
|
87
84
|
|
|
88
85
|
# Final validation - must look like a domain
|
|
89
86
|
if "." not in domain:
|
|
90
|
-
raise AdagentsValidationError(
|
|
91
|
-
f"Publisher domain must contain at least one dot: {domain!r}"
|
|
92
|
-
)
|
|
87
|
+
raise AdagentsValidationError(f"Publisher domain must contain at least one dot: {domain!r}")
|
|
93
88
|
|
|
94
89
|
return domain
|
|
95
90
|
|
|
@@ -359,13 +354,17 @@ async def fetch_adagents(
|
|
|
359
354
|
raise AdagentsValidationError("adagents.json must be a JSON object")
|
|
360
355
|
|
|
361
356
|
if "authorized_agents" not in data:
|
|
362
|
-
raise AdagentsValidationError(
|
|
363
|
-
"adagents.json must have 'authorized_agents' field"
|
|
364
|
-
)
|
|
357
|
+
raise AdagentsValidationError("adagents.json must have 'authorized_agents' field")
|
|
365
358
|
|
|
366
359
|
if not isinstance(data["authorized_agents"], list):
|
|
367
360
|
raise AdagentsValidationError("'authorized_agents' must be an array")
|
|
368
361
|
|
|
362
|
+
# Validate mutual exclusivity constraints
|
|
363
|
+
try:
|
|
364
|
+
validate_adagents(data)
|
|
365
|
+
except ValidationError as e:
|
|
366
|
+
raise AdagentsValidationError(f"Invalid adagents.json structure: {e}") from e
|
|
367
|
+
|
|
369
368
|
return data
|
|
370
369
|
|
|
371
370
|
except httpx.TimeoutException as e:
|
adcp/client.py
CHANGED
|
@@ -23,6 +23,7 @@ from adcp.types.core import (
|
|
|
23
23
|
AgentConfig,
|
|
24
24
|
Protocol,
|
|
25
25
|
TaskResult,
|
|
26
|
+
TaskStatus,
|
|
26
27
|
)
|
|
27
28
|
from adcp.types.generated import (
|
|
28
29
|
ActivateSignalRequest,
|
|
@@ -47,6 +48,7 @@ from adcp.types.generated import (
|
|
|
47
48
|
SyncCreativesResponse,
|
|
48
49
|
WebhookPayload,
|
|
49
50
|
)
|
|
51
|
+
from adcp.types.generated_poc.task_status import TaskStatus as GeneratedTaskStatus
|
|
50
52
|
from adcp.utils.operation_id import create_operation_id
|
|
51
53
|
|
|
52
54
|
logger = logging.getLogger(__name__)
|
|
@@ -624,7 +626,6 @@ class ADCPClient:
|
|
|
624
626
|
Returns:
|
|
625
627
|
TaskResult with task-specific typed response data
|
|
626
628
|
"""
|
|
627
|
-
from adcp.types.core import TaskStatus
|
|
628
629
|
from adcp.utils.response_parser import parse_json_or_text
|
|
629
630
|
|
|
630
631
|
# Map task types to their response types (using string literals, not enum)
|
|
@@ -643,8 +644,8 @@ class ADCPClient:
|
|
|
643
644
|
|
|
644
645
|
# Handle completed tasks with result parsing
|
|
645
646
|
|
|
646
|
-
if webhook.status ==
|
|
647
|
-
response_type = response_type_map.get(webhook.task_type)
|
|
647
|
+
if webhook.status == GeneratedTaskStatus.completed and webhook.result is not None:
|
|
648
|
+
response_type = response_type_map.get(webhook.task_type.value)
|
|
648
649
|
if response_type:
|
|
649
650
|
try:
|
|
650
651
|
parsed_result: Any = parse_json_or_text(webhook.result, response_type)
|
|
@@ -664,17 +665,21 @@ class ADCPClient:
|
|
|
664
665
|
# Fall through to untyped result
|
|
665
666
|
|
|
666
667
|
# Handle failed, input-required, or unparseable results
|
|
667
|
-
# Convert webhook status
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
668
|
+
# Convert webhook status to core TaskStatus enum
|
|
669
|
+
# Map generated enum values to core enum values
|
|
670
|
+
status_map = {
|
|
671
|
+
GeneratedTaskStatus.completed: TaskStatus.COMPLETED,
|
|
672
|
+
GeneratedTaskStatus.submitted: TaskStatus.SUBMITTED,
|
|
673
|
+
GeneratedTaskStatus.working: TaskStatus.WORKING,
|
|
674
|
+
GeneratedTaskStatus.failed: TaskStatus.FAILED,
|
|
675
|
+
GeneratedTaskStatus.input_required: TaskStatus.NEEDS_INPUT,
|
|
676
|
+
}
|
|
677
|
+
task_status = status_map.get(webhook.status, TaskStatus.FAILED)
|
|
673
678
|
|
|
674
679
|
return TaskResult[Any](
|
|
675
680
|
status=task_status,
|
|
676
681
|
data=webhook.result,
|
|
677
|
-
success=webhook.status ==
|
|
682
|
+
success=webhook.status == GeneratedTaskStatus.completed,
|
|
678
683
|
error=webhook.error if isinstance(webhook.error, str) else None,
|
|
679
684
|
metadata={
|
|
680
685
|
"task_id": webhook.task_id,
|
|
@@ -732,7 +737,7 @@ class ADCPClient:
|
|
|
732
737
|
type=ActivityType.WEBHOOK_RECEIVED,
|
|
733
738
|
operation_id=webhook.operation_id or "unknown",
|
|
734
739
|
agent_id=self.agent_config.id,
|
|
735
|
-
task_type=webhook.task_type,
|
|
740
|
+
task_type=webhook.task_type.value,
|
|
736
741
|
timestamp=datetime.now(timezone.utc).isoformat(),
|
|
737
742
|
metadata={"payload": payload},
|
|
738
743
|
)
|
adcp/py.typed
ADDED
|
File without changes
|
adcp/types/aliases.py
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"""Semantic type aliases for generated AdCP types.
|
|
2
|
+
|
|
3
|
+
This module provides user-friendly aliases for generated types where the
|
|
4
|
+
auto-generated names don't match user expectations from reading the spec.
|
|
5
|
+
|
|
6
|
+
The code generator (datamodel-code-generator) creates numbered suffixes for
|
|
7
|
+
discriminated union variants (e.g., Response1, Response2), but users expect
|
|
8
|
+
semantic names (e.g., SuccessResponse, ErrorResponse).
|
|
9
|
+
|
|
10
|
+
Categories of aliases:
|
|
11
|
+
|
|
12
|
+
1. Discriminated Union Response Variants
|
|
13
|
+
- Success/Error cases for API responses
|
|
14
|
+
- Named to match the semantic meaning from the spec
|
|
15
|
+
|
|
16
|
+
2. Preview/Render Types
|
|
17
|
+
- Input/Output/Request/Response variants
|
|
18
|
+
- Numbered types mapped to their semantic purpose
|
|
19
|
+
|
|
20
|
+
3. Activation Keys
|
|
21
|
+
- Signal activation key variants
|
|
22
|
+
|
|
23
|
+
DO NOT EDIT the generated types directly - they are regenerated from schemas.
|
|
24
|
+
Add aliases here for any types where the generated name is unclear.
|
|
25
|
+
|
|
26
|
+
Validation:
|
|
27
|
+
This module will raise ImportError at import time if any of the referenced
|
|
28
|
+
generated types do not exist. This ensures that schema changes are caught
|
|
29
|
+
immediately rather than at runtime when users try to use the aliases.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
from __future__ import annotations
|
|
33
|
+
|
|
34
|
+
# Import all generated types that need semantic aliases
|
|
35
|
+
from adcp.types.generated import (
|
|
36
|
+
# Activation responses
|
|
37
|
+
ActivateSignalResponse1,
|
|
38
|
+
ActivateSignalResponse2,
|
|
39
|
+
# Activation keys
|
|
40
|
+
ActivationKey1,
|
|
41
|
+
ActivationKey2,
|
|
42
|
+
# Build creative responses
|
|
43
|
+
BuildCreativeResponse1,
|
|
44
|
+
BuildCreativeResponse2,
|
|
45
|
+
# Create media buy responses
|
|
46
|
+
CreateMediaBuyResponse1,
|
|
47
|
+
CreateMediaBuyResponse2,
|
|
48
|
+
# Preview creative requests
|
|
49
|
+
PreviewCreativeRequest1,
|
|
50
|
+
PreviewCreativeRequest2,
|
|
51
|
+
# Preview creative responses
|
|
52
|
+
PreviewCreativeResponse1,
|
|
53
|
+
PreviewCreativeResponse2,
|
|
54
|
+
# Preview renders
|
|
55
|
+
PreviewRender1,
|
|
56
|
+
PreviewRender2,
|
|
57
|
+
PreviewRender3,
|
|
58
|
+
# Performance feedback responses
|
|
59
|
+
ProvidePerformanceFeedbackResponse1,
|
|
60
|
+
ProvidePerformanceFeedbackResponse2,
|
|
61
|
+
# Sync creatives responses
|
|
62
|
+
SyncCreativesResponse1,
|
|
63
|
+
SyncCreativesResponse2,
|
|
64
|
+
# Update media buy requests
|
|
65
|
+
UpdateMediaBuyRequest1,
|
|
66
|
+
UpdateMediaBuyRequest2,
|
|
67
|
+
# Update media buy responses
|
|
68
|
+
UpdateMediaBuyResponse1,
|
|
69
|
+
UpdateMediaBuyResponse2,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
# ============================================================================
|
|
73
|
+
# RESPONSE TYPE ALIASES - Success/Error Discriminated Unions
|
|
74
|
+
# ============================================================================
|
|
75
|
+
# These are atomic operations where the response is EITHER success OR error,
|
|
76
|
+
# never both. The numbered suffixes from the generator don't convey this
|
|
77
|
+
# critical semantic distinction.
|
|
78
|
+
|
|
79
|
+
# Activate Signal Response Variants
|
|
80
|
+
ActivateSignalSuccessResponse = ActivateSignalResponse1
|
|
81
|
+
"""Success response - signal activation succeeded."""
|
|
82
|
+
|
|
83
|
+
ActivateSignalErrorResponse = ActivateSignalResponse2
|
|
84
|
+
"""Error response - signal activation failed."""
|
|
85
|
+
|
|
86
|
+
# Build Creative Response Variants
|
|
87
|
+
BuildCreativeSuccessResponse = BuildCreativeResponse1
|
|
88
|
+
"""Success response - creative built successfully, manifest returned."""
|
|
89
|
+
|
|
90
|
+
BuildCreativeErrorResponse = BuildCreativeResponse2
|
|
91
|
+
"""Error response - creative build failed, no manifest created."""
|
|
92
|
+
|
|
93
|
+
# Create Media Buy Response Variants
|
|
94
|
+
CreateMediaBuySuccessResponse = CreateMediaBuyResponse1
|
|
95
|
+
"""Success response - media buy created successfully with media_buy_id."""
|
|
96
|
+
|
|
97
|
+
CreateMediaBuyErrorResponse = CreateMediaBuyResponse2
|
|
98
|
+
"""Error response - media buy creation failed, no media buy created."""
|
|
99
|
+
|
|
100
|
+
# Performance Feedback Response Variants
|
|
101
|
+
ProvidePerformanceFeedbackSuccessResponse = ProvidePerformanceFeedbackResponse1
|
|
102
|
+
"""Success response - performance feedback accepted."""
|
|
103
|
+
|
|
104
|
+
ProvidePerformanceFeedbackErrorResponse = ProvidePerformanceFeedbackResponse2
|
|
105
|
+
"""Error response - performance feedback rejected."""
|
|
106
|
+
|
|
107
|
+
# Sync Creatives Response Variants
|
|
108
|
+
SyncCreativesSuccessResponse = SyncCreativesResponse1
|
|
109
|
+
"""Success response - sync operation processed creatives."""
|
|
110
|
+
|
|
111
|
+
SyncCreativesErrorResponse = SyncCreativesResponse2
|
|
112
|
+
"""Error response - sync operation failed."""
|
|
113
|
+
|
|
114
|
+
# Update Media Buy Response Variants
|
|
115
|
+
UpdateMediaBuySuccessResponse = UpdateMediaBuyResponse1
|
|
116
|
+
"""Success response - media buy updated successfully."""
|
|
117
|
+
|
|
118
|
+
UpdateMediaBuyErrorResponse = UpdateMediaBuyResponse2
|
|
119
|
+
"""Error response - media buy update failed, no changes applied."""
|
|
120
|
+
|
|
121
|
+
# ============================================================================
|
|
122
|
+
# REQUEST TYPE ALIASES - Operation Variants
|
|
123
|
+
# ============================================================================
|
|
124
|
+
|
|
125
|
+
# Preview Creative Request Variants
|
|
126
|
+
PreviewCreativeFormatRequest = PreviewCreativeRequest1
|
|
127
|
+
"""Preview request using format_id to identify creative format."""
|
|
128
|
+
|
|
129
|
+
PreviewCreativeManifestRequest = PreviewCreativeRequest2
|
|
130
|
+
"""Preview request using creative_manifest_url to identify creative."""
|
|
131
|
+
|
|
132
|
+
# Update Media Buy Request Variants
|
|
133
|
+
UpdateMediaBuyPackagesRequest = UpdateMediaBuyRequest1
|
|
134
|
+
"""Update request modifying packages in the media buy."""
|
|
135
|
+
|
|
136
|
+
UpdateMediaBuyPropertiesRequest = UpdateMediaBuyRequest2
|
|
137
|
+
"""Update request modifying media buy properties (not packages)."""
|
|
138
|
+
|
|
139
|
+
# ============================================================================
|
|
140
|
+
# ACTIVATION KEY ALIASES
|
|
141
|
+
# ============================================================================
|
|
142
|
+
|
|
143
|
+
PropertyIdActivationKey = ActivationKey1
|
|
144
|
+
"""Activation key using property_id for identification."""
|
|
145
|
+
|
|
146
|
+
PropertyTagActivationKey = ActivationKey2
|
|
147
|
+
"""Activation key using property_tags for identification."""
|
|
148
|
+
|
|
149
|
+
# ============================================================================
|
|
150
|
+
# PREVIEW/RENDER TYPE ALIASES
|
|
151
|
+
# ============================================================================
|
|
152
|
+
|
|
153
|
+
# Preview Creative Response Variants
|
|
154
|
+
PreviewCreativeStaticResponse = PreviewCreativeResponse1
|
|
155
|
+
"""Preview response with static renders (image/HTML snapshots)."""
|
|
156
|
+
|
|
157
|
+
PreviewCreativeInteractiveResponse = PreviewCreativeResponse2
|
|
158
|
+
"""Preview response with interactive renders (iframe embedding)."""
|
|
159
|
+
|
|
160
|
+
# Preview Render Variants
|
|
161
|
+
PreviewRenderImage = PreviewRender1
|
|
162
|
+
"""Image-based preview render (PNG/JPEG)."""
|
|
163
|
+
|
|
164
|
+
PreviewRenderHtml = PreviewRender2
|
|
165
|
+
"""HTML-based preview render (static markup)."""
|
|
166
|
+
|
|
167
|
+
PreviewRenderIframe = PreviewRender3
|
|
168
|
+
"""Interactive iframe-based preview render."""
|
|
169
|
+
|
|
170
|
+
# ============================================================================
|
|
171
|
+
# EXPORTS
|
|
172
|
+
# ============================================================================
|
|
173
|
+
|
|
174
|
+
__all__ = [
|
|
175
|
+
# Activation responses
|
|
176
|
+
"ActivateSignalSuccessResponse",
|
|
177
|
+
"ActivateSignalErrorResponse",
|
|
178
|
+
# Activation keys
|
|
179
|
+
"PropertyIdActivationKey",
|
|
180
|
+
"PropertyTagActivationKey",
|
|
181
|
+
# Build creative responses
|
|
182
|
+
"BuildCreativeSuccessResponse",
|
|
183
|
+
"BuildCreativeErrorResponse",
|
|
184
|
+
# Create media buy responses
|
|
185
|
+
"CreateMediaBuySuccessResponse",
|
|
186
|
+
"CreateMediaBuyErrorResponse",
|
|
187
|
+
# Performance feedback responses
|
|
188
|
+
"ProvidePerformanceFeedbackSuccessResponse",
|
|
189
|
+
"ProvidePerformanceFeedbackErrorResponse",
|
|
190
|
+
# Preview creative requests
|
|
191
|
+
"PreviewCreativeFormatRequest",
|
|
192
|
+
"PreviewCreativeManifestRequest",
|
|
193
|
+
# Preview creative responses
|
|
194
|
+
"PreviewCreativeStaticResponse",
|
|
195
|
+
"PreviewCreativeInteractiveResponse",
|
|
196
|
+
# Preview renders
|
|
197
|
+
"PreviewRenderImage",
|
|
198
|
+
"PreviewRenderHtml",
|
|
199
|
+
"PreviewRenderIframe",
|
|
200
|
+
# Sync creatives responses
|
|
201
|
+
"SyncCreativesSuccessResponse",
|
|
202
|
+
"SyncCreativesErrorResponse",
|
|
203
|
+
# Update media buy requests
|
|
204
|
+
"UpdateMediaBuyPackagesRequest",
|
|
205
|
+
"UpdateMediaBuyPropertiesRequest",
|
|
206
|
+
# Update media buy responses
|
|
207
|
+
"UpdateMediaBuySuccessResponse",
|
|
208
|
+
"UpdateMediaBuyErrorResponse",
|
|
209
|
+
]
|