Skip to content

Commit f270e95

Browse files
bokelleyclaude
andcommitted
feat: add semantic filter type aliases
Add ProductFilters, CreativeFilters, and SignalFilters type aliases to resolve name collisions where multiple `Filters` classes exist in different request modules. - ProductFilters: Filters for GetProductsRequest (6 fields for product discovery) - CreativeFilters: Filters for ListCreativesRequest (17 fields for creative library queries) - SignalFilters: Filters for GetSignalsRequest (4 fields for signal discovery) These aliases follow the established pattern in aliases.py for resolving discriminated union name collisions. Upstream schemas now properly define Filter classes as nested objects with properties, so the generator creates proper Pydantic models. Resolves feedback from downstream client regarding Filters type ambiguity. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 68077c7 commit f270e95

2 files changed

Lines changed: 124 additions & 0 deletions

File tree

src/adcp/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
BuildCreativeSuccessResponse,
6868
CreateMediaBuyErrorResponse,
6969
CreateMediaBuySuccessResponse,
70+
CreativeFilters,
7071
HtmlPreviewRender,
7172
InlineDaastAsset,
7273
InlineVastAsset,
@@ -77,6 +78,7 @@
7778
PreviewCreativeInteractiveResponse,
7879
PreviewCreativeManifestRequest,
7980
PreviewCreativeStaticResponse,
81+
ProductFilters,
8082
PropertyId,
8183
PropertyIdActivationKey,
8284
PropertyTag,
@@ -86,6 +88,7 @@
8688
PublisherPropertiesAll,
8789
PublisherPropertiesById,
8890
PublisherPropertiesByTag,
91+
SignalFilters,
8992
SyncCreativesErrorResponse,
9093
SyncCreativesSuccessResponse,
9194
TextSubAsset,
@@ -308,6 +311,7 @@
308311
"BuildCreativeErrorResponse",
309312
"CreateMediaBuySuccessResponse",
310313
"CreateMediaBuyErrorResponse",
314+
"CreativeFilters",
311315
"HtmlPreviewRender",
312316
"InlineDaastAsset",
313317
"InlineVastAsset",
@@ -318,6 +322,7 @@
318322
"PreviewCreativeManifestRequest",
319323
"PreviewCreativeStaticResponse",
320324
"PreviewCreativeInteractiveResponse",
325+
"ProductFilters",
321326
"PropertyId",
322327
"PropertyIdActivationKey",
323328
"PropertyTag",
@@ -327,6 +332,7 @@
327332
"PublisherPropertiesAll",
328333
"PublisherPropertiesById",
329334
"PublisherPropertiesByTag",
335+
"SignalFilters",
330336
"SyncCreativesSuccessResponse",
331337
"SyncCreativesErrorResponse",
332338
"TextSubAsset",

