adcp 2.4.0__py3-none-any.whl → 2.4.1__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 +88 -39
- adcp/__main__.py +1 -1
- adcp/client.py +9 -9
- adcp/simple.py +1 -1
- adcp/testing/test_helpers.py +1 -1
- adcp/types/__init__.py +66 -2
- adcp/types/{generated.py → _generated.py} +67 -11
- adcp/types/aliases.py +1 -1
- adcp/types/generated_poc/__init__.py +1 -1
- adcp/types/generated_poc/activate_signal_request.py +1 -1
- adcp/types/generated_poc/activate_signal_response.py +1 -1
- adcp/types/generated_poc/activation_key.py +1 -1
- adcp/types/generated_poc/adagents.py +1 -1
- adcp/types/generated_poc/asset_type.py +1 -1
- adcp/types/generated_poc/audio_asset.py +1 -1
- adcp/types/generated_poc/brand_manifest.py +3 -62
- adcp/types/generated_poc/build_creative_request.py +1 -1
- adcp/types/generated_poc/build_creative_response.py +1 -1
- adcp/types/generated_poc/channels.py +1 -1
- adcp/types/generated_poc/cpc_option.py +1 -1
- adcp/types/generated_poc/cpcv_option.py +1 -1
- adcp/types/generated_poc/cpm_auction_option.py +1 -1
- adcp/types/generated_poc/cpm_fixed_option.py +1 -1
- adcp/types/generated_poc/cpp_option.py +1 -1
- adcp/types/generated_poc/cpv_option.py +1 -1
- adcp/types/generated_poc/create_media_buy_request.py +2 -2
- adcp/types/generated_poc/create_media_buy_response.py +1 -1
- adcp/types/generated_poc/creative_asset.py +1 -1
- adcp/types/generated_poc/creative_assignment.py +1 -1
- adcp/types/generated_poc/creative_manifest.py +1 -1
- adcp/types/generated_poc/creative_policy.py +1 -1
- adcp/types/generated_poc/creative_status.py +1 -1
- adcp/types/generated_poc/css_asset.py +1 -1
- adcp/types/generated_poc/daast_asset.py +1 -1
- adcp/types/generated_poc/delivery_metrics.py +1 -1
- adcp/types/generated_poc/delivery_type.py +1 -1
- adcp/types/generated_poc/deployment.py +1 -1
- adcp/types/generated_poc/destination.py +1 -1
- adcp/types/generated_poc/error.py +1 -1
- adcp/types/generated_poc/flat_rate_option.py +1 -1
- adcp/types/generated_poc/format.py +1 -1
- adcp/types/generated_poc/format_id.py +1 -1
- adcp/types/generated_poc/frequency_cap.py +1 -1
- adcp/types/generated_poc/frequency_cap_scope.py +1 -1
- adcp/types/generated_poc/get_media_buy_delivery_request.py +1 -1
- adcp/types/generated_poc/get_media_buy_delivery_response.py +1 -1
- adcp/types/generated_poc/get_products_request.py +2 -2
- adcp/types/generated_poc/get_products_response.py +1 -1
- adcp/types/generated_poc/get_signals_request.py +1 -1
- adcp/types/generated_poc/get_signals_response.py +1 -1
- adcp/types/generated_poc/html_asset.py +1 -1
- adcp/types/generated_poc/identifier_types.py +1 -1
- adcp/types/generated_poc/image_asset.py +1 -1
- adcp/types/generated_poc/javascript_asset.py +1 -1
- adcp/types/generated_poc/list_authorized_properties_request.py +1 -1
- adcp/types/generated_poc/list_authorized_properties_response.py +1 -1
- adcp/types/generated_poc/list_creative_formats_request.py +1 -1
- adcp/types/generated_poc/list_creative_formats_response.py +1 -1
- adcp/types/generated_poc/list_creatives_request.py +1 -1
- adcp/types/generated_poc/list_creatives_response.py +2 -17
- adcp/types/generated_poc/markdown_asset.py +1 -1
- adcp/types/generated_poc/measurement.py +1 -1
- adcp/types/generated_poc/media_buy.py +1 -1
- adcp/types/generated_poc/media_buy_status.py +1 -1
- adcp/types/generated_poc/pacing.py +1 -1
- adcp/types/generated_poc/package.py +1 -1
- adcp/types/generated_poc/package_request.py +1 -1
- adcp/types/generated_poc/package_status.py +1 -1
- adcp/types/generated_poc/performance_feedback.py +1 -1
- adcp/types/generated_poc/placement.py +1 -1
- adcp/types/generated_poc/preview_creative_request.py +1 -1
- adcp/types/generated_poc/preview_creative_response.py +1 -1
- adcp/types/generated_poc/preview_render.py +1 -1
- adcp/types/generated_poc/pricing_model.py +1 -1
- adcp/types/generated_poc/product.py +25 -16
- adcp/types/generated_poc/promoted_offerings.py +2 -2
- adcp/types/generated_poc/promoted_products.py +1 -1
- adcp/types/generated_poc/property.py +1 -1
- adcp/types/generated_poc/protocol_envelope.py +1 -1
- adcp/types/generated_poc/provide_performance_feedback_request.py +1 -1
- adcp/types/generated_poc/provide_performance_feedback_response.py +1 -1
- adcp/types/generated_poc/publisher_identifier_types.py +1 -1
- adcp/types/generated_poc/push_notification_config.py +1 -1
- adcp/types/generated_poc/reporting_capabilities.py +1 -1
- adcp/types/generated_poc/response.py +1 -1
- adcp/types/generated_poc/standard_format_ids.py +1 -1
- adcp/types/generated_poc/sub_asset.py +1 -1
- adcp/types/generated_poc/sync_creatives_request.py +1 -1
- adcp/types/generated_poc/sync_creatives_response.py +1 -1
- adcp/types/generated_poc/targeting.py +1 -1
- adcp/types/generated_poc/task_status.py +1 -1
- adcp/types/generated_poc/task_type.py +1 -1
- adcp/types/generated_poc/tasks_get_request.py +1 -1
- adcp/types/generated_poc/tasks_get_response.py +1 -1
- adcp/types/generated_poc/tasks_list_request.py +1 -1
- adcp/types/generated_poc/tasks_list_response.py +1 -1
- adcp/types/generated_poc/text_asset.py +1 -1
- adcp/types/generated_poc/update_media_buy_request.py +1 -1
- adcp/types/generated_poc/update_media_buy_response.py +1 -1
- adcp/types/generated_poc/url_asset.py +1 -1
- adcp/types/generated_poc/vast_asset.py +1 -1
- adcp/types/generated_poc/vcpm_auction_option.py +1 -1
- adcp/types/generated_poc/vcpm_fixed_option.py +1 -1
- adcp/types/generated_poc/video_asset.py +1 -1
- adcp/types/generated_poc/webhook_asset.py +1 -1
- adcp/types/generated_poc/webhook_payload.py +1 -1
- adcp/types/stable.py +175 -0
- adcp/utils/preview_cache.py +6 -6
- {adcp-2.4.0.dist-info → adcp-2.4.1.dist-info}/METADATA +29 -4
- adcp-2.4.1.dist-info/RECORD +129 -0
- adcp/types/generated_poc/brand_manifest_ref.py +0 -361
- adcp/types/generated_poc/index.py +0 -17
- adcp/types/generated_poc/pricing_option.py +0 -365
- adcp/types/generated_poc/start_timing.py +0 -13
- adcp-2.4.0.dist-info/RECORD +0 -132
- {adcp-2.4.0.dist-info → adcp-2.4.1.dist-info}/WHEEL +0 -0
- {adcp-2.4.0.dist-info → adcp-2.4.1.dist-info}/entry_points.txt +0 -0
- {adcp-2.4.0.dist-info → adcp-2.4.1.dist-info}/licenses/LICENSE +0 -0
- {adcp-2.4.0.dist-info → adcp-2.4.1.dist-info}/top_level.txt +0 -0
adcp/types/stable.py
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""Stable public API for AdCP types.
|
|
2
|
+
|
|
3
|
+
This module provides a stable, versioned API that shields users from internal
|
|
4
|
+
implementation details and schema evolution. All types exported here are
|
|
5
|
+
guaranteed to be stable within a major version.
|
|
6
|
+
|
|
7
|
+
Internal Implementation:
|
|
8
|
+
- Types are generated from JSON schemas into adcp.types.generated_poc
|
|
9
|
+
- The generator may create numbered variants (e.g., BrandManifest1, BrandManifest2)
|
|
10
|
+
when schema evolution creates multiple valid structures
|
|
11
|
+
- This module provides clean, unnumbered aliases pointing to the canonical version
|
|
12
|
+
|
|
13
|
+
**IMPORTANT**: Never import directly from adcp.types.generated_poc or adcp.types.generated.
|
|
14
|
+
Always import from adcp.types or adcp.types.stable.
|
|
15
|
+
|
|
16
|
+
Schema Evolution:
|
|
17
|
+
- When schemas change, we update the alias targets here
|
|
18
|
+
- Users see stable names (BrandManifest, Product, etc.)
|
|
19
|
+
- Breaking changes require major version bumps
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
# Import all generated types from internal consolidated module
|
|
25
|
+
from adcp.types._generated import (
|
|
26
|
+
# Core request/response types
|
|
27
|
+
ActivateSignalRequest,
|
|
28
|
+
ActivateSignalResponse,
|
|
29
|
+
# Assets
|
|
30
|
+
AudioAsset,
|
|
31
|
+
# Core domain types
|
|
32
|
+
BrandManifest, # Clean single type after upstream schema fix
|
|
33
|
+
BuildCreativeRequest,
|
|
34
|
+
BuildCreativeResponse,
|
|
35
|
+
# Pricing options
|
|
36
|
+
CpcPricingOption,
|
|
37
|
+
CpcvPricingOption,
|
|
38
|
+
CpmAuctionPricingOption,
|
|
39
|
+
CpmFixedRatePricingOption,
|
|
40
|
+
CppPricingOption,
|
|
41
|
+
CpvPricingOption,
|
|
42
|
+
CreateMediaBuyRequest,
|
|
43
|
+
CreateMediaBuyResponse,
|
|
44
|
+
Creative,
|
|
45
|
+
CreativeManifest,
|
|
46
|
+
# Enums and constants
|
|
47
|
+
CreativeStatus,
|
|
48
|
+
CssAsset,
|
|
49
|
+
Error,
|
|
50
|
+
FlatRatePricingOption,
|
|
51
|
+
Format,
|
|
52
|
+
GetMediaBuyDeliveryRequest,
|
|
53
|
+
GetMediaBuyDeliveryResponse,
|
|
54
|
+
GetProductsRequest,
|
|
55
|
+
GetProductsResponse,
|
|
56
|
+
GetSignalsRequest,
|
|
57
|
+
GetSignalsResponse,
|
|
58
|
+
HtmlAsset,
|
|
59
|
+
ImageAsset,
|
|
60
|
+
JavascriptAsset,
|
|
61
|
+
ListAuthorizedPropertiesRequest,
|
|
62
|
+
ListAuthorizedPropertiesResponse,
|
|
63
|
+
ListCreativeFormatsRequest,
|
|
64
|
+
ListCreativeFormatsResponse,
|
|
65
|
+
ListCreativesRequest,
|
|
66
|
+
ListCreativesResponse,
|
|
67
|
+
MarkdownAsset,
|
|
68
|
+
MediaBuy,
|
|
69
|
+
MediaBuyStatus,
|
|
70
|
+
Package,
|
|
71
|
+
PackageStatus,
|
|
72
|
+
PreviewCreativeRequest,
|
|
73
|
+
PreviewCreativeResponse,
|
|
74
|
+
PricingModel,
|
|
75
|
+
Product,
|
|
76
|
+
Property,
|
|
77
|
+
ProvidePerformanceFeedbackRequest,
|
|
78
|
+
ProvidePerformanceFeedbackResponse,
|
|
79
|
+
SyncCreativesRequest,
|
|
80
|
+
SyncCreativesResponse,
|
|
81
|
+
TasksGetRequest,
|
|
82
|
+
TasksGetResponse,
|
|
83
|
+
TasksListRequest,
|
|
84
|
+
TasksListResponse,
|
|
85
|
+
TaskStatus,
|
|
86
|
+
TaskType,
|
|
87
|
+
TextAsset,
|
|
88
|
+
UpdateMediaBuyRequest,
|
|
89
|
+
UpdateMediaBuyResponse,
|
|
90
|
+
UrlAsset,
|
|
91
|
+
VcpmAuctionPricingOption,
|
|
92
|
+
VcpmFixedRatePricingOption,
|
|
93
|
+
VideoAsset,
|
|
94
|
+
WebhookAsset,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Note: BrandManifest is currently split into BrandManifest1/2 due to upstream schema
|
|
98
|
+
# using anyOf incorrectly. This will be fixed upstream to create a single BrandManifest type.
|
|
99
|
+
# For now, users should use BrandManifest1 (url required) which is most common.
|
|
100
|
+
|
|
101
|
+
# Note: BrandManifest is now a single clean type
|
|
102
|
+
# Re-export BrandManifest directly (no alias needed)
|
|
103
|
+
|
|
104
|
+
# Re-export all stable types
|
|
105
|
+
__all__ = [
|
|
106
|
+
# Request/Response types
|
|
107
|
+
"ActivateSignalRequest",
|
|
108
|
+
"ActivateSignalResponse",
|
|
109
|
+
"BuildCreativeRequest",
|
|
110
|
+
"BuildCreativeResponse",
|
|
111
|
+
"CreateMediaBuyRequest",
|
|
112
|
+
"CreateMediaBuyResponse",
|
|
113
|
+
"GetMediaBuyDeliveryRequest",
|
|
114
|
+
"GetMediaBuyDeliveryResponse",
|
|
115
|
+
"GetProductsRequest",
|
|
116
|
+
"GetProductsResponse",
|
|
117
|
+
"GetSignalsRequest",
|
|
118
|
+
"GetSignalsResponse",
|
|
119
|
+
"ListAuthorizedPropertiesRequest",
|
|
120
|
+
"ListAuthorizedPropertiesResponse",
|
|
121
|
+
"ListCreativeFormatsRequest",
|
|
122
|
+
"ListCreativeFormatsResponse",
|
|
123
|
+
"ListCreativesRequest",
|
|
124
|
+
"ListCreativesResponse",
|
|
125
|
+
"PreviewCreativeRequest",
|
|
126
|
+
"PreviewCreativeResponse",
|
|
127
|
+
"ProvidePerformanceFeedbackRequest",
|
|
128
|
+
"ProvidePerformanceFeedbackResponse",
|
|
129
|
+
"SyncCreativesRequest",
|
|
130
|
+
"SyncCreativesResponse",
|
|
131
|
+
"TasksGetRequest",
|
|
132
|
+
"TasksGetResponse",
|
|
133
|
+
"TasksListRequest",
|
|
134
|
+
"TasksListResponse",
|
|
135
|
+
"UpdateMediaBuyRequest",
|
|
136
|
+
"UpdateMediaBuyResponse",
|
|
137
|
+
# Domain types
|
|
138
|
+
"BrandManifest", # Stable alias for BrandManifest1 (temporary until upstream fix)
|
|
139
|
+
"Creative",
|
|
140
|
+
"CreativeManifest",
|
|
141
|
+
"Error",
|
|
142
|
+
"Format",
|
|
143
|
+
"MediaBuy",
|
|
144
|
+
"Package",
|
|
145
|
+
"Product",
|
|
146
|
+
"Property",
|
|
147
|
+
# Pricing options
|
|
148
|
+
"CpcPricingOption",
|
|
149
|
+
"CpcvPricingOption",
|
|
150
|
+
"CpmAuctionPricingOption",
|
|
151
|
+
"CpmFixedRatePricingOption",
|
|
152
|
+
"CppPricingOption",
|
|
153
|
+
"CpvPricingOption",
|
|
154
|
+
"FlatRatePricingOption",
|
|
155
|
+
"VcpmAuctionPricingOption",
|
|
156
|
+
"VcpmFixedRatePricingOption",
|
|
157
|
+
# Status enums
|
|
158
|
+
"CreativeStatus",
|
|
159
|
+
"MediaBuyStatus",
|
|
160
|
+
"PackageStatus",
|
|
161
|
+
"PricingModel",
|
|
162
|
+
"TaskStatus",
|
|
163
|
+
"TaskType",
|
|
164
|
+
# Assets
|
|
165
|
+
"AudioAsset",
|
|
166
|
+
"CssAsset",
|
|
167
|
+
"HtmlAsset",
|
|
168
|
+
"ImageAsset",
|
|
169
|
+
"JavascriptAsset",
|
|
170
|
+
"MarkdownAsset",
|
|
171
|
+
"TextAsset",
|
|
172
|
+
"UrlAsset",
|
|
173
|
+
"VideoAsset",
|
|
174
|
+
"WebhookAsset",
|
|
175
|
+
]
|
adcp/utils/preview_cache.py
CHANGED
|
@@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Any
|
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
12
|
from adcp.client import ADCPClient
|
|
13
|
-
from adcp.types.
|
|
13
|
+
from adcp.types._generated import CreativeManifest, Format, FormatId, Product
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
16
16
|
|
|
@@ -67,7 +67,7 @@ class PreviewURLGenerator:
|
|
|
67
67
|
Returns:
|
|
68
68
|
Preview data with preview_url and metadata, or None if generation fails
|
|
69
69
|
"""
|
|
70
|
-
from adcp.types.
|
|
70
|
+
from adcp.types._generated import PreviewCreativeRequest1
|
|
71
71
|
|
|
72
72
|
cache_key = _make_manifest_cache_key(format_id, manifest.model_dump(exclude_none=True))
|
|
73
73
|
|
|
@@ -123,7 +123,7 @@ class PreviewURLGenerator:
|
|
|
123
123
|
Returns:
|
|
124
124
|
List of preview data dicts (or None for failures), in same order as requests
|
|
125
125
|
"""
|
|
126
|
-
from adcp.types.
|
|
126
|
+
from adcp.types._generated import PreviewCreativeRequest
|
|
127
127
|
|
|
128
128
|
if not requests:
|
|
129
129
|
return []
|
|
@@ -396,7 +396,7 @@ def _create_sample_manifest_for_format(fmt: Format) -> CreativeManifest | None:
|
|
|
396
396
|
Returns:
|
|
397
397
|
Sample CreativeManifest, or None if unable to create one
|
|
398
398
|
"""
|
|
399
|
-
from adcp.types.
|
|
399
|
+
from adcp.types._generated import CreativeManifest
|
|
400
400
|
|
|
401
401
|
if not fmt.assets_required:
|
|
402
402
|
return None
|
|
@@ -436,7 +436,7 @@ def _create_sample_manifest_for_format_id(
|
|
|
436
436
|
Returns:
|
|
437
437
|
Sample CreativeManifest with placeholder assets
|
|
438
438
|
"""
|
|
439
|
-
from adcp.types.
|
|
439
|
+
from adcp.types._generated import CreativeManifest, ImageAsset, UrlAsset
|
|
440
440
|
|
|
441
441
|
assets = {
|
|
442
442
|
"primary_asset": ImageAsset(url="https://example.com/sample-image.jpg"),
|
|
@@ -456,7 +456,7 @@ def _create_sample_asset(asset_type: str | None) -> Any:
|
|
|
456
456
|
Returns:
|
|
457
457
|
Sample asset object (Pydantic model)
|
|
458
458
|
"""
|
|
459
|
-
from adcp.types.
|
|
459
|
+
from adcp.types._generated import (
|
|
460
460
|
HtmlAsset,
|
|
461
461
|
ImageAsset,
|
|
462
462
|
TextAsset,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adcp
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.1
|
|
4
4
|
Summary: Official Python client for the Ad Context Protocol (AdCP)
|
|
5
5
|
Author-email: AdCP Community <maintainers@adcontextprotocol.org>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -246,10 +246,16 @@ client = ADCPClient(config)
|
|
|
246
246
|
|
|
247
247
|
### Type Safety
|
|
248
248
|
|
|
249
|
-
Full type hints with Pydantic validation and auto-generated types from the AdCP spec:
|
|
249
|
+
Full type hints with Pydantic validation and auto-generated types from the AdCP spec. All commonly-used types are exported from the main `adcp` package for convenience:
|
|
250
250
|
|
|
251
251
|
```python
|
|
252
|
-
from adcp import
|
|
252
|
+
from adcp import (
|
|
253
|
+
GetProductsRequest,
|
|
254
|
+
BrandManifest,
|
|
255
|
+
Package,
|
|
256
|
+
CpmFixedRatePricingOption,
|
|
257
|
+
MediaBuyStatus,
|
|
258
|
+
)
|
|
253
259
|
|
|
254
260
|
# All methods require typed request objects
|
|
255
261
|
request = GetProductsRequest(brief="Coffee brands", max_results=10)
|
|
@@ -259,8 +265,27 @@ result = await agent.get_products(request)
|
|
|
259
265
|
if result.success:
|
|
260
266
|
for product in result.data.products:
|
|
261
267
|
print(product.name, product.pricing_options) # Full IDE autocomplete!
|
|
268
|
+
|
|
269
|
+
# Type-safe pricing with discriminators
|
|
270
|
+
pricing = CpmFixedRatePricingOption(
|
|
271
|
+
pricing_option_id="cpm_usd",
|
|
272
|
+
pricing_model="cpm",
|
|
273
|
+
is_fixed=True, # Literal[True] - type checked!
|
|
274
|
+
currency="USD",
|
|
275
|
+
rate=5.0
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
# Type-safe status enums
|
|
279
|
+
if media_buy.status == MediaBuyStatus.active:
|
|
280
|
+
print("Media buy is active")
|
|
262
281
|
```
|
|
263
282
|
|
|
283
|
+
**Exported from main package:**
|
|
284
|
+
- **Core domain types**: `BrandManifest`, `Creative`, `CreativeManifest`, `MediaBuy`, `Package`
|
|
285
|
+
- **Status enums**: `CreativeStatus`, `MediaBuyStatus`, `PackageStatus`, `PricingModel`
|
|
286
|
+
- **All 9 pricing options**: `CpcPricingOption`, `CpmFixedRatePricingOption`, `VcpmAuctionPricingOption`, etc.
|
|
287
|
+
- **Request/Response types**: All 16 operations with full request/response types
|
|
288
|
+
|
|
264
289
|
#### Semantic Type Aliases
|
|
265
290
|
|
|
266
291
|
For discriminated union types (success/error responses), use semantic aliases for clearer code:
|
|
@@ -291,7 +316,7 @@ See `examples/type_aliases_demo.py` for more examples.
|
|
|
291
316
|
**Import guidelines:**
|
|
292
317
|
- ✅ **DO**: Import from main package: `from adcp import GetProductsRequest`
|
|
293
318
|
- ✅ **DO**: Use semantic aliases: `from adcp import CreateMediaBuySuccessResponse`
|
|
294
|
-
- ⚠️ **AVOID**: Import from internal modules: `from adcp.types.
|
|
319
|
+
- ⚠️ **AVOID**: Import from internal modules: `from adcp.types._generated import CreateMediaBuyResponse1`
|
|
295
320
|
|
|
296
321
|
The main package exports provide a stable API while internal generated types may change.
|
|
297
322
|
|