cremalink.local_server_app.models module

This module defines the Pydantic data models used for API request and response validation in the local server application. These models ensure type safety and clear contracts for the API endpoints.

class cremalink.local_server_app.models.CommandPollResponse(*, enc: str, sign: str, seq: int)[source]

Bases: BaseModel

Model for the response when polling for a command result from the device. It includes the encrypted response, a signature, and a sequence number.

enc: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

seq: int
sign: str
class cremalink.local_server_app.models.CommandRequest(*, command: str)[source]

Bases: BaseModel

Model for the /command endpoint request body.

command: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cremalink.local_server_app.models.ConfigureRequest(*, dsn: str, device_ip: str, lan_key: str, device_scheme: str = 'https', monitor_property_name: str | None = None)[source]

Bases: BaseModel

Model for the /configure endpoint request body. It contains all the necessary information to establish a connection with a local device.

device_ip: str
device_scheme: str
dsn: str
lan_key: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

monitor_property_name: str | None
class cremalink.local_server_app.models.EncPayload(*, enc: str)[source]

Bases: BaseModel

A generic model for a payload that contains encrypted data (enc).

enc: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cremalink.local_server_app.models.KeyExchange(*, random_1: str, time_1: str | int)[source]

Bases: BaseModel

Represents the data payload for the key exchange process, which is part of the authentication handshake with the device.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

random_1: str
time_1: str | int
class cremalink.local_server_app.models.KeyExchangeRequest(*, key_exchange: KeyExchange)[source]

Bases: BaseModel

Model for a key exchange request, wrapping the KeyExchange payload.

key_exchange: KeyExchange
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class cremalink.local_server_app.models.MonitorResponse(*, monitor: Dict[str, Any] | Any | None = None, monitor_b64: str | None = None, received_at: float | None = None)[source]

Bases: BaseModel

Model for the response from the /get_monitor endpoint. Includes the parsed monitor data, the raw base64 string, and a timestamp.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

monitor: Dict[str, Any] | Any | None
monitor_b64: str | None
received_at: float | None
class cremalink.local_server_app.models.PropertiesResponse(*, properties: Dict[str, ~typing.Any]=<factory>, received_at: float | None = None)[source]

Bases: BaseModel

Model for the response from the /get_properties endpoint. Includes the dictionary of properties and a timestamp.

model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

properties: Dict[str, Any]
received_at: float | None