Module adcp.types.domains.core.event

Classes

class Event (**data: Any)
Expand source code
class Event(AdCPBaseModel):
    model_config = ConfigDict(
        extra='allow',
    )
    event_id: Annotated[
        str,
        Field(
            description='Unique identifier for deduplication (scoped to event_type + event_source_id)',
            max_length=256,
            min_length=1,
        ),
    ]
    event_type: Annotated[event_type_1.EventType, Field(description='Standard event type')]
    event_time: Annotated[
        AwareDatetime, Field(description='ISO 8601 timestamp when the event occurred')
    ]
    user_match: Annotated[
        user_match_1.UserMatch | None,
        Field(description='User identifiers for attribution matching'),
    ] = None
    custom_data: Annotated[
        event_custom_data.EventCustomData | None,
        Field(description='Event-specific data (value, currency, items, etc.)'),
    ] = None
    action_source: Annotated[
        action_source_1.ActionSource | None, Field(description='Where the event originated')
    ] = None
    surface: Annotated[
        event_surface.EventSurface | None,
        Field(
            description='Optional structured surface context for the event, such as an owned channel, profile, feed, podcast, newsletter list, website, app, or store. Complements `action_source`; use it when optimization-relevant meaning would otherwise live only in platform-specific `ext` metadata.'
        ),
    ] = None
    event_source_url: Annotated[
        AnyUrl | None,
        Field(
            description="URL where the event occurred (required when action_source is 'website')"
        ),
    ] = None
    custom_event_name: Annotated[
        str | None, Field(description="Name for custom events (used when event_type is 'custom')")
    ] = None
    ext: ext_1.ExtensionObject | None = None

Base model for AdCP types with spec-compliant serialization.

Defaults to extra='ignore' so unknown fields from newer spec versions are silently dropped rather than causing validation errors. Generated types whose schemas set additionalProperties: true override this with extra='allow' in their own model_config.

Set ADCP_STRICT_VALIDATION=1 in the environment ("1", "true", "yes", "on" are accepted) to flip the default to extra='forbid'. Use this during spec upgrades to catch silently-dropped renamed fields in tests. See :func:_resolve_extra_policy.

Important

The env var is resolved once at module import time. Set it in your shell or CI environment before import adcp runs — mutating os.environ["ADCP_STRICT_VALIDATION"] after the first adcp import has no effect on already-imported model classes (they captured the policy at class-body evaluation).

Consumers who want per-model strict validation can override model_config on their subclass.

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.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var action_source : ActionSource | None
var custom_data : EventCustomData | None
var custom_event_name : str | None
var event_id : str
var event_source_url : pydantic.networks.AnyUrl | None
var event_time : pydantic.types.AwareDatetime
var event_type : EventType
var ext : ExtensionObject | None
var model_config
var surface : EventSurface | None
var user_match : UserMatch | None

Inherited members