Skip to content

Commit 9f321c1

Browse files
bokelleyclaude
andcommitted
docs: update README with ergonomic type import improvements
Updated Type Safety section to show that commonly-used types are now exported from the main adcp package, including: - Core domain types (BrandManifest, Creative, MediaBuy, Package, etc.) - Status enums (CreativeStatus, MediaBuyStatus, PackageStatus, PricingModel) - All 9 pricing options with discriminators - Request/Response types for all operations Added examples showing type-safe pricing options and status enum usage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 4d2a37e commit 9f321c1

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

README.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,16 @@ client = ADCPClient(config)
207207

208208
### Type Safety
209209

210-
Full type hints with Pydantic validation and auto-generated types from the AdCP spec:
210+
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:
211211

212212
```python
213-
from adcp import GetProductsRequest
213+
from adcp import (
214+
GetProductsRequest,
215+
BrandManifest,
216+
Package,
217+
CpmFixedRatePricingOption,
218+
MediaBuyStatus,
219+
)
214220

215221
# All methods require typed request objects
216222
request = GetProductsRequest(brief="Coffee brands", max_results=10)
@@ -220,8 +226,27 @@ result = await agent.get_products(request)
220226
if result.success:
221227
for product in result.data.products:
222228
print(product.name, product.pricing_options) # Full IDE autocomplete!
229+
230+
# Type-safe pricing with discriminators
231+
pricing = CpmFixedRatePricingOption(
232+
pricing_option_id="cpm_usd",
233+
pricing_model="cpm",
234+
is_fixed=True, # Literal[True] - type checked!
235+
currency="USD",
236+
rate=5.0
237+
)
238+
239+
# Type-safe status enums
240+
if media_buy.status == MediaBuyStatus.active:
241+
print("Media buy is active")
223242
```
224243

244+
**Exported from main package:**
245+
- **Core domain types**: `BrandManifest`, `Creative`, `CreativeManifest`, `MediaBuy`, `Package`
246+
- **Status enums**: `CreativeStatus`, `MediaBuyStatus`, `PackageStatus`, `PricingModel`
247+
- **All 9 pricing options**: `CpcPricingOption`, `CpmFixedRatePricingOption`, `VcpmAuctionPricingOption`, etc.
248+
- **Request/Response types**: All 16 operations with full request/response types
249+
225250
#### Semantic Type Aliases
226251

227252
For discriminated union types (success/error responses), use semantic aliases for clearer code:

0 commit comments

Comments
 (0)