Skip to content

Labels

Create, read, update, and delete item labels.

LabelsClient

Bases: TagsClient

Backward-compatible alias wrapper for TagsClient.

Source code in homebox/client.py
class LabelsClient(TagsClient):
    """Backward-compatible alias wrapper for ``TagsClient``."""

    def get_all_labels(self) -> list[LabelOut]:
        """Return all tags mapped to backward-compatible label models."""
        return [LabelOut(**item.model_dump()) for item in self.get_all_tags()]

    def create_label(self, data: LabelCreate) -> LabelSummary:
        """Create a label using the tag endpoint and return a label summary."""
        return LabelSummary(**self.create_tag(TagCreate(**data.model_dump(exclude_none=True))).model_dump())

    def get_label(self, id: str) -> LabelOut:
        """Return a single tag mapped to the backward-compatible label model."""
        return LabelOut(**self.get_tag(id).model_dump())

    def update_label(self, id: str, data: LabelOut) -> LabelOut:
        """Update a label by proxying the request through the tag endpoint."""
        return LabelOut(**self.update_tag(id, TagOut(**data.model_dump(exclude_none=True))).model_dump())

    def delete_label(self, id: str):
        """Delete a label by proxying the request through the tag endpoint."""
        self.delete_tag(id)

get_all_labels

get_all_labels() -> list[LabelOut]

Return all tags mapped to backward-compatible label models.

Source code in homebox/client.py
def get_all_labels(self) -> list[LabelOut]:
    """Return all tags mapped to backward-compatible label models."""
    return [LabelOut(**item.model_dump()) for item in self.get_all_tags()]

create_label

create_label(data: LabelCreate) -> LabelSummary

Create a label using the tag endpoint and return a label summary.

Source code in homebox/client.py
def create_label(self, data: LabelCreate) -> LabelSummary:
    """Create a label using the tag endpoint and return a label summary."""
    return LabelSummary(**self.create_tag(TagCreate(**data.model_dump(exclude_none=True))).model_dump())

get_label

get_label(id: str) -> LabelOut

Return a single tag mapped to the backward-compatible label model.

Source code in homebox/client.py
def get_label(self, id: str) -> LabelOut:
    """Return a single tag mapped to the backward-compatible label model."""
    return LabelOut(**self.get_tag(id).model_dump())

update_label

update_label(id: str, data: LabelOut) -> LabelOut

Update a label by proxying the request through the tag endpoint.

Source code in homebox/client.py
def update_label(self, id: str, data: LabelOut) -> LabelOut:
    """Update a label by proxying the request through the tag endpoint."""
    return LabelOut(**self.update_tag(id, TagOut(**data.model_dump(exclude_none=True))).model_dump())

delete_label

delete_label(id: str)

Delete a label by proxying the request through the tag endpoint.

Source code in homebox/client.py
def delete_label(self, id: str):
    """Delete a label by proxying the request through the tag endpoint."""
    self.delete_tag(id)