Module adcp.types.domains.media_buy.outcome_target

Classes

class Goal (**data: Any)
Expand source code
class Goal(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    kind: Literal['metric'] = 'metric'
    metric: Annotated[
        forecastable_metric.ForecastableMetric,
        Field(
            description='Delivery metric to plan for, in the same vocabulary forecast points report.'
        ),
    ]

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 kind : Literal['metric']
var metric : ForecastableMetric
var model_config

Inherited members

class Goal1 (**data: Any)
Expand source code
class Goal1(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    kind: Literal['event'] = 'event'
    event_type: Annotated[
        event_type_1.EventType,
        Field(
            description='Conversion event to plan for, in the same vocabulary forecast points report.'
        ),
    ]
    custom_event_name: Annotated[
        str | None,
        Field(
            description="Required when event_type is 'custom'. Platform-specific name for the custom event.",
            min_length=1,
        ),
    ] = 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 custom_event_name : str | None
var event_type : EventType
var kind : Literal['event']
var model_config

Inherited members

class OutcomeTarget (**data: Any)
Expand source code
class OutcomeTarget(AdCPBaseModel):
    model_config = ConfigDict(
        extra='forbid',
    )
    goal: Annotated[
        Goal | Goal1,
        Field(
            description='The outcome to plan against: a seller-tracked delivery metric or an advertiser conversion event.',
            discriminator='kind',
        ),
    ]
    volume: Annotated[
        StrictFloat | None,
        Field(
            description="Desired total volume of the goal's metric or event across the planned flight. Alone, the seller solves for budget and answers with total_budget_guidance and a forecast. With cost_per, the seller plans toward the volume at the cost: under a cap it SHOULD keep the buyer's amount and forecast the lower volume it can deliver, unless no volume can be planned at that amount; under a target the ask is plannable when the seller can forecast the volume around it.",
            gt=0.0,
        ),
    ] = None
    cost_per: outcome_target_cost_per.OutcomeTargetCostPer | None = None

    @model_validator(mode='after')
    def _require_schema_required_group(self) -> OutcomeTarget:
        # ``required`` asks whether the caller supplied the field, which is what
        # model_fields_set answers. An explicit null is a supplied value — on a
        # mutation input it is the command to clear — and a default the caller
        # never sent is not.
        for group in (('volume',), ('cost_per',),):
            if all(name in self.model_fields_set for name in group):
                return self
        raise ValueError(
            'OutcomeTarget requires at least one of these field groups: volume | cost_per'
        )

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 cost_per : OutcomeTargetCostPer | None
var goal : Goal | Goal1
var model_config
var volume : float | None

Inherited members