| 1 |
|
| 2 |
|
| 3 |
import typing |
| 4 |
|
| 5 |
import pydantic |
| 6 |
import typing_extensions |
| 7 |
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel |
| 8 |
from ..core.serialization import FieldMetadata |
| 9 |
from .hook_dependencies import HookDependencies |
| 10 |
|
| 11 |
|
| 12 |
class Hook(UniversalBaseModel): |
| 13 |
trigger_id: typing_extensions.Annotated[ |
| 14 |
typing.Optional[str], |
| 15 |
FieldMetadata(alias="triggerId"), |
| 16 |
pydantic.Field(alias="triggerId", description="Trigger ID"), |
| 17 |
] = None |
| 18 |
""" |
| 19 |
Trigger ID |
| 20 |
""" |
| 21 |
|
| 22 |
id: typing.Optional[str] = pydantic.Field(default=None) |
| 23 |
""" |
| 24 |
ID of this hook. |
| 25 |
""" |
| 26 |
|
| 27 |
name: typing.Optional[str] = pydantic.Field(default=None) |
| 28 |
""" |
| 29 |
Name of this hook. |
| 30 |
""" |
| 31 |
|
| 32 |
enabled: typing.Optional[bool] = pydantic.Field(default=None) |
| 33 |
""" |
| 34 |
Whether this hook will be executed (true) or ignored (false). |
| 35 |
""" |
| 36 |
|
| 37 |
script: typing.Optional[str] = pydantic.Field(default=None) |
| 38 |
""" |
| 39 |
Code to be executed when this hook runs. |
| 40 |
""" |
| 41 |
|
| 42 |
dependencies: typing.Optional[HookDependencies] = None |
| 43 |
|
| 44 |
if IS_PYDANTIC_V2: |
| 45 |
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) |
| 46 |
else: |
| 47 |
|
| 48 |
class Config: |
| 49 |
frozen = True |
| 50 |
smart_union = True |
| 51 |
extra = pydantic.Extra.allow |