src/adcp/types/aliases.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,11 +672,129 @@ def filter_products(props: PublisherProperties) -> None:
672672
```
673673
"""
674674

675+
# ============================================================================
676+
# FILTER TYPE ALIASES - Request Filter Name Collision Resolution
677+
# ============================================================================
678+
# The AdCP schemas define multiple `Filters` classes with the same name but
679+
# different fields for different request types. The generator creates these
680+
# as local classes within each request module.
681+
#
682+
# These aliases resolve the name collision by providing semantic names that
683+
# clearly indicate which request type each filter belongs to.
684+
685+
from adcp.types.generated_poc.get_products_request import Filters as ProductFiltersInternal
686+
from adcp.types.generated_poc.get_signals_request import Filters as SignalFiltersInternal
687+
from adcp.types.generated_poc.list_creatives_request import Filters as CreativeFiltersInternal
688+
689+
ProductFilters = ProductFiltersInternal
690+
"""Filters for GetProductsRequest.
691+
692+
Used when discovering available advertising products to narrow down results
693+
based on delivery type, pricing model, format requirements, etc.
694+
695+
Fields:
696+
- delivery_type: Filter by delivery type (guaranteed/non_guaranteed)
697+
- is_fixed_price: Filter for fixed price vs auction products
698+
- format_types: Filter by format types (video, display, audio)
699+
- format_ids: Filter by specific format IDs
700+
- standard_formats_only: Only return products accepting IAB standard formats
701+
- min_exposures: Minimum exposures/impressions needed (≥1)
702+
703+
Example:
704+
```python
705+
from adcp import ProductFilters, GetProductsRequest
706+
707+
filters = ProductFilters(
708+
delivery_type="guaranteed",
709+
format_types=["video", "display"],
710+
min_exposures=10000
711+
)
712+
713+
request = GetProductsRequest(
714+
brief="Premium video inventory",
715+
filters=filters
716+
)
717+
```
718+
"""
719+
720+
CreativeFilters = CreativeFiltersInternal
721+
"""Filters for ListCreativesRequest.
722+
723+
Used when querying creative assets from the centralized library to filter
724+
by format, status, tags, assignment status, and date ranges.
725+
726+
Fields:
727+
- format: Filter by single creative format type
728+
- formats: Filter by multiple creative format types
729+
- status: Filter by approval status (processing, pending_review, approved, rejected)
730+
- statuses: Filter by multiple approval statuses
731+
- tags: Filter by tags (all tags must match)
732+
- tags_any: Filter by tags (any tag must match)
733+
- name_contains: Filter by creative names containing text (case-insensitive)
734+
- creative_ids: Filter by specific creative IDs (max 100)
735+
- created_after: Filter creatives created after date (ISO 8601)
736+
- created_before: Filter creatives created before date
737+
- updated_after: Filter creatives updated after date
738+
- updated_before: Filter creatives updated before date
739+
- assigned_to_package: Filter creatives assigned to specific package
740+
- assigned_to_packages: Filter creatives assigned to any of these packages
741+
- unassigned: Filter for unassigned (true) or assigned (false) creatives
742+
- has_performance_data: Filter creatives with performance data
743+
744+
Example:
745+
```python
746+
from adcp import CreativeFilters, ListCreativesRequest
747+
748+
filters = CreativeFilters(
749+
status="approved",
750+
formats=["video", "display"],
751+
tags=["holiday", "2024"],
752+
has_performance_data=True
753+
)
754+
755+
request = ListCreativesRequest(filters=filters)
756+
```
757+
"""
758+
759+
SignalFilters = SignalFiltersInternal
760+
"""Filters for GetSignalsRequest.
761+
762+
Used when discovering audience signals to refine results based on
763+
catalog type, data providers, pricing, and coverage requirements.
764+
765+
Fields:
766+
- catalog_types: Filter by catalog type (marketplace, custom, owned)
767+
- data_providers: Filter by specific data providers
768+
- max_cpm: Maximum CPM price filter (≥0)
769+
- min_coverage_percentage: Minimum coverage requirement (0-100)
770+
771+
Example:
772+
```python
773+
from adcp import SignalFilters, GetSignalsRequest
774+
775+
filters = SignalFilters(
776+
catalog_types=["marketplace", "owned"],
777+
max_cpm=5.00,
778+
min_coverage_percentage=80.0
779+
)
780+
781+
request = GetSignalsRequest(
782+
signal_spec="Coffee enthusiasts in major metros",
783+
deliver_to={...},
784+
filters=filters
785+
)
786+
```
787+
"""
788+
675789
# ============================================================================
676790
# EXPORTS
677791
# ============================================================================
678792

679793
__all__ = [
794+
# Filter type aliases
795+
"ProductFilters",
796+
"CreativeFilters",
797+
"SignalFilters",
680798
# Activation responses
681799
"ActivateSignalSuccessResponse",
682800
"ActivateSignalErrorResponse",

0 commit comments

Comments
 (0)