Module adcp.types.domains.media_buy.change_term
Classes
class AllowedStatus (*args, **kwds)-
Expand source code
class AllowedStatus(StrEnum): pending_creatives = 'pending_creatives' pending_start = 'pending_start' active = 'active' paused = 'paused'Enum where members are also (and must be) strings
Ancestors
- enum.StrEnum
- builtins.str
- enum.ReprEnum
- enum.Enum
Class variables
var activevar pausedvar pending_creativesvar pending_start
class Condition (value: Any = <object object>, *, root: Any = <object object>)-
Expand source code
class Condition(ScalarStr): __slots__ = () _constraints = {'pattern': '^[A-Za-z0-9][A-Za-z0-9_.:-]{0,199}$'}A
strgenerated from a JSON Schema string root.Ancestors
- adcp.types._scalar.ScalarStr
- adcp.types._scalar._ScalarRoot
- builtins.str
class MediaBuyChangeTerm (**data: Any)-
Expand source code
class MediaBuyChangeTerm(AdCPBaseModel): model_config = ConfigDict( extra='forbid', ) term_id: Annotated[str, Field(pattern='^[A-Za-z0-9_.:-]+$')] action: canonical_media_buy_action.CanonicalMediaBuyActionName service_mode: canonical_media_buy_action_mode.CanonicalMediaBuyActionMode allowed_statuses: Annotated[ list[AllowedStatus] | None, Field( description='Non-terminal MediaBuy statuses in which this negotiated right may be exercised. When absent, the right applies in every non-terminal status where the canonical action itself is meaningful. This field describes contractual lifecycle scope; available_actions[] remains authoritative for the current instant.', min_length=1, ), ] = None processing_sla: Annotated[ sla_window.SlaWindow | None, Field( description='Binding elapsed-time acknowledgement and completion commitment. Sellers account for weekends and non-working periods when declaring the maximum.' ), ] = None conditions: Annotated[ list[Condition] | None, Field( description='Opaque stable condition identifiers defined by terms_ref or bilateral commercial documentation. Implementations compare identifiers; they MUST NOT execute or interpret them as instructions.', min_length=1, ), ] = None constraints: Annotated[ change_term_constraints.MediaBuyChangeTermConstraints | None, Field( description='Portable bounds that buyer and seller SDKs can preflight. Omission means no machine-readable bound was promised; opaque conditions remain unevaluated.' ), ] = None terms_ref: Annotated[ str | None, Field( description="Stable contract reference. Resolving it cannot expand the typed right and MUST use the caller's normal authenticated contract-document path, never ambient seller credentials.", max_length=1000, min_length=1, ), ] = None description: Annotated[ str | None, Field( description='Display-only summary; it cannot grant authority, add an action, or override typed fields.', max_length=1000, min_length=1, ), ] = None ext: ext_1.ExtensionObject | None = None @model_validator(mode='after') def _validate_constraint_action(self) -> MediaBuyChangeTerm: if self.constraints is None: return self kind = self.constraints.kind allowed = { 'budget': { 'increase_budget', 'decrease_budget', 'reallocate_budget', 'update_budget_allocation', 'update_spend_target', }, 'flight': {'extend_flight', 'shorten_flight', 'update_flight_dates'}, 'package_count': {'add_packages', 'remove_packages'}, 'effective_timing': {'pause', 'resume', 'cancel'}, } action = self.action.value if action not in allowed.get(kind, set()): raise ValueError('constraint kind is incompatible with action') return selfBase 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 setadditionalProperties: trueoverride this withextra='allow'in their ownmodel_config.Set
ADCP_STRICT_VALIDATION=1in the environment ("1","true","yes","on"are accepted) to flip the default toextra='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 adcpruns — mutatingos.environ["ADCP_STRICT_VALIDATION"]after the firstadcpimport 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_configon 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.selfis explicitly positional-only to allowselfas a field name.Ancestors
- AdCPBaseModel
- pydantic.main.BaseModel
Class variables
var action : CanonicalMediaBuyActionNamevar allowed_statuses : list[AllowedStatus] | Nonevar conditions : list[Condition] | Nonevar constraints : MediaBuyChangeTermConstraints1 | MediaBuyChangeTermConstraints2 | MediaBuyChangeTermConstraints3 | MediaBuyChangeTermConstraints4 | Nonevar description : str | Nonevar ext : ExtensionObject | Nonevar model_configvar processing_sla : SlaWindow | Nonevar service_mode : CanonicalMediaBuyActionModevar term_id : strvar terms_ref : str | None
Inherited members