adcp 2.6.0__py3-none-any.whl → 2.8.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 +51 -43
- adcp/client.py +11 -9
- adcp/simple.py +1 -1
- adcp/types/__init__.py +479 -30
- adcp/types/_generated.py +15 -9
- adcp/types/aliases.py +257 -20
- adcp/types/generated_poc/adagents.py +34 -77
- adcp/types/generated_poc/product.py +9 -76
- adcp/types/generated_poc/publisher_property_selector.py +81 -0
- adcp/types/stable.py +282 -5
- adcp/utils/preview_cache.py +7 -7
- {adcp-2.6.0.dist-info → adcp-2.8.0.dist-info}/METADATA +1 -1
- {adcp-2.6.0.dist-info → adcp-2.8.0.dist-info}/RECORD +17 -16
- {adcp-2.6.0.dist-info → adcp-2.8.0.dist-info}/WHEEL +0 -0
- {adcp-2.6.0.dist-info → adcp-2.8.0.dist-info}/entry_points.txt +0 -0
- {adcp-2.6.0.dist-info → adcp-2.8.0.dist-info}/licenses/LICENSE +0 -0
- {adcp-2.6.0.dist-info → adcp-2.8.0.dist-info}/top_level.txt +0 -0
adcp/types/aliases.py
CHANGED
|
@@ -31,7 +31,6 @@ immediately rather than at runtime when users try to use the aliases.
|
|
|
31
31
|
|
|
32
32
|
from __future__ import annotations
|
|
33
33
|
|
|
34
|
-
# Import all generated types that need semantic aliases
|
|
35
34
|
from adcp.types._generated import (
|
|
36
35
|
# Activation responses
|
|
37
36
|
ActivateSignalResponse1,
|
|
@@ -39,6 +38,11 @@ from adcp.types._generated import (
|
|
|
39
38
|
# Activation keys
|
|
40
39
|
ActivationKey1,
|
|
41
40
|
ActivationKey2,
|
|
41
|
+
# Authorized agents
|
|
42
|
+
AuthorizedAgents,
|
|
43
|
+
AuthorizedAgents1,
|
|
44
|
+
AuthorizedAgents2,
|
|
45
|
+
AuthorizedAgents3,
|
|
42
46
|
# Build creative responses
|
|
43
47
|
BuildCreativeResponse1,
|
|
44
48
|
BuildCreativeResponse2,
|
|
@@ -64,6 +68,9 @@ from adcp.types._generated import (
|
|
|
64
68
|
PreviewRender1,
|
|
65
69
|
PreviewRender2,
|
|
66
70
|
PreviewRender3,
|
|
71
|
+
# Publisher properties types
|
|
72
|
+
PropertyId,
|
|
73
|
+
PropertyTag,
|
|
67
74
|
# Performance feedback responses
|
|
68
75
|
ProvidePerformanceFeedbackResponse1,
|
|
69
76
|
ProvidePerformanceFeedbackResponse2,
|
|
@@ -83,26 +90,23 @@ from adcp.types._generated import (
|
|
|
83
90
|
VastAsset1,
|
|
84
91
|
VastAsset2,
|
|
85
92
|
)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
from adcp.types.generated_poc.create_media_buy_response import (
|
|
89
|
-
Package as CreatedPackageInternal,
|
|
93
|
+
from adcp.types._generated import (
|
|
94
|
+
PublisherPropertySelector1 as PublisherPropertiesInternal,
|
|
90
95
|
)
|
|
91
|
-
from adcp.types.
|
|
92
|
-
|
|
93
|
-
# Import PublisherProperties types and related types from product module
|
|
94
|
-
from adcp.types.generated_poc.product import (
|
|
95
|
-
PropertyId,
|
|
96
|
-
PropertyTag,
|
|
96
|
+
from adcp.types._generated import (
|
|
97
|
+
PublisherPropertySelector2 as PublisherPropertiesByIdInternal,
|
|
97
98
|
)
|
|
98
|
-
from adcp.types.
|
|
99
|
-
|
|
99
|
+
from adcp.types._generated import (
|
|
100
|
+
PublisherPropertySelector3 as PublisherPropertiesByTagInternal,
|
|
100
101
|
)
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
|
|
103
|
+
# Import all generated types that need semantic aliases
|
|
104
|
+
from adcp.types._generated import (
|
|
105
|
+
# Package types (from name collision resolution)
|
|
106
|
+
_PackageFromCreateMediaBuyResponse as CreatedPackageInternal,
|
|
103
107
|
)
|
|
104
|
-
from adcp.types.
|
|
105
|
-
|
|
108
|
+
from adcp.types._generated import (
|
|
109
|
+
_PackageFromPackage as FullPackageInternal,
|
|
106
110
|
)
|
|
107
111
|
|
|
108
112
|
# ============================================================================
|
|
@@ -480,6 +484,226 @@ Example:
|
|
|
480
484
|
```
|
|
481
485
|
"""
|
|
482
486
|
|
|
487
|
+
# ============================================================================
|
|
488
|
+
# AUTHORIZED AGENTS ALIASES - Authorization Type Discriminated Unions
|
|
489
|
+
# ============================================================================
|
|
490
|
+
# The AdCP adagents.json schema defines AuthorizedAgents as a discriminated
|
|
491
|
+
# union with four variants based on the `authorization_type` field:
|
|
492
|
+
#
|
|
493
|
+
# 1. Property IDs (authorization_type='property_ids'):
|
|
494
|
+
# - Agent authorized for specific property IDs
|
|
495
|
+
# - Requires property_ids array
|
|
496
|
+
#
|
|
497
|
+
# 2. Property Tags (authorization_type='property_tags'):
|
|
498
|
+
# - Agent authorized for properties matching tags
|
|
499
|
+
# - Requires property_tags array
|
|
500
|
+
#
|
|
501
|
+
# 3. Inline Properties (authorization_type='inline_properties'):
|
|
502
|
+
# - Agent authorized with inline property definitions
|
|
503
|
+
# - Requires properties array with full Property objects
|
|
504
|
+
#
|
|
505
|
+
# 4. Publisher Properties (authorization_type='publisher_properties'):
|
|
506
|
+
# - Agent authorized for properties from other publisher domains
|
|
507
|
+
# - Requires publisher_properties array
|
|
508
|
+
#
|
|
509
|
+
# These define which sales agents are authorized to sell inventory and which
|
|
510
|
+
# properties they can access.
|
|
511
|
+
|
|
512
|
+
AuthorizedAgentsByPropertyId = AuthorizedAgents
|
|
513
|
+
"""Authorized agent with specific property IDs.
|
|
514
|
+
|
|
515
|
+
This variant uses authorization_type='property_ids' for agents authorized
|
|
516
|
+
to sell specific properties identified by their IDs.
|
|
517
|
+
|
|
518
|
+
Fields:
|
|
519
|
+
- authorization_type: Literal['property_ids']
|
|
520
|
+
- authorized_for: Human-readable description
|
|
521
|
+
- property_ids: List of PropertyId (non-empty)
|
|
522
|
+
- url: Agent's API endpoint URL
|
|
523
|
+
|
|
524
|
+
Example:
|
|
525
|
+
```python
|
|
526
|
+
from adcp.types.aliases import AuthorizedAgentsByPropertyId, PropertyId
|
|
527
|
+
|
|
528
|
+
agent = AuthorizedAgentsByPropertyId(
|
|
529
|
+
authorization_type="property_ids",
|
|
530
|
+
authorized_for="Premium display inventory",
|
|
531
|
+
property_ids=[PropertyId("homepage"), PropertyId("sports")],
|
|
532
|
+
url="https://agent.example.com"
|
|
533
|
+
)
|
|
534
|
+
```
|
|
535
|
+
"""
|
|
536
|
+
|
|
537
|
+
AuthorizedAgentsByPropertyTag = AuthorizedAgents1
|
|
538
|
+
"""Authorized agent with property tags.
|
|
539
|
+
|
|
540
|
+
This variant uses authorization_type='property_tags' for agents authorized
|
|
541
|
+
to sell properties identified by matching tags.
|
|
542
|
+
|
|
543
|
+
Fields:
|
|
544
|
+
- authorization_type: Literal['property_tags']
|
|
545
|
+
- authorized_for: Human-readable description
|
|
546
|
+
- property_tags: List of PropertyTag (non-empty)
|
|
547
|
+
- url: Agent's API endpoint URL
|
|
548
|
+
|
|
549
|
+
Example:
|
|
550
|
+
```python
|
|
551
|
+
from adcp.types.aliases import AuthorizedAgentsByPropertyTag, PropertyTag
|
|
552
|
+
|
|
553
|
+
agent = AuthorizedAgentsByPropertyTag(
|
|
554
|
+
authorization_type="property_tags",
|
|
555
|
+
authorized_for="Video inventory",
|
|
556
|
+
property_tags=[PropertyTag("video"), PropertyTag("premium")],
|
|
557
|
+
url="https://agent.example.com"
|
|
558
|
+
)
|
|
559
|
+
```
|
|
560
|
+
"""
|
|
561
|
+
|
|
562
|
+
AuthorizedAgentsByInlineProperties = AuthorizedAgents2
|
|
563
|
+
"""Authorized agent with inline property definitions.
|
|
564
|
+
|
|
565
|
+
This variant uses authorization_type='inline_properties' for agents with
|
|
566
|
+
inline Property objects rather than references to the top-level properties array.
|
|
567
|
+
|
|
568
|
+
Fields:
|
|
569
|
+
- authorization_type: Literal['inline_properties']
|
|
570
|
+
- authorized_for: Human-readable description
|
|
571
|
+
- properties: List of Property objects (non-empty)
|
|
572
|
+
- url: Agent's API endpoint URL
|
|
573
|
+
|
|
574
|
+
Example:
|
|
575
|
+
```python
|
|
576
|
+
from adcp.types.aliases import AuthorizedAgentsByInlineProperties
|
|
577
|
+
from adcp.types.stable import Property
|
|
578
|
+
|
|
579
|
+
agent = AuthorizedAgentsByInlineProperties(
|
|
580
|
+
authorization_type="inline_properties",
|
|
581
|
+
authorized_for="Custom inventory bundle",
|
|
582
|
+
properties=[...], # Full Property objects
|
|
583
|
+
url="https://agent.example.com"
|
|
584
|
+
)
|
|
585
|
+
```
|
|
586
|
+
"""
|
|
587
|
+
|
|
588
|
+
AuthorizedAgentsByPublisherProperties = AuthorizedAgents3
|
|
589
|
+
"""Authorized agent for properties from other publishers.
|
|
590
|
+
|
|
591
|
+
This variant uses authorization_type='publisher_properties' for agents
|
|
592
|
+
authorized to sell inventory from other publisher domains.
|
|
593
|
+
|
|
594
|
+
Fields:
|
|
595
|
+
- authorization_type: Literal['publisher_properties']
|
|
596
|
+
- authorized_for: Human-readable description
|
|
597
|
+
- publisher_properties: List of PublisherPropertySelector variants (non-empty)
|
|
598
|
+
- url: Agent's API endpoint URL
|
|
599
|
+
|
|
600
|
+
Example:
|
|
601
|
+
```python
|
|
602
|
+
from adcp.types.aliases import (
|
|
603
|
+
AuthorizedAgentsByPublisherProperties,
|
|
604
|
+
PublisherPropertiesAll
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
agent = AuthorizedAgentsByPublisherProperties(
|
|
608
|
+
authorization_type="publisher_properties",
|
|
609
|
+
authorized_for="Network inventory across publishers",
|
|
610
|
+
publisher_properties=[
|
|
611
|
+
PublisherPropertiesAll(
|
|
612
|
+
publisher_domain="publisher1.com",
|
|
613
|
+
selection_type="all"
|
|
614
|
+
)
|
|
615
|
+
],
|
|
616
|
+
url="https://agent.example.com"
|
|
617
|
+
)
|
|
618
|
+
```
|
|
619
|
+
"""
|
|
620
|
+
|
|
621
|
+
# ============================================================================
|
|
622
|
+
# UNION TYPE ALIASES - For Type Hints and Pattern Matching
|
|
623
|
+
# ============================================================================
|
|
624
|
+
# These union aliases provide convenient types for function signatures,
|
|
625
|
+
# type hints, and pattern matching without having to manually construct
|
|
626
|
+
# the union each time.
|
|
627
|
+
|
|
628
|
+
# Deployment union (for signals)
|
|
629
|
+
Deployment = PlatformDeployment | AgentDeployment
|
|
630
|
+
"""Union type for all deployment variants.
|
|
631
|
+
|
|
632
|
+
Use this for type hints when a function accepts any deployment type:
|
|
633
|
+
|
|
634
|
+
Example:
|
|
635
|
+
```python
|
|
636
|
+
def process_deployment(deployment: Deployment) -> None:
|
|
637
|
+
if isinstance(deployment, PlatformDeployment):
|
|
638
|
+
print(f"Platform: {deployment.platform}")
|
|
639
|
+
elif isinstance(deployment, AgentDeployment):
|
|
640
|
+
print(f"Agent: {deployment.agent_url}")
|
|
641
|
+
```
|
|
642
|
+
"""
|
|
643
|
+
|
|
644
|
+
# Destination union (for signals)
|
|
645
|
+
Destination = PlatformDestination | AgentDestination
|
|
646
|
+
"""Union type for all destination variants.
|
|
647
|
+
|
|
648
|
+
Use this for type hints when a function accepts any destination type:
|
|
649
|
+
|
|
650
|
+
Example:
|
|
651
|
+
```python
|
|
652
|
+
def format_destination(dest: Destination) -> str:
|
|
653
|
+
if isinstance(dest, PlatformDestination):
|
|
654
|
+
return f"Platform: {dest.platform}"
|
|
655
|
+
elif isinstance(dest, AgentDestination):
|
|
656
|
+
return f"Agent: {dest.agent_url}"
|
|
657
|
+
```
|
|
658
|
+
"""
|
|
659
|
+
|
|
660
|
+
# Authorized agent union (for adagents.json)
|
|
661
|
+
AuthorizedAgent = (
|
|
662
|
+
AuthorizedAgentsByPropertyId
|
|
663
|
+
| AuthorizedAgentsByPropertyTag
|
|
664
|
+
| AuthorizedAgentsByInlineProperties
|
|
665
|
+
| AuthorizedAgentsByPublisherProperties
|
|
666
|
+
)
|
|
667
|
+
"""Union type for all authorized agent variants.
|
|
668
|
+
|
|
669
|
+
Use this for type hints when processing agents from adagents.json:
|
|
670
|
+
|
|
671
|
+
Example:
|
|
672
|
+
```python
|
|
673
|
+
def validate_agent(agent: AuthorizedAgent) -> bool:
|
|
674
|
+
match agent.authorization_type:
|
|
675
|
+
case "property_ids":
|
|
676
|
+
return len(agent.property_ids) > 0
|
|
677
|
+
case "property_tags":
|
|
678
|
+
return len(agent.property_tags) > 0
|
|
679
|
+
case "inline_properties":
|
|
680
|
+
return len(agent.properties) > 0
|
|
681
|
+
case "publisher_properties":
|
|
682
|
+
return len(agent.publisher_properties) > 0
|
|
683
|
+
```
|
|
684
|
+
"""
|
|
685
|
+
|
|
686
|
+
# Publisher properties union (for product requests)
|
|
687
|
+
PublisherProperties = (
|
|
688
|
+
PublisherPropertiesAll | PublisherPropertiesById | PublisherPropertiesByTag
|
|
689
|
+
)
|
|
690
|
+
"""Union type for all publisher properties variants.
|
|
691
|
+
|
|
692
|
+
Use this for type hints in product filtering:
|
|
693
|
+
|
|
694
|
+
Example:
|
|
695
|
+
```python
|
|
696
|
+
def filter_products(props: PublisherProperties) -> None:
|
|
697
|
+
match props.selection_type:
|
|
698
|
+
case "all":
|
|
699
|
+
print("All properties from publisher")
|
|
700
|
+
case "by_id":
|
|
701
|
+
print(f"Properties: {props.property_ids}")
|
|
702
|
+
case "by_tag":
|
|
703
|
+
print(f"Tags: {props.property_tags}")
|
|
704
|
+
```
|
|
705
|
+
"""
|
|
706
|
+
|
|
483
707
|
# ============================================================================
|
|
484
708
|
# EXPORTS
|
|
485
709
|
# ============================================================================
|
|
@@ -501,6 +725,13 @@ __all__ = [
|
|
|
501
725
|
"UrlDaastAsset",
|
|
502
726
|
"UrlPreviewRender",
|
|
503
727
|
"UrlVastAsset",
|
|
728
|
+
# Authorized agent variants
|
|
729
|
+
"AuthorizedAgentsByPropertyId",
|
|
730
|
+
"AuthorizedAgentsByPropertyTag",
|
|
731
|
+
"AuthorizedAgentsByInlineProperties",
|
|
732
|
+
"AuthorizedAgentsByPublisherProperties",
|
|
733
|
+
# Authorized agent union
|
|
734
|
+
"AuthorizedAgent",
|
|
504
735
|
# Build creative responses
|
|
505
736
|
"BuildCreativeSuccessResponse",
|
|
506
737
|
"BuildCreativeErrorResponse",
|
|
@@ -531,14 +762,20 @@ __all__ = [
|
|
|
531
762
|
# Publisher properties types
|
|
532
763
|
"PropertyId",
|
|
533
764
|
"PropertyTag",
|
|
534
|
-
# Publisher properties
|
|
765
|
+
# Publisher properties variants
|
|
535
766
|
"PublisherPropertiesAll",
|
|
536
767
|
"PublisherPropertiesById",
|
|
537
768
|
"PublisherPropertiesByTag",
|
|
538
|
-
#
|
|
769
|
+
# Publisher properties union
|
|
770
|
+
"PublisherProperties",
|
|
771
|
+
# Deployment variants
|
|
539
772
|
"PlatformDeployment",
|
|
540
773
|
"AgentDeployment",
|
|
541
|
-
#
|
|
774
|
+
# Deployment union
|
|
775
|
+
"Deployment",
|
|
776
|
+
# Destination variants
|
|
542
777
|
"PlatformDestination",
|
|
543
778
|
"AgentDestination",
|
|
779
|
+
# Destination union
|
|
780
|
+
"Destination",
|
|
544
781
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
2
|
# filename: adagents.json
|
|
3
|
-
# timestamp: 2025-11-
|
|
3
|
+
# timestamp: 2025-11-19T02:02:39+00:00
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
@@ -9,7 +9,7 @@ from typing import Annotated, Literal
|
|
|
9
9
|
from adcp.types.base import AdCPBaseModel
|
|
10
10
|
from pydantic import AnyUrl, AwareDatetime, ConfigDict, EmailStr, Field, RootModel
|
|
11
11
|
|
|
12
|
-
from . import property
|
|
12
|
+
from . import property, publisher_property_selector
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
class PropertyId(RootModel[str]):
|
|
@@ -72,81 +72,6 @@ class AuthorizedAgents1(AdCPBaseModel):
|
|
|
72
72
|
url: Annotated[AnyUrl, Field(description="The authorized agent's API endpoint URL")]
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
class PublisherProperties(AdCPBaseModel):
|
|
76
|
-
model_config = ConfigDict(
|
|
77
|
-
extra='forbid',
|
|
78
|
-
)
|
|
79
|
-
property_ids: Annotated[
|
|
80
|
-
list[PropertyId],
|
|
81
|
-
Field(
|
|
82
|
-
description="Specific property IDs from the publisher's adagents.json properties array",
|
|
83
|
-
min_length=1,
|
|
84
|
-
),
|
|
85
|
-
]
|
|
86
|
-
publisher_domain: Annotated[
|
|
87
|
-
str,
|
|
88
|
-
Field(
|
|
89
|
-
description="Domain where the publisher's adagents.json is hosted (e.g., 'cnn.com')",
|
|
90
|
-
pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
|
|
91
|
-
),
|
|
92
|
-
]
|
|
93
|
-
selection_type: Annotated[
|
|
94
|
-
Literal['by_id'],
|
|
95
|
-
Field(description='Discriminator indicating selection by specific property IDs'),
|
|
96
|
-
]
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
class PublisherProperties1(AdCPBaseModel):
|
|
100
|
-
model_config = ConfigDict(
|
|
101
|
-
extra='forbid',
|
|
102
|
-
)
|
|
103
|
-
property_tags: Annotated[
|
|
104
|
-
list[PropertyTag],
|
|
105
|
-
Field(
|
|
106
|
-
description="Property tags from the publisher's adagents.json tags. Agent is authorized for all properties with these tags",
|
|
107
|
-
min_length=1,
|
|
108
|
-
),
|
|
109
|
-
]
|
|
110
|
-
publisher_domain: Annotated[
|
|
111
|
-
str,
|
|
112
|
-
Field(
|
|
113
|
-
description="Domain where the publisher's adagents.json is hosted (e.g., 'cnn.com')",
|
|
114
|
-
pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
|
|
115
|
-
),
|
|
116
|
-
]
|
|
117
|
-
selection_type: Annotated[
|
|
118
|
-
Literal['by_tag'], Field(description='Discriminator indicating selection by property tags')
|
|
119
|
-
]
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
class AuthorizedAgents3(AdCPBaseModel):
|
|
123
|
-
model_config = ConfigDict(
|
|
124
|
-
extra='forbid',
|
|
125
|
-
)
|
|
126
|
-
authorization_type: Annotated[
|
|
127
|
-
Literal['publisher_properties'],
|
|
128
|
-
Field(
|
|
129
|
-
description='Discriminator indicating authorization for properties from other publisher domains'
|
|
130
|
-
),
|
|
131
|
-
]
|
|
132
|
-
authorized_for: Annotated[
|
|
133
|
-
str,
|
|
134
|
-
Field(
|
|
135
|
-
description='Human-readable description of what this agent is authorized to sell',
|
|
136
|
-
max_length=500,
|
|
137
|
-
min_length=1,
|
|
138
|
-
),
|
|
139
|
-
]
|
|
140
|
-
publisher_properties: Annotated[
|
|
141
|
-
list[PublisherProperties | PublisherProperties1],
|
|
142
|
-
Field(
|
|
143
|
-
description='Properties from other publisher domains this agent is authorized for. Each entry specifies a publisher domain and which of their properties this agent can sell',
|
|
144
|
-
min_length=1,
|
|
145
|
-
),
|
|
146
|
-
]
|
|
147
|
-
url: Annotated[AnyUrl, Field(description="The authorized agent's API endpoint URL")]
|
|
148
|
-
|
|
149
|
-
|
|
150
75
|
class Contact(AdCPBaseModel):
|
|
151
76
|
model_config = ConfigDict(
|
|
152
77
|
extra='forbid',
|
|
@@ -226,6 +151,38 @@ class AuthorizedAgents2(AdCPBaseModel):
|
|
|
226
151
|
url: Annotated[AnyUrl, Field(description="The authorized agent's API endpoint URL")]
|
|
227
152
|
|
|
228
153
|
|
|
154
|
+
class AuthorizedAgents3(AdCPBaseModel):
|
|
155
|
+
model_config = ConfigDict(
|
|
156
|
+
extra='forbid',
|
|
157
|
+
)
|
|
158
|
+
authorization_type: Annotated[
|
|
159
|
+
Literal['publisher_properties'],
|
|
160
|
+
Field(
|
|
161
|
+
description='Discriminator indicating authorization for properties from other publisher domains'
|
|
162
|
+
),
|
|
163
|
+
]
|
|
164
|
+
authorized_for: Annotated[
|
|
165
|
+
str,
|
|
166
|
+
Field(
|
|
167
|
+
description='Human-readable description of what this agent is authorized to sell',
|
|
168
|
+
max_length=500,
|
|
169
|
+
min_length=1,
|
|
170
|
+
),
|
|
171
|
+
]
|
|
172
|
+
publisher_properties: Annotated[
|
|
173
|
+
list[
|
|
174
|
+
publisher_property_selector.PublisherPropertySelector1
|
|
175
|
+
| publisher_property_selector.PublisherPropertySelector2
|
|
176
|
+
| publisher_property_selector.PublisherPropertySelector3
|
|
177
|
+
],
|
|
178
|
+
Field(
|
|
179
|
+
description='Properties from other publisher domains this agent is authorized for. Each entry specifies a publisher domain and which of their properties this agent can sell',
|
|
180
|
+
min_length=1,
|
|
181
|
+
),
|
|
182
|
+
]
|
|
183
|
+
url: Annotated[AnyUrl, Field(description="The authorized agent's API endpoint URL")]
|
|
184
|
+
|
|
185
|
+
|
|
229
186
|
class AuthorizedSalesAgents(AdCPBaseModel):
|
|
230
187
|
model_config = ConfigDict(
|
|
231
188
|
extra='forbid',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
2
|
# filename: product.json
|
|
3
|
-
# timestamp: 2025-11-
|
|
3
|
+
# timestamp: 2025-11-19T02:02:39+00:00
|
|
4
4
|
|
|
5
5
|
from __future__ import annotations
|
|
6
6
|
|
|
7
|
-
from typing import Annotated, Any
|
|
7
|
+
from typing import Annotated, Any
|
|
8
8
|
|
|
9
9
|
from adcp.types.base import AdCPBaseModel
|
|
10
|
-
from pydantic import AwareDatetime, ConfigDict, Field
|
|
10
|
+
from pydantic import AwareDatetime, ConfigDict, Field
|
|
11
11
|
|
|
12
12
|
from . import cpc_option, cpcv_option, cpm_auction_option, cpm_fixed_option, cpp_option, cpv_option
|
|
13
13
|
from . import creative_policy as creative_policy_1
|
|
@@ -15,7 +15,7 @@ from . import delivery_type as delivery_type_1
|
|
|
15
15
|
from . import flat_rate_option
|
|
16
16
|
from . import format_id as format_id_1
|
|
17
17
|
from . import measurement as measurement_1
|
|
18
|
-
from . import placement
|
|
18
|
+
from . import placement, publisher_property_selector
|
|
19
19
|
from . import reporting_capabilities as reporting_capabilities_1
|
|
20
20
|
from . import vcpm_auction_option, vcpm_fixed_option
|
|
21
21
|
|
|
@@ -69,77 +69,6 @@ class ProductCardDetailed(AdCPBaseModel):
|
|
|
69
69
|
]
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
class PublisherProperties(AdCPBaseModel):
|
|
73
|
-
model_config = ConfigDict(
|
|
74
|
-
extra='forbid',
|
|
75
|
-
)
|
|
76
|
-
publisher_domain: Annotated[
|
|
77
|
-
str,
|
|
78
|
-
Field(
|
|
79
|
-
description="Domain where publisher's adagents.json is hosted (e.g., 'cnn.com')",
|
|
80
|
-
pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
|
|
81
|
-
),
|
|
82
|
-
]
|
|
83
|
-
selection_type: Annotated[
|
|
84
|
-
Literal['all'],
|
|
85
|
-
Field(
|
|
86
|
-
description='Discriminator indicating all properties from this publisher are included'
|
|
87
|
-
),
|
|
88
|
-
]
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
class PropertyId(RootModel[str]):
|
|
92
|
-
root: Annotated[str, Field(pattern='^[a-z0-9_]+$')]
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
class PublisherProperties4(AdCPBaseModel):
|
|
96
|
-
model_config = ConfigDict(
|
|
97
|
-
extra='forbid',
|
|
98
|
-
)
|
|
99
|
-
property_ids: Annotated[
|
|
100
|
-
list[PropertyId],
|
|
101
|
-
Field(description="Specific property IDs from the publisher's adagents.json", min_length=1),
|
|
102
|
-
]
|
|
103
|
-
publisher_domain: Annotated[
|
|
104
|
-
str,
|
|
105
|
-
Field(
|
|
106
|
-
description="Domain where publisher's adagents.json is hosted (e.g., 'cnn.com')",
|
|
107
|
-
pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
|
|
108
|
-
),
|
|
109
|
-
]
|
|
110
|
-
selection_type: Annotated[
|
|
111
|
-
Literal['by_id'],
|
|
112
|
-
Field(description='Discriminator indicating selection by specific property IDs'),
|
|
113
|
-
]
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
class PropertyTag(PropertyId):
|
|
117
|
-
pass
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
class PublisherProperties5(AdCPBaseModel):
|
|
121
|
-
model_config = ConfigDict(
|
|
122
|
-
extra='forbid',
|
|
123
|
-
)
|
|
124
|
-
property_tags: Annotated[
|
|
125
|
-
list[PropertyTag],
|
|
126
|
-
Field(
|
|
127
|
-
description="Property tags from the publisher's adagents.json. Product covers all properties with these tags",
|
|
128
|
-
min_length=1,
|
|
129
|
-
),
|
|
130
|
-
]
|
|
131
|
-
publisher_domain: Annotated[
|
|
132
|
-
str,
|
|
133
|
-
Field(
|
|
134
|
-
description="Domain where publisher's adagents.json is hosted (e.g., 'cnn.com')",
|
|
135
|
-
pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
|
|
136
|
-
),
|
|
137
|
-
]
|
|
138
|
-
selection_type: Annotated[
|
|
139
|
-
Literal['by_tag'], Field(description='Discriminator indicating selection by property tags')
|
|
140
|
-
]
|
|
141
|
-
|
|
142
|
-
|
|
143
72
|
class Product(AdCPBaseModel):
|
|
144
73
|
model_config = ConfigDict(
|
|
145
74
|
extra='forbid',
|
|
@@ -212,7 +141,11 @@ class Product(AdCPBaseModel):
|
|
|
212
141
|
] = None
|
|
213
142
|
product_id: Annotated[str, Field(description='Unique identifier for the product')]
|
|
214
143
|
publisher_properties: Annotated[
|
|
215
|
-
list[
|
|
144
|
+
list[
|
|
145
|
+
publisher_property_selector.PublisherPropertySelector1
|
|
146
|
+
| publisher_property_selector.PublisherPropertySelector2
|
|
147
|
+
| publisher_property_selector.PublisherPropertySelector3
|
|
148
|
+
],
|
|
216
149
|
Field(
|
|
217
150
|
description="Publisher properties covered by this product. Buyers fetch actual property definitions from each publisher's adagents.json and validate agent authorization. Selection patterns mirror the authorization patterns in adagents.json for consistency.",
|
|
218
151
|
min_length=1,
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# generated by datamodel-codegen:
|
|
2
|
+
# filename: publisher-property-selector.json
|
|
3
|
+
# timestamp: 2025-11-19T02:02:39+00:00
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import Annotated, Literal
|
|
8
|
+
|
|
9
|
+
from adcp.types.base import AdCPBaseModel
|
|
10
|
+
from pydantic import ConfigDict, Field, RootModel
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class PublisherPropertySelector1(AdCPBaseModel):
|
|
14
|
+
model_config = ConfigDict(
|
|
15
|
+
extra='forbid',
|
|
16
|
+
)
|
|
17
|
+
publisher_domain: Annotated[
|
|
18
|
+
str,
|
|
19
|
+
Field(
|
|
20
|
+
description="Domain where publisher's adagents.json is hosted (e.g., 'cnn.com')",
|
|
21
|
+
pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
|
|
22
|
+
),
|
|
23
|
+
]
|
|
24
|
+
selection_type: Annotated[
|
|
25
|
+
Literal['all'],
|
|
26
|
+
Field(
|
|
27
|
+
description='Discriminator indicating all properties from this publisher are included'
|
|
28
|
+
),
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class PropertyId(RootModel[str]):
|
|
33
|
+
root: Annotated[str, Field(pattern='^[a-z0-9_]+$')]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class PublisherPropertySelector2(AdCPBaseModel):
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
extra='forbid',
|
|
39
|
+
)
|
|
40
|
+
property_ids: Annotated[
|
|
41
|
+
list[PropertyId],
|
|
42
|
+
Field(description="Specific property IDs from the publisher's adagents.json", min_length=1),
|
|
43
|
+
]
|
|
44
|
+
publisher_domain: Annotated[
|
|
45
|
+
str,
|
|
46
|
+
Field(
|
|
47
|
+
description="Domain where publisher's adagents.json is hosted (e.g., 'cnn.com')",
|
|
48
|
+
pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
|
|
49
|
+
),
|
|
50
|
+
]
|
|
51
|
+
selection_type: Annotated[
|
|
52
|
+
Literal['by_id'],
|
|
53
|
+
Field(description='Discriminator indicating selection by specific property IDs'),
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class PropertyTag(PropertyId):
|
|
58
|
+
pass
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class PublisherPropertySelector3(AdCPBaseModel):
|
|
62
|
+
model_config = ConfigDict(
|
|
63
|
+
extra='forbid',
|
|
64
|
+
)
|
|
65
|
+
property_tags: Annotated[
|
|
66
|
+
list[PropertyTag],
|
|
67
|
+
Field(
|
|
68
|
+
description="Property tags from the publisher's adagents.json. Selector covers all properties with these tags",
|
|
69
|
+
min_length=1,
|
|
70
|
+
),
|
|
71
|
+
]
|
|
72
|
+
publisher_domain: Annotated[
|
|
73
|
+
str,
|
|
74
|
+
Field(
|
|
75
|
+
description="Domain where publisher's adagents.json is hosted (e.g., 'cnn.com')",
|
|
76
|
+
pattern='^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$',
|
|
77
|
+
),
|
|
78
|
+
]
|
|
79
|
+
selection_type: Annotated[
|
|
80
|
+
Literal['by_tag'], Field(description='Discriminator indicating selection by property tags')
|
|
81
|
+
]
|