google_nest_sdm.structure

Traits for structures / rooms.

 1"""Traits for structures / rooms."""
 2
 3from __future__ import annotations
 4
 5from dataclasses import dataclass, field
 6from typing import Any, Mapping
 7from mashumaro import field_options
 8
 9from .model import TraitDataClass
10
11
12@dataclass
13class InfoTrait:
14    """This trait belongs to any structure for structure-related information."""
15
16    custom_name: str | None = field(
17        metadata=field_options(alias="customName"), default=None
18    )
19    """Name of the structure."""
20
21
22@dataclass
23class RoomInfoTrait:
24    """This trait belongs to any structure for room-related information."""
25
26    custom_name: str = field(metadata=field_options(alias="customName"))
27    """Name of the structure."""
28
29
30@dataclass
31class Structure(TraitDataClass):
32    """Class that represents a structure object in the Google Nest SDM API."""
33
34    name: str
35    """Resource name of the structure e.g. 'enterprises/XYZ/structures/123'."""
36
37    info: InfoTrait | None = field(
38        metadata=field_options(alias="sdm.structures.traits.Info"), default=None
39    )
40    room_info: RoomInfoTrait | None = field(
41        metadata=field_options(alias="sdm.structures.traits.RoomInfo"), default=None
42    )
43
44    @classmethod
45    def MakeStructure(cls, raw_data: Mapping[str, Any]) -> Structure:
46        """Create a structure with the appropriate traits."""
47        return cls.parse_trait_object(raw_data)
@dataclass
class InfoTrait:
13@dataclass
14class InfoTrait:
15    """This trait belongs to any structure for structure-related information."""
16
17    custom_name: str | None = field(
18        metadata=field_options(alias="customName"), default=None
19    )
20    """Name of the structure."""

This trait belongs to any structure for structure-related information.

InfoTrait(custom_name: str | None = None)
custom_name: str | None = None

Name of the structure.

@dataclass
class RoomInfoTrait:
23@dataclass
24class RoomInfoTrait:
25    """This trait belongs to any structure for room-related information."""
26
27    custom_name: str = field(metadata=field_options(alias="customName"))
28    """Name of the structure."""

This trait belongs to any structure for room-related information.

RoomInfoTrait(custom_name: str)
custom_name: str

Name of the structure.

@dataclass
class Structure(google_nest_sdm.model.TraitDataClass):
31@dataclass
32class Structure(TraitDataClass):
33    """Class that represents a structure object in the Google Nest SDM API."""
34
35    name: str
36    """Resource name of the structure e.g. 'enterprises/XYZ/structures/123'."""
37
38    info: InfoTrait | None = field(
39        metadata=field_options(alias="sdm.structures.traits.Info"), default=None
40    )
41    room_info: RoomInfoTrait | None = field(
42        metadata=field_options(alias="sdm.structures.traits.RoomInfo"), default=None
43    )
44
45    @classmethod
46    def MakeStructure(cls, raw_data: Mapping[str, Any]) -> Structure:
47        """Create a structure with the appropriate traits."""
48        return cls.parse_trait_object(raw_data)

Class that represents a structure object in the Google Nest SDM API.

Structure( name: str, info: InfoTrait | None = None, room_info: RoomInfoTrait | None = None)
name: str

Resource name of the structure e.g. 'enterprises/XYZ/structures/123'.

info: InfoTrait | None = None
room_info: RoomInfoTrait | None = None
@classmethod
def MakeStructure(cls, raw_data: Mapping[str, Any]) -> Structure:
45    @classmethod
46    def MakeStructure(cls, raw_data: Mapping[str, Any]) -> Structure:
47        """Create a structure with the appropriate traits."""
48        return cls.parse_trait_object(raw_data)

Create a structure with the appropriate traits.

def to_dict(self, *, omit_none=False, by_alias=True):

The type of the None singleton.

def from_dict(cls, d, *, dialect=None):

The type of the None singleton.