Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions scripts/generate_models_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ class PreviewCreativeRequest(BaseModel):

# Output format (applies to both modes)
output_format: Literal["url", "html"] | None = Field(default="url", description="Output format: 'url' for iframe URLs, 'html' for direct embedding")

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

class PreviewCreativeResponse(BaseModel):
"""Response containing preview links for one or more creatives. Format matches the request: single preview response for single requests, batch results for batch requests."""
Expand All @@ -547,6 +547,7 @@ class PreviewCreativeResponse(BaseModel):

# Batch mode field
results: list[dict[str, Any]] | None = Field(default=None, description="Array of preview results for batch processing")
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


# ============================================================================
Expand All @@ -564,13 +565,13 @@ class ActivateSignalSuccess(BaseModel):
)
estimated_activation_duration_minutes: float | None = None
deployed_at: str | None = None

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

class ActivateSignalError(BaseModel):
"""Failed signal activation response"""

errors: list[Error] = Field(description="Task-specific errors and warnings")

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

# Override the generated ActivateSignalResponse type alias
ActivateSignalResponse = ActivateSignalSuccess | ActivateSignalError
Expand All @@ -588,12 +589,14 @@ class CreateMediaBuySuccess(BaseModel):
None,
description="ISO 8601 date when creatives must be provided for launch",
)
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


class CreateMediaBuyError(BaseModel):
"""Failed media buy creation response"""

errors: list[Error] = Field(description="Task-specific errors and warnings")
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


# Override the generated CreateMediaBuyResponse type alias
Expand All @@ -608,13 +611,14 @@ class UpdateMediaBuySuccess(BaseModel):
packages: list[Package] = Field(
description="Array of updated packages reflecting the changes"
)
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


class UpdateMediaBuyError(BaseModel):
"""Failed media buy update response"""

errors: list[Error] = Field(description="Task-specific errors and warnings")

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

# Override the generated UpdateMediaBuyResponse type alias
UpdateMediaBuyResponse = UpdateMediaBuySuccess | UpdateMediaBuyError
Expand All @@ -626,13 +630,14 @@ class SyncCreativesSuccess(BaseModel):
assignments: list[CreativeAssignment] = Field(
description="Array of creative assignments with updated status"
)
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


class SyncCreativesError(BaseModel):
"""Failed creative sync response"""

errors: list[Error] = Field(description="Task-specific errors and warnings")

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

# Override the generated SyncCreativesResponse type alias
SyncCreativesResponse = SyncCreativesSuccess | SyncCreativesError
Expand Down
15 changes: 10 additions & 5 deletions src/adcp/types/generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ class PreviewCreativeRequest(BaseModel):

# Output format (applies to both modes)
output_format: Literal["url", "html"] | None = Field(default="url", description="Output format: 'url' for iframe URLs, 'html' for direct embedding")

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

class PreviewCreativeResponse(BaseModel):
"""Response containing preview links for one or more creatives. Format matches the request: single preview response for single requests, batch results for batch requests."""
Expand All @@ -993,6 +993,7 @@ class PreviewCreativeResponse(BaseModel):

# Batch mode field
results: list[dict[str, Any]] | None = Field(default=None, description="Array of preview results for batch processing")
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


# ============================================================================
Expand All @@ -1010,13 +1011,13 @@ class ActivateSignalSuccess(BaseModel):
)
estimated_activation_duration_minutes: float | None = None
deployed_at: str | None = None

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

class ActivateSignalError(BaseModel):
"""Failed signal activation response"""

errors: list[Error] = Field(description="Task-specific errors and warnings")

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

# Override the generated ActivateSignalResponse type alias
ActivateSignalResponse = ActivateSignalSuccess | ActivateSignalError
Expand All @@ -1034,12 +1035,14 @@ class CreateMediaBuySuccess(BaseModel):
None,
description="ISO 8601 date when creatives must be provided for launch",
)
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


class CreateMediaBuyError(BaseModel):
"""Failed media buy creation response"""

errors: list[Error] = Field(description="Task-specific errors and warnings")
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


# Override the generated CreateMediaBuyResponse type alias
Expand All @@ -1054,13 +1057,14 @@ class UpdateMediaBuySuccess(BaseModel):
packages: list[Package] = Field(
description="Array of updated packages reflecting the changes"
)
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


class UpdateMediaBuyError(BaseModel):
"""Failed media buy update response"""

errors: list[Error] = Field(description="Task-specific errors and warnings")

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

# Override the generated UpdateMediaBuyResponse type alias
UpdateMediaBuyResponse = UpdateMediaBuySuccess | UpdateMediaBuyError
Expand All @@ -1072,13 +1076,14 @@ class SyncCreativesSuccess(BaseModel):
assignments: list[CreativeAssignment] = Field(
description="Array of creative assignments with updated status"
)
context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")


class SyncCreativesError(BaseModel):
"""Failed creative sync response"""

errors: list[Error] = Field(description="Task-specific errors and warnings")

context: dict[str, Any] | None = Field(None, description="Initiator-provided context echoed inside the task payload. Opaque metadata such as UI/session hints, correlation tokens, or tracking identifiers.")

# Override the generated SyncCreativesResponse type alias
SyncCreativesResponse = SyncCreativesSuccess | SyncCreativesError
Expand Down
7 changes: 6 additions & 1 deletion src/adcp/utils/preview_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ async def get_preview_data_for_manifest(

try:
request = PreviewCreativeRequest(
format_id=format_id, creative_manifest=manifest, inputs=None, template_id=None
format_id=format_id,
creative_manifest=manifest,
inputs=None,
template_id=None,
context=None
)
result = await self.creative_agent_client.preview_creative(request)

Expand Down Expand Up @@ -164,6 +168,7 @@ async def get_preview_data_batch(
batch_request = PreviewCreativeRequest(
requests=chunk_requests,
output_format=output_format, # type: ignore[arg-type]
context=None,
)
result = await self.creative_agent_client.preview_creative(batch_request)

Expand Down