Module adcp.types.base
Classes
class AdCPBaseModel (**data: Any)-
Expand source code
class AdCPBaseModel(BaseModel): """Base model for AdCP types with spec-compliant serialization. AdCP JSON schemas use additionalProperties: false and do not allow null for optional fields. Therefore, optional fields must be omitted entirely when not present (not sent as null). """ def model_dump(self, **kwargs: Any) -> dict[str, Any]: if "exclude_none" not in kwargs: kwargs["exclude_none"] = True return super().model_dump(**kwargs) def model_dump_json(self, **kwargs: Any) -> str: if "exclude_none" not in kwargs: kwargs["exclude_none"] = True return super().model_dump_json(**kwargs)Base model for AdCP types with spec-compliant serialization.
AdCP JSON schemas use additionalProperties: false and do not allow null for optional fields. Therefore, optional fields must be omitted entirely when not present (not sent as null).
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.Ancestors
- pydantic.main.BaseModel
Subclasses
- ActivateSignalRequest
- ActivateSignalResponse1
- ActivateSignalResponse2
- ActivationKey1
- ActivationKey2
- AuthorizedAgents
- AuthorizedAgents1
- AuthorizedAgents2
- AuthorizedAgents3
- AuthorizedSalesAgents
- Contact
- PublisherProperties
- PublisherProperties1
- Tags
- AssetTypeSchema
- ContentLength
- Dimensions
- Duration
- FileSize
- Quality
- Requirements
- AudioAsset
- Asset
- BrandManifest
- Colors
- Contact
- Disclaimer
- Fonts
- Logo
- Metadata
- ProductCatalog
- BuildCreativeRequest
- BuildCreativeResponse1
- BuildCreativeResponse2
- CpcPricingOption
- CpcvPricingOption
- CpmAuctionPricingOption
- PriceGuidance
- CpmFixedRatePricingOption
- CppPricingOption
- Parameters
- CpvPricingOption
- Parameters
- ViewThreshold1
- CreateMediaBuyRequest
- CreateMediaBuyResponse1
- CreateMediaBuyResponse2
- Package
- CreativeAsset
- Input
- CreativeAssignment
- CreativeManifest
- CreativePolicy
- CssAsset
- DaastAsset1
- DaastAsset2
- DeliveryMetrics
- DoohMetrics
- QuartileData
- VenueBreakdownItem
- Deployment1
- Deployment2
- Destination1
- Destination2
- Error
- FlatRatePricingOption
- Parameters
- Asset
- AssetsRequired
- AssetsRequired1
- Dimensions
- Format
- FormatCard
- FormatCardDetailed
- Render
- Responsive
- FormatId
- FrequencyCap
- GetMediaBuyDeliveryRequest
- AggregatedTotals
- DailyBreakdownItem
- GetMediaBuyDeliveryResponse
- MediaBuyDelivery
- ReportingPeriod
- Filters
- GetProductsRequest
- GetProductsResponse
- DeliverTo
- Filters
- GetSignalsRequest
- GetSignalsResponse
- Pricing
- Signal
- HtmlAsset
- ImageAsset
- JavascriptAsset
- ListAuthorizedPropertiesRequest
- ListAuthorizedPropertiesResponse
- ListCreativeFormatsRequest
- CreativeAgent
- ListCreativeFormatsResponse
- Filters
- ListCreativesRequest
- Pagination
- Sort
- AssignedPackage
- Assignments
- Creative
- ListCreativesResponse
- Pagination
- Performance
- QuerySummary
- SortApplied
- StatusSummary
- MarkdownAsset
- Measurement
- MediaBuy
- Package
- PackageRequest
- MeasurementPeriod
- PerformanceFeedback
- Placement
- Input
- Input2
- PreviewCreativeRequest1
- PreviewCreativeRequest2
- Request
- Error
- Input
- Input4
- Preview
- Preview1
- PreviewCreativeResponse1
- PreviewCreativeResponse2
- Response
- Response1
- Results
- Results1
- Dimensions
- Embedding
- PreviewRender1
- PreviewRender2
- PreviewRender3
- DeliveryMeasurement
- Product
- ProductCard
- ProductCardDetailed
- PublisherProperties
- PublisherProperties4
- PublisherProperties5
- AssetSelectors
- Offering
- PromotedOfferings
- PromotedProducts
- Identifier
- Property
- ProtocolEnvelope
- MeasurementPeriod
- ProvidePerformanceFeedbackRequest
- ProvidePerformanceFeedbackResponse1
- ProvidePerformanceFeedbackResponse2
- Authentication
- PushNotificationConfig
- ReportingCapabilities
- ProtocolResponse
- SubAsset1
- SubAsset2
- SyncCreativesRequest
- Creative
- SyncCreativesResponse1
- SyncCreativesResponse2
- TargetingOverlay
- TasksGetRequest
- Details
- Error
- HistoryItem
- Progress
- TasksGetResponse
- Filters
- Pagination
- Sort
- TasksListRequest
- DomainBreakdown
- Pagination
- QuerySummary
- SortApplied
- Task
- TasksListResponse
- TextAsset
- Packages
- Packages1
- UpdateMediaBuyRequest1
- UpdateMediaBuyRequest2
- AffectedPackage
- UpdateMediaBuyResponse1
- UpdateMediaBuyResponse2
- UrlAsset
- VastAsset1
- VastAsset2
- PriceGuidance
- VcpmAuctionPricingOption
- VcpmFixedRatePricingOption
- VideoAsset
- Security
- WebhookAsset
- Progress
- WebhookPayload
Class variables
var model_config
Methods
def model_dump(self, **kwargs: Any) ‑> dict[str, typing.Any]-
Expand source code
def model_dump(self, **kwargs: Any) -> dict[str, Any]: if "exclude_none" not in kwargs: kwargs["exclude_none"] = True return super().model_dump(**kwargs)Usage Documentation
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
Args
mode- The mode in which
to_pythonshould run. If mode is 'json', the output will only contain JSON serializable types. If mode is 'python', the output may contain non-JSON-serializable Python objects. include- A set of fields to include in the output.
exclude- A set of fields to exclude from the output.
context- Additional context to pass to the serializer.
by_alias- Whether to use the field's alias in the dictionary key if defined.
exclude_unset- Whether to exclude fields that have not been explicitly set.
exclude_defaults- Whether to exclude fields that are set to their default value.
exclude_none- Whether to exclude fields that have a value of
None. exclude_computed_fields- Whether to exclude computed fields.
While this can be useful for round-tripping, it is usually recommended to use the dedicated
round_tripparameter instead. round_trip- If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings- How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,
"error" raises a [
PydanticSerializationError][pydantic_core.PydanticSerializationError]. fallback- A function to call when an unknown value is encountered. If not provided,
a [
PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised. serialize_as_any- Whether to serialize fields with duck-typing serialization behavior.
Returns
A dictionary representation of the model.
def model_dump_json(self, **kwargs: Any) ‑> str-
Expand source code
def model_dump_json(self, **kwargs: Any) -> str: if "exclude_none" not in kwargs: kwargs["exclude_none"] = True return super().model_dump_json(**kwargs)Usage Documentation
Generates a JSON representation of the model using Pydantic's
to_jsonmethod.Args
indent- Indentation to use in the JSON output. If None is passed, the output will be compact.
ensure_ascii- If
True, the output is guaranteed to have all incoming non-ASCII characters escaped. IfFalse(the default), these characters will be output as-is. include- Field(s) to include in the JSON output.
exclude- Field(s) to exclude from the JSON output.
context- Additional context to pass to the serializer.
by_alias- Whether to serialize using field aliases.
exclude_unset- Whether to exclude fields that have not been explicitly set.
exclude_defaults- Whether to exclude fields that are set to their default value.
exclude_none- Whether to exclude fields that have a value of
None. exclude_computed_fields- Whether to exclude computed fields.
While this can be useful for round-tripping, it is usually recommended to use the dedicated
round_tripparameter instead. round_trip- If True, dumped values should be valid as input for non-idempotent types such as Json[T].
warnings- How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,
"error" raises a [
PydanticSerializationError][pydantic_core.PydanticSerializationError]. fallback- A function to call when an unknown value is encountered. If not provided,
a [
PydanticSerializationError][pydantic_core.PydanticSerializationError] error is raised. serialize_as_any- Whether to serialize fields with duck-typing serialization behavior.
Returns
A JSON string representation of the model.