Skip to content

Commit cc36c48

Browse files
committed
Clean up API naming
1 parent aa4e051 commit cc36c48

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

nanokvm/client.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,14 +838,24 @@ async def get_led_strip(self) -> GetLedStripRsp:
838838
)
839839

840840
async def set_led_strip(
841-
self, *, on: bool, hor: int, ver: int, brightness: int
841+
self,
842+
*,
843+
on: bool,
844+
horizontal_count: int,
845+
vertical_count: int,
846+
brightness: int,
842847
) -> None:
843848
"""Set LED strip configuration. Pro only."""
844849
await self._require_pro("set_led_strip")
845850
await self._api_request_json(
846851
hdrs.METH_POST,
847852
"/vm/ledstrip/set",
848-
data=SetLedStripReq(on=on, hor=hor, ver=ver, brightness=brightness),
853+
data=SetLedStripReq(
854+
on=on,
855+
horizontal_count=horizontal_count,
856+
vertical_count=vertical_count,
857+
brightness=brightness,
858+
),
849859
)
850860

851861
async def get_timezone(self) -> GetTimeZoneRsp:

nanokvm/models.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class GetInfoRsp(BaseModel):
174174
image: str
175175
application: str
176176
device_key: str = Field(alias="deviceKey")
177-
pn: str = "" # Pro only
177+
part_number: str = Field("", alias="pn") # Pro only
178178
arch: str = "" # Pro only
179179

180180

@@ -440,18 +440,20 @@ class SetMenuBarConfigReq(BaseModel):
440440
class SetLedStripReq(BaseModel):
441441
"""Pro only."""
442442

443+
model_config = ConfigDict(populate_by_name=True)
444+
443445
on: bool
444-
hor: int
445-
ver: int
446+
horizontal_count: int = Field(alias="hor")
447+
vertical_count: int = Field(alias="ver")
446448
brightness: int
447449

448450

449451
class GetLedStripRsp(BaseModel):
450452
"""Pro only."""
451453

452454
on: bool
453-
hor: int
454-
ver: int
455+
horizontal_count: int = Field(alias="hor")
456+
vertical_count: int = Field(alias="ver")
455457
brightness: int
456458

457459

0 commit comments

Comments
 (0)