adcp 2.4.0__tar.gz → 2.5.0__tar.gz
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-2.4.0/src/adcp.egg-info → adcp-2.5.0}/PKG-INFO +45 -5
- {adcp-2.4.0 → adcp-2.5.0}/README.md +42 -4
- {adcp-2.4.0 → adcp-2.5.0}/pyproject.toml +6 -3
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/__init__.py +91 -39
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/__main__.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/client.py +9 -9
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/simple.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/testing/test_helpers.py +1 -1
- adcp-2.5.0/src/adcp/types/__init__.py +115 -0
- adcp-2.4.0/src/adcp/types/generated.py → adcp-2.5.0/src/adcp/types/_generated.py +67 -11
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/aliases.py +55 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/__init__.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/activate_signal_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/activate_signal_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/activation_key.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/adagents.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/asset_type.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/audio_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/brand_manifest.py +3 -62
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/build_creative_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/build_creative_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/channels.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/cpc_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/cpcv_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/cpm_auction_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/cpm_fixed_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/cpp_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/cpv_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/create_media_buy_request.py +2 -2
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/create_media_buy_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/creative_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/creative_assignment.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/creative_manifest.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/creative_policy.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/creative_status.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/css_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/daast_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/delivery_metrics.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/delivery_type.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/deployment.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/destination.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/error.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/flat_rate_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/format.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/format_id.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/frequency_cap.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/frequency_cap_scope.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/get_media_buy_delivery_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/get_media_buy_delivery_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/get_products_request.py +2 -2
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/get_products_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/get_signals_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/get_signals_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/html_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/identifier_types.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/image_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/javascript_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/list_authorized_properties_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/list_authorized_properties_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/list_creative_formats_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/list_creative_formats_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/list_creatives_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/list_creatives_response.py +2 -17
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/markdown_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/measurement.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/media_buy.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/media_buy_status.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/pacing.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/package.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/package_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/package_status.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/performance_feedback.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/placement.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/preview_creative_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/preview_creative_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/preview_render.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/pricing_model.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/product.py +25 -16
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/promoted_offerings.py +2 -2
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/promoted_products.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/property.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/protocol_envelope.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/provide_performance_feedback_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/provide_performance_feedback_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/publisher_identifier_types.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/push_notification_config.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/reporting_capabilities.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/standard_format_ids.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/sub_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/sync_creatives_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/sync_creatives_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/targeting.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/task_status.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/task_type.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/tasks_get_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/tasks_get_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/tasks_list_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/tasks_list_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/text_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/update_media_buy_request.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/update_media_buy_response.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/url_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/vast_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/vcpm_auction_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/vcpm_fixed_option.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/video_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/webhook_asset.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/generated_poc/webhook_payload.py +1 -1
- adcp-2.5.0/src/adcp/types/stable.py +177 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/utils/preview_cache.py +6 -6
- {adcp-2.4.0 → adcp-2.5.0/src/adcp.egg-info}/PKG-INFO +45 -5
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp.egg-info/SOURCES.txt +3 -5
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp.egg-info/requires.txt +3 -0
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_cli.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_client.py +6 -6
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_code_generation.py +4 -4
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_discriminated_unions.py +78 -21
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_format_id_validation.py +1 -1
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_preview_html.py +4 -4
- adcp-2.5.0/tests/test_public_api.py +290 -0
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_simple_api.py +4 -4
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_type_aliases.py +125 -11
- adcp-2.4.0/src/adcp/types/__init__.py +0 -48
- adcp-2.4.0/src/adcp/types/generated_poc/brand_manifest_ref.py +0 -361
- adcp-2.4.0/src/adcp/types/generated_poc/index.py +0 -17
- adcp-2.4.0/src/adcp/types/generated_poc/pricing_option.py +0 -365
- adcp-2.4.0/src/adcp/types/generated_poc/start_timing.py +0 -13
- {adcp-2.4.0 → adcp-2.5.0}/LICENSE +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/setup.cfg +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/adagents.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/config.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/exceptions.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/protocols/__init__.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/protocols/a2a.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/protocols/base.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/protocols/mcp.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/py.typed +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/testing/__init__.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/base.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/types/core.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/utils/__init__.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/utils/operation_id.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/utils/response_parser.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp/validation.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp.egg-info/dependency_links.txt +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp.egg-info/entry_points.txt +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/src/adcp.egg-info/top_level.txt +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_adagents.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_helpers.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_protocols.py +0 -0
- {adcp-2.4.0 → adcp-2.5.0}/tests/test_response_parser.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: adcp
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
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
|
|
@@ -35,6 +35,8 @@ Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
|
35
35
|
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
36
36
|
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
37
37
|
Requires-Dist: datamodel-code-generator[http]>=0.35.0; extra == "dev"
|
|
38
|
+
Provides-Extra: docs
|
|
39
|
+
Requires-Dist: pdoc3>=0.10.0; extra == "docs"
|
|
38
40
|
Dynamic: license-file
|
|
39
41
|
|
|
40
42
|
# adcp - Python Client for Ad Context Protocol
|
|
@@ -177,6 +179,18 @@ async with ADCPMultiAgentClient(
|
|
|
177
179
|
# Connections automatically cleaned up here
|
|
178
180
|
```
|
|
179
181
|
|
|
182
|
+
## Documentation
|
|
183
|
+
|
|
184
|
+
- **[API Reference](https://adcontextprotocol.github.io/adcp-client-python/)** - Complete API documentation with type signatures and examples
|
|
185
|
+
- **[Protocol Spec](https://github.com/adcontextprotocol/adcp)** - Ad Context Protocol specification
|
|
186
|
+
- **[Examples](examples/)** - Code examples and usage patterns
|
|
187
|
+
|
|
188
|
+
The API reference documentation is automatically generated from the code and includes:
|
|
189
|
+
- Full type signatures for all methods
|
|
190
|
+
- Field descriptions from JSON Schema
|
|
191
|
+
- Method documentation with examples
|
|
192
|
+
- Searchable interface
|
|
193
|
+
|
|
180
194
|
## Features
|
|
181
195
|
|
|
182
196
|
### Test Helpers
|
|
@@ -246,10 +260,16 @@ client = ADCPClient(config)
|
|
|
246
260
|
|
|
247
261
|
### Type Safety
|
|
248
262
|
|
|
249
|
-
Full type hints with Pydantic validation and auto-generated types from the AdCP spec:
|
|
263
|
+
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
264
|
|
|
251
265
|
```python
|
|
252
|
-
from adcp import
|
|
266
|
+
from adcp import (
|
|
267
|
+
GetProductsRequest,
|
|
268
|
+
BrandManifest,
|
|
269
|
+
Package,
|
|
270
|
+
CpmFixedRatePricingOption,
|
|
271
|
+
MediaBuyStatus,
|
|
272
|
+
)
|
|
253
273
|
|
|
254
274
|
# All methods require typed request objects
|
|
255
275
|
request = GetProductsRequest(brief="Coffee brands", max_results=10)
|
|
@@ -259,8 +279,27 @@ result = await agent.get_products(request)
|
|
|
259
279
|
if result.success:
|
|
260
280
|
for product in result.data.products:
|
|
261
281
|
print(product.name, product.pricing_options) # Full IDE autocomplete!
|
|
282
|
+
|
|
283
|
+
# Type-safe pricing with discriminators
|
|
284
|
+
pricing = CpmFixedRatePricingOption(
|
|
285
|
+
pricing_option_id="cpm_usd",
|
|
286
|
+
pricing_model="cpm",
|
|
287
|
+
is_fixed=True, # Literal[True] - type checked!
|
|
288
|
+
currency="USD",
|
|
289
|
+
rate=5.0
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
# Type-safe status enums
|
|
293
|
+
if media_buy.status == MediaBuyStatus.active:
|
|
294
|
+
print("Media buy is active")
|
|
262
295
|
```
|
|
263
296
|
|
|
297
|
+
**Exported from main package:**
|
|
298
|
+
- **Core domain types**: `BrandManifest`, `Creative`, `CreativeManifest`, `MediaBuy`, `Package`
|
|
299
|
+
- **Status enums**: `CreativeStatus`, `MediaBuyStatus`, `PackageStatus`, `PricingModel`
|
|
300
|
+
- **All 9 pricing options**: `CpcPricingOption`, `CpmFixedRatePricingOption`, `VcpmAuctionPricingOption`, etc.
|
|
301
|
+
- **Request/Response types**: All 16 operations with full request/response types
|
|
302
|
+
|
|
264
303
|
#### Semantic Type Aliases
|
|
265
304
|
|
|
266
305
|
For discriminated union types (success/error responses), use semantic aliases for clearer code:
|
|
@@ -291,7 +330,7 @@ See `examples/type_aliases_demo.py` for more examples.
|
|
|
291
330
|
**Import guidelines:**
|
|
292
331
|
- ✅ **DO**: Import from main package: `from adcp import GetProductsRequest`
|
|
293
332
|
- ✅ **DO**: Use semantic aliases: `from adcp import CreateMediaBuySuccessResponse`
|
|
294
|
-
- ⚠️ **AVOID**: Import from internal modules: `from adcp.types.
|
|
333
|
+
- ⚠️ **AVOID**: Import from internal modules: `from adcp.types._generated import CreateMediaBuyResponse1`
|
|
295
334
|
|
|
296
335
|
The main package exports provide a stable API while internal generated types may change.
|
|
297
336
|
|
|
@@ -776,6 +815,7 @@ Apache 2.0 License - see [LICENSE](LICENSE) file for details.
|
|
|
776
815
|
|
|
777
816
|
## Support
|
|
778
817
|
|
|
779
|
-
- **
|
|
818
|
+
- **API Reference**: [adcontextprotocol.github.io/adcp-client-python](https://adcontextprotocol.github.io/adcp-client-python/)
|
|
819
|
+
- **Protocol Documentation**: [docs.adcontextprotocol.org](https://docs.adcontextprotocol.org)
|
|
780
820
|
- **Issues**: [GitHub Issues](https://github.com/adcontextprotocol/adcp-client-python/issues)
|
|
781
821
|
- **Protocol Spec**: [AdCP Specification](https://github.com/adcontextprotocol/adcp)
|
|
@@ -138,6 +138,18 @@ async with ADCPMultiAgentClient(
|
|
|
138
138
|
# Connections automatically cleaned up here
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
- **[API Reference](https://adcontextprotocol.github.io/adcp-client-python/)** - Complete API documentation with type signatures and examples
|
|
144
|
+
- **[Protocol Spec](https://github.com/adcontextprotocol/adcp)** - Ad Context Protocol specification
|
|
145
|
+
- **[Examples](examples/)** - Code examples and usage patterns
|
|
146
|
+
|
|
147
|
+
The API reference documentation is automatically generated from the code and includes:
|
|
148
|
+
- Full type signatures for all methods
|
|
149
|
+
- Field descriptions from JSON Schema
|
|
150
|
+
- Method documentation with examples
|
|
151
|
+
- Searchable interface
|
|
152
|
+
|
|
141
153
|
## Features
|
|
142
154
|
|
|
143
155
|
### Test Helpers
|
|
@@ -207,10 +219,16 @@ client = ADCPClient(config)
|
|
|
207
219
|
|
|
208
220
|
### Type Safety
|
|
209
221
|
|
|
210
|
-
Full type hints with Pydantic validation and auto-generated types from the AdCP spec:
|
|
222
|
+
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:
|
|
211
223
|
|
|
212
224
|
```python
|
|
213
|
-
from adcp import
|
|
225
|
+
from adcp import (
|
|
226
|
+
GetProductsRequest,
|
|
227
|
+
BrandManifest,
|
|
228
|
+
Package,
|
|
229
|
+
CpmFixedRatePricingOption,
|
|
230
|
+
MediaBuyStatus,
|
|
231
|
+
)
|
|
214
232
|
|
|
215
233
|
# All methods require typed request objects
|
|
216
234
|
request = GetProductsRequest(brief="Coffee brands", max_results=10)
|
|
@@ -220,8 +238,27 @@ result = await agent.get_products(request)
|
|
|
220
238
|
if result.success:
|
|
221
239
|
for product in result.data.products:
|
|
222
240
|
print(product.name, product.pricing_options) # Full IDE autocomplete!
|
|
241
|
+
|
|
242
|
+
# Type-safe pricing with discriminators
|
|
243
|
+
pricing = CpmFixedRatePricingOption(
|
|
244
|
+
pricing_option_id="cpm_usd",
|
|
245
|
+
pricing_model="cpm",
|
|
246
|
+
is_fixed=True, # Literal[True] - type checked!
|
|
247
|
+
currency="USD",
|
|
248
|
+
rate=5.0
|
|
249
|
+
)
|
|
250
|
+
|
|
251
|
+
# Type-safe status enums
|
|
252
|
+
if media_buy.status == MediaBuyStatus.active:
|
|
253
|
+
print("Media buy is active")
|
|
223
254
|
```
|
|
224
255
|
|
|
256
|
+
**Exported from main package:**
|
|
257
|
+
- **Core domain types**: `BrandManifest`, `Creative`, `CreativeManifest`, `MediaBuy`, `Package`
|
|
258
|
+
- **Status enums**: `CreativeStatus`, `MediaBuyStatus`, `PackageStatus`, `PricingModel`
|
|
259
|
+
- **All 9 pricing options**: `CpcPricingOption`, `CpmFixedRatePricingOption`, `VcpmAuctionPricingOption`, etc.
|
|
260
|
+
- **Request/Response types**: All 16 operations with full request/response types
|
|
261
|
+
|
|
225
262
|
#### Semantic Type Aliases
|
|
226
263
|
|
|
227
264
|
For discriminated union types (success/error responses), use semantic aliases for clearer code:
|
|
@@ -252,7 +289,7 @@ See `examples/type_aliases_demo.py` for more examples.
|
|
|
252
289
|
**Import guidelines:**
|
|
253
290
|
- ✅ **DO**: Import from main package: `from adcp import GetProductsRequest`
|
|
254
291
|
- ✅ **DO**: Use semantic aliases: `from adcp import CreateMediaBuySuccessResponse`
|
|
255
|
-
- ⚠️ **AVOID**: Import from internal modules: `from adcp.types.
|
|
292
|
+
- ⚠️ **AVOID**: Import from internal modules: `from adcp.types._generated import CreateMediaBuyResponse1`
|
|
256
293
|
|
|
257
294
|
The main package exports provide a stable API while internal generated types may change.
|
|
258
295
|
|
|
@@ -737,6 +774,7 @@ Apache 2.0 License - see [LICENSE](LICENSE) file for details.
|
|
|
737
774
|
|
|
738
775
|
## Support
|
|
739
776
|
|
|
740
|
-
- **
|
|
777
|
+
- **API Reference**: [adcontextprotocol.github.io/adcp-client-python](https://adcontextprotocol.github.io/adcp-client-python/)
|
|
778
|
+
- **Protocol Documentation**: [docs.adcontextprotocol.org](https://docs.adcontextprotocol.org)
|
|
741
779
|
- **Issues**: [GitHub Issues](https://github.com/adcontextprotocol/adcp-client-python/issues)
|
|
742
780
|
- **Protocol Spec**: [AdCP Specification](https://github.com/adcontextprotocol/adcp)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "adcp"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.5.0"
|
|
8
8
|
description = "Official Python client for the Ad Context Protocol (AdCP)"
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "AdCP Community", email = "maintainers@adcontextprotocol.org"}
|
|
@@ -47,6 +47,9 @@ dev = [
|
|
|
47
47
|
"ruff>=0.1.0",
|
|
48
48
|
"datamodel-code-generator[http]>=0.35.0",
|
|
49
49
|
]
|
|
50
|
+
docs = [
|
|
51
|
+
"pdoc3>=0.10.0",
|
|
52
|
+
]
|
|
50
53
|
|
|
51
54
|
[project.urls]
|
|
52
55
|
Homepage = "https://github.com/adcontextprotocol/adcp-client-python"
|
|
@@ -63,13 +66,13 @@ adcp = ["py.typed"]
|
|
|
63
66
|
[tool.black]
|
|
64
67
|
line-length = 100
|
|
65
68
|
target-version = ["py310", "py311", "py312"]
|
|
66
|
-
extend-exclude = "/(
|
|
69
|
+
extend-exclude = "/(_generated|tasks)\\.py$"
|
|
67
70
|
|
|
68
71
|
[tool.ruff]
|
|
69
72
|
line-length = 100
|
|
70
73
|
target-version = "py310"
|
|
71
74
|
extend-exclude = [
|
|
72
|
-
"src/adcp/types/
|
|
75
|
+
"src/adcp/types/_generated.py",
|
|
73
76
|
"src/adcp/types/tasks.py",
|
|
74
77
|
"src/adcp/types/generated_poc/",
|
|
75
78
|
]
|
|
@@ -51,47 +51,15 @@ from adcp.testing import (
|
|
|
51
51
|
test_agent_no_auth,
|
|
52
52
|
)
|
|
53
53
|
|
|
54
|
-
# Import
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
from adcp.types.aliases import (
|
|
59
|
-
ActivateSignalErrorResponse,
|
|
60
|
-
ActivateSignalSuccessResponse,
|
|
61
|
-
BothPreviewRender,
|
|
62
|
-
BuildCreativeErrorResponse,
|
|
63
|
-
BuildCreativeSuccessResponse,
|
|
64
|
-
CreateMediaBuyErrorResponse,
|
|
65
|
-
CreateMediaBuySuccessResponse,
|
|
66
|
-
HtmlPreviewRender,
|
|
67
|
-
InlineDaastAsset,
|
|
68
|
-
InlineVastAsset,
|
|
69
|
-
MediaSubAsset,
|
|
70
|
-
PreviewCreativeFormatRequest,
|
|
71
|
-
PreviewCreativeInteractiveResponse,
|
|
72
|
-
PreviewCreativeManifestRequest,
|
|
73
|
-
PreviewCreativeStaticResponse,
|
|
74
|
-
PropertyIdActivationKey,
|
|
75
|
-
PropertyTagActivationKey,
|
|
76
|
-
ProvidePerformanceFeedbackErrorResponse,
|
|
77
|
-
ProvidePerformanceFeedbackSuccessResponse,
|
|
78
|
-
SyncCreativesErrorResponse,
|
|
79
|
-
SyncCreativesSuccessResponse,
|
|
80
|
-
TextSubAsset,
|
|
81
|
-
UpdateMediaBuyErrorResponse,
|
|
82
|
-
UpdateMediaBuyPackagesRequest,
|
|
83
|
-
UpdateMediaBuyPropertiesRequest,
|
|
84
|
-
UpdateMediaBuySuccessResponse,
|
|
85
|
-
UrlDaastAsset,
|
|
86
|
-
UrlPreviewRender,
|
|
87
|
-
UrlVastAsset,
|
|
88
|
-
)
|
|
89
|
-
from adcp.types.core import AgentConfig, Protocol, TaskResult, TaskStatus, WebhookMetadata
|
|
54
|
+
# Import generated types modules - for internal use
|
|
55
|
+
# Note: Users should import specific types, not the whole module
|
|
56
|
+
from adcp.types import _generated as generated
|
|
57
|
+
from adcp.types import aliases
|
|
90
58
|
|
|
91
59
|
# Re-export commonly-used request/response types for convenience
|
|
92
60
|
# Users should import from main package (e.g., `from adcp import GetProductsRequest`)
|
|
93
61
|
# rather than internal modules for better API stability
|
|
94
|
-
from adcp.types.
|
|
62
|
+
from adcp.types._generated import (
|
|
95
63
|
# Audience & Targeting
|
|
96
64
|
ActivateSignalRequest,
|
|
97
65
|
ActivateSignalResponse,
|
|
@@ -127,7 +95,68 @@ from adcp.types.generated import (
|
|
|
127
95
|
UpdateMediaBuyRequest,
|
|
128
96
|
UpdateMediaBuyResponse,
|
|
129
97
|
)
|
|
130
|
-
from adcp.types.
|
|
98
|
+
from adcp.types._generated import TaskStatus as GeneratedTaskStatus
|
|
99
|
+
|
|
100
|
+
# Re-export semantic type aliases for better ergonomics
|
|
101
|
+
from adcp.types.aliases import (
|
|
102
|
+
ActivateSignalErrorResponse,
|
|
103
|
+
ActivateSignalSuccessResponse,
|
|
104
|
+
BothPreviewRender,
|
|
105
|
+
BuildCreativeErrorResponse,
|
|
106
|
+
BuildCreativeSuccessResponse,
|
|
107
|
+
CreatedPackageReference,
|
|
108
|
+
CreateMediaBuyErrorResponse,
|
|
109
|
+
CreateMediaBuySuccessResponse,
|
|
110
|
+
HtmlPreviewRender,
|
|
111
|
+
InlineDaastAsset,
|
|
112
|
+
InlineVastAsset,
|
|
113
|
+
MediaSubAsset,
|
|
114
|
+
PreviewCreativeFormatRequest,
|
|
115
|
+
PreviewCreativeInteractiveResponse,
|
|
116
|
+
PreviewCreativeManifestRequest,
|
|
117
|
+
PreviewCreativeStaticResponse,
|
|
118
|
+
PropertyIdActivationKey,
|
|
119
|
+
PropertyTagActivationKey,
|
|
120
|
+
ProvidePerformanceFeedbackErrorResponse,
|
|
121
|
+
ProvidePerformanceFeedbackSuccessResponse,
|
|
122
|
+
SyncCreativesErrorResponse,
|
|
123
|
+
SyncCreativesSuccessResponse,
|
|
124
|
+
TextSubAsset,
|
|
125
|
+
UpdateMediaBuyErrorResponse,
|
|
126
|
+
UpdateMediaBuyPackagesRequest,
|
|
127
|
+
UpdateMediaBuyPropertiesRequest,
|
|
128
|
+
UpdateMediaBuySuccessResponse,
|
|
129
|
+
UrlDaastAsset,
|
|
130
|
+
UrlPreviewRender,
|
|
131
|
+
UrlVastAsset,
|
|
132
|
+
)
|
|
133
|
+
from adcp.types.core import AgentConfig, Protocol, TaskResult, TaskStatus, WebhookMetadata
|
|
134
|
+
|
|
135
|
+
# Re-export core domain types and pricing options from stable API
|
|
136
|
+
# These are commonly used in typical workflows
|
|
137
|
+
from adcp.types.stable import (
|
|
138
|
+
# Core domain types
|
|
139
|
+
BrandManifest,
|
|
140
|
+
# Pricing options (all 9 types for product creation)
|
|
141
|
+
CpcPricingOption,
|
|
142
|
+
CpcvPricingOption,
|
|
143
|
+
CpmAuctionPricingOption,
|
|
144
|
+
CpmFixedRatePricingOption,
|
|
145
|
+
CppPricingOption,
|
|
146
|
+
CpvPricingOption,
|
|
147
|
+
Creative,
|
|
148
|
+
CreativeManifest,
|
|
149
|
+
# Status enums (for control flow)
|
|
150
|
+
CreativeStatus,
|
|
151
|
+
FlatRatePricingOption,
|
|
152
|
+
MediaBuy,
|
|
153
|
+
MediaBuyStatus,
|
|
154
|
+
Package,
|
|
155
|
+
PackageStatus,
|
|
156
|
+
PricingModel,
|
|
157
|
+
VcpmAuctionPricingOption,
|
|
158
|
+
VcpmFixedRatePricingOption,
|
|
159
|
+
)
|
|
131
160
|
from adcp.validation import (
|
|
132
161
|
ValidationError,
|
|
133
162
|
validate_adagents,
|
|
@@ -136,7 +165,7 @@ from adcp.validation import (
|
|
|
136
165
|
validate_publisher_properties_item,
|
|
137
166
|
)
|
|
138
167
|
|
|
139
|
-
__version__ = "2.
|
|
168
|
+
__version__ = "2.5.0"
|
|
140
169
|
|
|
141
170
|
__all__ = [
|
|
142
171
|
# Client classes
|
|
@@ -179,6 +208,29 @@ __all__ = [
|
|
|
179
208
|
"Format",
|
|
180
209
|
"Product",
|
|
181
210
|
"Property",
|
|
211
|
+
# Core domain types (from stable API)
|
|
212
|
+
"BrandManifest",
|
|
213
|
+
"Creative",
|
|
214
|
+
"CreativeManifest",
|
|
215
|
+
"MediaBuy",
|
|
216
|
+
"Package",
|
|
217
|
+
# Package type aliases
|
|
218
|
+
"CreatedPackageReference",
|
|
219
|
+
# Status enums (for control flow)
|
|
220
|
+
"CreativeStatus",
|
|
221
|
+
"MediaBuyStatus",
|
|
222
|
+
"PackageStatus",
|
|
223
|
+
"PricingModel",
|
|
224
|
+
# Pricing options (all 9 types)
|
|
225
|
+
"CpcPricingOption",
|
|
226
|
+
"CpcvPricingOption",
|
|
227
|
+
"CpmAuctionPricingOption",
|
|
228
|
+
"CpmFixedRatePricingOption",
|
|
229
|
+
"CppPricingOption",
|
|
230
|
+
"CpvPricingOption",
|
|
231
|
+
"FlatRatePricingOption",
|
|
232
|
+
"VcpmAuctionPricingOption",
|
|
233
|
+
"VcpmFixedRatePricingOption",
|
|
182
234
|
# Adagents validation
|
|
183
235
|
"AuthorizationContext",
|
|
184
236
|
"fetch_adagents",
|
|
@@ -112,7 +112,7 @@ async def _dispatch_tool(client: ADCPClient, tool_name: str, payload: dict[str,
|
|
|
112
112
|
"""
|
|
113
113
|
from pydantic import ValidationError
|
|
114
114
|
|
|
115
|
-
from adcp.types import
|
|
115
|
+
from adcp.types import _generated as gen
|
|
116
116
|
from adcp.types.core import TaskResult, TaskStatus
|
|
117
117
|
|
|
118
118
|
# Lazy initialization of request types (avoid circular imports)
|
|
@@ -17,15 +17,7 @@ from adcp.exceptions import ADCPWebhookSignatureError
|
|
|
17
17
|
from adcp.protocols.a2a import A2AAdapter
|
|
18
18
|
from adcp.protocols.base import ProtocolAdapter
|
|
19
19
|
from adcp.protocols.mcp import MCPAdapter
|
|
20
|
-
from adcp.types.
|
|
21
|
-
Activity,
|
|
22
|
-
ActivityType,
|
|
23
|
-
AgentConfig,
|
|
24
|
-
Protocol,
|
|
25
|
-
TaskResult,
|
|
26
|
-
TaskStatus,
|
|
27
|
-
)
|
|
28
|
-
from adcp.types.generated import (
|
|
20
|
+
from adcp.types._generated import (
|
|
29
21
|
ActivateSignalRequest,
|
|
30
22
|
ActivateSignalResponse,
|
|
31
23
|
GetMediaBuyDeliveryRequest,
|
|
@@ -48,6 +40,14 @@ from adcp.types.generated import (
|
|
|
48
40
|
SyncCreativesResponse,
|
|
49
41
|
WebhookPayload,
|
|
50
42
|
)
|
|
43
|
+
from adcp.types.core import (
|
|
44
|
+
Activity,
|
|
45
|
+
ActivityType,
|
|
46
|
+
AgentConfig,
|
|
47
|
+
Protocol,
|
|
48
|
+
TaskResult,
|
|
49
|
+
TaskStatus,
|
|
50
|
+
)
|
|
51
51
|
from adcp.types.generated_poc.task_status import TaskStatus as GeneratedTaskStatus
|
|
52
52
|
from adcp.utils.operation_id import create_operation_id
|
|
53
53
|
|
|
@@ -23,7 +23,7 @@ from __future__ import annotations
|
|
|
23
23
|
from typing import TYPE_CHECKING, Any
|
|
24
24
|
|
|
25
25
|
from adcp.exceptions import ADCPSimpleAPIError
|
|
26
|
-
from adcp.types.
|
|
26
|
+
from adcp.types._generated import (
|
|
27
27
|
ActivateSignalRequest,
|
|
28
28
|
ActivateSignalResponse,
|
|
29
29
|
GetMediaBuyDeliveryRequest,
|
|
@@ -231,7 +231,7 @@ test_agent_a2a_no_auth: ADCPClient = _create_test_agent_a2a_no_auth_client()
|
|
|
231
231
|
# Example:
|
|
232
232
|
# ```python
|
|
233
233
|
# from adcp.testing import creative_agent
|
|
234
|
-
# from adcp.types.
|
|
234
|
+
# from adcp.types._generated import PreviewCreativeRequest
|
|
235
235
|
#
|
|
236
236
|
# result = await creative_agent.preview_creative(
|
|
237
237
|
# PreviewCreativeRequest(
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
"""Type definitions for AdCP client.
|
|
4
|
+
|
|
5
|
+
This module provides the public API for AdCP types. All types are imported from
|
|
6
|
+
the stable API layer which provides consistent naming regardless of internal
|
|
7
|
+
schema evolution.
|
|
8
|
+
|
|
9
|
+
**IMPORTANT**: Never import directly from adcp.types.generated_poc. Always use
|
|
10
|
+
adcp.types or adcp.types.stable for stable, versioned types.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from adcp.types.aliases import (
|
|
14
|
+
BothPreviewRender,
|
|
15
|
+
CreatedPackageReference,
|
|
16
|
+
HtmlPreviewRender,
|
|
17
|
+
InlineDaastAsset,
|
|
18
|
+
InlineVastAsset,
|
|
19
|
+
MediaSubAsset,
|
|
20
|
+
TextSubAsset,
|
|
21
|
+
UrlDaastAsset,
|
|
22
|
+
UrlPreviewRender,
|
|
23
|
+
UrlVastAsset,
|
|
24
|
+
)
|
|
25
|
+
from adcp.types.base import AdCPBaseModel
|
|
26
|
+
from adcp.types.core import (
|
|
27
|
+
Activity,
|
|
28
|
+
ActivityType,
|
|
29
|
+
AgentConfig,
|
|
30
|
+
DebugInfo,
|
|
31
|
+
Protocol,
|
|
32
|
+
TaskResult,
|
|
33
|
+
WebhookMetadata,
|
|
34
|
+
)
|
|
35
|
+
from adcp.types.core import (
|
|
36
|
+
TaskStatus as CoreTaskStatus,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Import stable public API types
|
|
40
|
+
from adcp.types.stable import (
|
|
41
|
+
BrandManifest,
|
|
42
|
+
# Pricing options
|
|
43
|
+
CpcPricingOption,
|
|
44
|
+
CpcvPricingOption,
|
|
45
|
+
CpmAuctionPricingOption,
|
|
46
|
+
CpmFixedRatePricingOption,
|
|
47
|
+
CppPricingOption,
|
|
48
|
+
CpvPricingOption,
|
|
49
|
+
Creative,
|
|
50
|
+
CreativeStatus,
|
|
51
|
+
Error,
|
|
52
|
+
FlatRatePricingOption,
|
|
53
|
+
Format,
|
|
54
|
+
MediaBuy,
|
|
55
|
+
MediaBuyStatus,
|
|
56
|
+
Package,
|
|
57
|
+
PackageStatus,
|
|
58
|
+
PricingModel,
|
|
59
|
+
Product,
|
|
60
|
+
Property,
|
|
61
|
+
VcpmAuctionPricingOption,
|
|
62
|
+
VcpmFixedRatePricingOption,
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
# Note: CoreTaskStatus is for internal task tracking
|
|
66
|
+
# Generated TaskStatus from AdCP schema is available via adcp.types.stable
|
|
67
|
+
TaskStatus = CoreTaskStatus
|
|
68
|
+
|
|
69
|
+
__all__ = [
|
|
70
|
+
# Base types
|
|
71
|
+
"AdCPBaseModel",
|
|
72
|
+
"AgentConfig",
|
|
73
|
+
"Protocol",
|
|
74
|
+
"TaskResult",
|
|
75
|
+
"TaskStatus",
|
|
76
|
+
"WebhookMetadata",
|
|
77
|
+
"Activity",
|
|
78
|
+
"ActivityType",
|
|
79
|
+
"DebugInfo",
|
|
80
|
+
# Semantic aliases for discriminated unions
|
|
81
|
+
"BothPreviewRender",
|
|
82
|
+
"HtmlPreviewRender",
|
|
83
|
+
"InlineDaastAsset",
|
|
84
|
+
"InlineVastAsset",
|
|
85
|
+
"MediaSubAsset",
|
|
86
|
+
"TextSubAsset",
|
|
87
|
+
"UrlDaastAsset",
|
|
88
|
+
"UrlPreviewRender",
|
|
89
|
+
"UrlVastAsset",
|
|
90
|
+
# Package type aliases
|
|
91
|
+
"CreatedPackageReference",
|
|
92
|
+
# Stable API types (commonly used)
|
|
93
|
+
"BrandManifest",
|
|
94
|
+
"Creative",
|
|
95
|
+
"CreativeStatus",
|
|
96
|
+
"Error",
|
|
97
|
+
"Format",
|
|
98
|
+
"MediaBuy",
|
|
99
|
+
"MediaBuyStatus",
|
|
100
|
+
"Package",
|
|
101
|
+
"PackageStatus",
|
|
102
|
+
"PricingModel",
|
|
103
|
+
"Product",
|
|
104
|
+
"Property",
|
|
105
|
+
# Pricing options
|
|
106
|
+
"CpcPricingOption",
|
|
107
|
+
"CpcvPricingOption",
|
|
108
|
+
"CpmAuctionPricingOption",
|
|
109
|
+
"CpmFixedRatePricingOption",
|
|
110
|
+
"CppPricingOption",
|
|
111
|
+
"CpvPricingOption",
|
|
112
|
+
"FlatRatePricingOption",
|
|
113
|
+
"VcpmAuctionPricingOption",
|
|
114
|
+
"VcpmFixedRatePricingOption",
|
|
115
|
+
]
|