pypetkitapi 1.4.0__tar.gz → 1.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/PKG-INFO +1 -1
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/containers.py +14 -2
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pyproject.toml +2 -2
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/LICENSE +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/README.md +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/__init__.py +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/client.py +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/command.py +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/const.py +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/exceptions.py +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/feeder_container.py +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/litter_container.py +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/py.typed +0 -0
- {pypetkitapi-1.4.0 → pypetkitapi-1.5.0}/pypetkitapi/water_fountain_container.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
"""Dataclasses container for petkit API."""
|
2
2
|
|
3
|
-
from pydantic import BaseModel, Field
|
3
|
+
from pydantic import BaseModel, Field, model_validator
|
4
4
|
|
5
5
|
|
6
6
|
class RegionInfo(BaseModel):
|
@@ -68,8 +68,20 @@ class Pet(BaseModel):
|
|
68
68
|
avatar: str | None = None
|
69
69
|
created_at: int = Field(alias="createdAt")
|
70
70
|
pet_id: int = Field(alias="petId")
|
71
|
+
id: int | None = None # Fictive field (for HA compatibility) copied from id
|
72
|
+
sn: int | None = None # Fictive field (for HA compatibility) copied from id
|
71
73
|
pet_name: str | None = Field(None, alias="petName")
|
72
|
-
|
74
|
+
name: str | None = None # Fictive field (for HA compatibility) copied from pet_name
|
75
|
+
device_type: str = "pet" # Fictive field (for HA compatibility) fixed
|
76
|
+
firmware: str | None = None # Fictive field (for HA compatibility) fixed
|
77
|
+
|
78
|
+
@model_validator(mode="before")
|
79
|
+
def populate_fictive_fields(cls, values): # noqa: N805
|
80
|
+
"""Populate fictive fields based on other fields."""
|
81
|
+
values["id"] = values.get("id") or values.get("petId")
|
82
|
+
values["sn"] = values.get("sn") or values.get("id")
|
83
|
+
values["name"] = values.get("name") or values.get("petName")
|
84
|
+
return values
|
73
85
|
|
74
86
|
|
75
87
|
class User(BaseModel):
|
@@ -187,7 +187,7 @@ build-backend = "poetry.core.masonry.api"
|
|
187
187
|
|
188
188
|
[tool.poetry]
|
189
189
|
name = "pypetkitapi"
|
190
|
-
version = "1.
|
190
|
+
version = "1.5.0"
|
191
191
|
description = "Python client for PetKit API"
|
192
192
|
authors = ["Jezza34000 <info@mail.com>"]
|
193
193
|
readme = "README.md"
|
@@ -204,7 +204,7 @@ black = "^24.10.0"
|
|
204
204
|
ruff = "^0.8.1"
|
205
205
|
|
206
206
|
[tool.bumpver]
|
207
|
-
current_version = "1.
|
207
|
+
current_version = "1.5.0"
|
208
208
|
version_pattern = "MAJOR.MINOR.PATCH"
|
209
209
|
commit_message = "bump version {old_version} -> {new_version}"
|
210
210
|
tag_message = "{new_version}"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|