Base Models & Mixins
Base Models
- class ab.api.models.base.ABConnectBaseModel[source]
Root base class for all ABConnect models.
All fields use snake_case in Python with camelCase aliases for JSON serialization.
populate_by_name=Trueallows construction using either convention.- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.base.RequestModel[source]
Bases:
ABConnectBaseModelBase for outbound request bodies.
extra="forbid"catches typos and invalid fields at construction time.- model_config = {'alias_generator': <function _to_camel>, 'extra': 'forbid', 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.base.ResponseModel(**extra_data)[source]
Bases:
ABConnectBaseModelBase for inbound API response bodies.
extra="allow"keeps deserialization resilient when the API adds new fields. Unknown fields are stored inmodel_extraand alogger.warningis emitted for each one so drift is immediately visible.- Parameters:
extra_data (Any)
- model_config = {'alias_generator': <function _to_camel>, 'extra': 'allow', 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_post_init(_ResponseModel__context)[source]
Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.
- Parameters:
_ResponseModel__context (Any)
- Return type:
None
Design Notes
RequestModel uses
extra="forbid"— unknown fields cause a validation errorResponseModel uses
extra="allow"— unknown fields are stored inmodel_extraand logged as warnings (drift detection)All models use
populate_by_name=Trueandalias_generator=to_camelfor camelCase JSON interop
Mixins
- class ab.api.models.mixins.IdentifiedModel(*, id=None)[source]
Mixin for models with an
idfield.- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.mixins.TimestampedModel(*, createdDate=None, modifiedDate=None, createdBy=None, modifiedBy=None)[source]
Mixin for models with created/modified audit timestamps.
- Parameters:
- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.mixins.ActiveModel(*, isActive=None)[source]
Mixin for models with an
is_activeflag.- Parameters:
isActive (bool | None)
- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.mixins.CompanyRelatedModel(*, companyId=None, companyName=None)[source]
Mixin for models associated with a company.
- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.mixins.JobRelatedModel(*, jobId=None)[source]
Mixin for models associated with a job.
- Parameters:
jobId (str | None)
- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.mixins.FullAuditModel(*, isActive=None, createdDate=None, modifiedDate=None, createdBy=None, modifiedBy=None, id=None)[source]
Bases:
IdentifiedModel,TimestampedModel,ActiveModelID + timestamps + active status.
- Parameters:
- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.mixins.CompanyAuditModel(*, companyId=None, companyName=None, isActive=None, createdDate=None, modifiedDate=None, createdBy=None, modifiedBy=None, id=None)[source]
Bases:
FullAuditModel,CompanyRelatedModelFull audit trail + company association.
- Parameters:
- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ab.api.models.mixins.JobAuditModel(*, jobId=None, isActive=None, createdDate=None, modifiedDate=None, createdBy=None, modifiedBy=None, id=None)[source]
Bases:
FullAuditModel,JobRelatedModelFull audit trail + job association.
- Parameters:
- model_config = {'alias_generator': <function _to_camel>, 'populate_by_name': True, 'str_strip_whitespace': True, 'use_enum_values': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].