dm_mac.models.api_schemas module¶
Request and response models for API endpoint validation.
- class dm_mac.models.api_schemas.ApiIndexResponse(*, message: str)¶
Bases:
BaseModelResponse body for GET /api/.
- _abc_impl = <_abc._abc_data object>¶
- message: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dm_mac.models.api_schemas.ErrorResponse(*, error: str)¶
Bases:
BaseModelGeneric error response.
- _abc_impl = <_abc._abc_data object>¶
- error: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dm_mac.models.api_schemas.MachineStatus(*, name: str, display_name: str, status: str, relay: bool, oops: bool, locked_out: bool, current_user: MachineStatusUser | None = None, last_checkin: float | None = None, last_update: float | None = None)¶
Bases:
BaseModelCurrent status of a single machine.
Shared representation used by
GET /api/machinesand the status-change webhook (which addseventandtimestampfields).- _abc_impl = <_abc._abc_data object>¶
- current_user: MachineStatusUser | None¶
- display_name: str¶
- last_checkin: float | None¶
- last_update: float | None¶
- locked_out: bool¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str¶
- oops: bool¶
- relay: bool¶
- status: str¶
- class dm_mac.models.api_schemas.MachineStatusUser(*, account_id: str, full_name: str)¶
Bases:
BaseModelThe user currently logged in to a machine, if any.
- _abc_impl = <_abc._abc_data object>¶
- account_id: str¶
- full_name: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dm_mac.models.api_schemas.MachineUpdateRequest(*, machine_name: str, oops: bool, rfid_value: str, uptime: float, wifi_signal_db: float, wifi_signal_percent: float, internal_temperature_c: float, amps: float = 0.0, second_relay_state: bool | None = None)¶
Bases:
BaseModelRequest body for POST /api/machine/update.
- _abc_impl = <_abc._abc_data object>¶
- amps: float¶
- internal_temperature_c: float¶
- machine_name: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- oops: bool¶
- rfid_value: str¶
- second_relay_state: bool | None¶
- uptime: float¶
- wifi_signal_db: float¶
- wifi_signal_percent: float¶
- class dm_mac.models.api_schemas.MachineUpdateResponse(*, relay: bool, display: str, oops_led: bool, status_led_rgb: List[float], status_led_brightness: float, second_relay: bool = False)¶
Bases:
BaseModelResponse body for POST /api/machine/update (200).
- _abc_impl = <_abc._abc_data object>¶
- display: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- oops_led: bool¶
- relay: bool¶
- second_relay: bool¶
- status_led_brightness: float¶
- status_led_rgb: List[float]¶
- class dm_mac.models.api_schemas.MachinesListResponse(*, machines: List[MachineStatus])¶
Bases:
BaseModelResponse body for GET /api/machines (200).
- _abc_impl = <_abc._abc_data object>¶
- machines: List[MachineStatus]¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class dm_mac.models.api_schemas.ReloadUsersResponse(*, removed: int, updated: int, added: int)¶
Bases:
BaseModelResponse body for POST /api/reload-users (200).
- _abc_impl = <_abc._abc_data object>¶
- added: int¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- removed: int¶
- updated: int¶
- class dm_mac.models.api_schemas.StateSaveTimeoutResponse(*, error: str, action_applied: bool)¶
Bases:
BaseModel503 response body for the oops and locked_out endpoints when persisting machine state to disk exceeds
STATE_SAVE_TIMEOUT_SEC.The in-memory state mutation (and any fire-and-forget Slack notification) has already taken effect; only the pickle write timed out. The next successful save will catch up.
- _abc_impl = <_abc._abc_data object>¶
- action_applied: bool¶
- error: str¶
- model_config = {}¶
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].