Skip to content

Actions

Bulk action endpoints (move, archive, unarchive, delete).

ActionsClient

Sub-client for bulk action / maintenance endpoints.

Accessed via HomeboxClient.actions.

Source code in homebox/client.py
class ActionsClient:
    """Sub-client for bulk action / maintenance endpoints.

    Accessed via ``HomeboxClient.actions``.
    """

    def __init__(self, client: HomeboxClient):
        """Initialise the actions sub-client with the shared root client."""
        self.client = client

    def create_missing_thumbnails(self) -> ActionAmountResult:
        """Create thumbnails for items that are missing them.

        Returns:
            ActionAmountResult: Number of thumbnails that were created.
        """
        return ActionAmountResult(**self.client._request("post", "/v1/actions/create-missing-thumbnails"))

    def ensure_asset_ids(self) -> ActionAmountResult:
        """Ensure all items in the database have an asset ID.

        Returns:
            ActionAmountResult: Number of asset IDs that were assigned.
        """
        return ActionAmountResult(**self.client._request("post", "/v1/actions/ensure-asset-ids"))

    def ensure_import_refs(self) -> ActionAmountResult:
        """Ensure all items in the database have an import reference.

        Returns:
            ActionAmountResult: Number of import refs that were assigned.
        """
        return ActionAmountResult(**self.client._request("post", "/v1/actions/ensure-import-refs"))

    def set_primary_photos(self) -> ActionAmountResult:
        """Set the first photo of each item as its primary photo.

        Returns:
            ActionAmountResult: Number of items whose primary photo was updated.
        """
        return ActionAmountResult(**self.client._request("post", "/v1/actions/set-primary-photos"))

    def zero_out_time_fields(self) -> ActionAmountResult:
        """Reset all item date fields to the beginning of the day.

        Returns:
            ActionAmountResult: Number of items whose time fields were zeroed.
        """
        return ActionAmountResult(**self.client._request("post", "/v1/actions/zero-item-time-fields"))

    def wipe_inventory(self, options: WipeInventoryOptions | None = None) -> ActionAmountResult:
        """Delete all items in inventory, with optional related-data cleanup flags."""
        payload = options.model_dump(exclude_none=True) if options else {}
        return ActionAmountResult(**self.client._request("post", "/v1/actions/wipe-inventory", data=payload))

__init__

__init__(client: HomeboxClient)

Initialise the actions sub-client with the shared root client.

Source code in homebox/client.py
def __init__(self, client: HomeboxClient):
    """Initialise the actions sub-client with the shared root client."""
    self.client = client

create_missing_thumbnails

create_missing_thumbnails() -> ActionAmountResult

Create thumbnails for items that are missing them.

Returns:

Name Type Description
ActionAmountResult ActionAmountResult

Number of thumbnails that were created.

Source code in homebox/client.py
def create_missing_thumbnails(self) -> ActionAmountResult:
    """Create thumbnails for items that are missing them.

    Returns:
        ActionAmountResult: Number of thumbnails that were created.
    """
    return ActionAmountResult(**self.client._request("post", "/v1/actions/create-missing-thumbnails"))

ensure_asset_ids

ensure_asset_ids() -> ActionAmountResult

Ensure all items in the database have an asset ID.

Returns:

Name Type Description
ActionAmountResult ActionAmountResult

Number of asset IDs that were assigned.

Source code in homebox/client.py
def ensure_asset_ids(self) -> ActionAmountResult:
    """Ensure all items in the database have an asset ID.

    Returns:
        ActionAmountResult: Number of asset IDs that were assigned.
    """
    return ActionAmountResult(**self.client._request("post", "/v1/actions/ensure-asset-ids"))

ensure_import_refs

ensure_import_refs() -> ActionAmountResult

Ensure all items in the database have an import reference.

Returns:

Name Type Description
ActionAmountResult ActionAmountResult

Number of import refs that were assigned.

Source code in homebox/client.py
def ensure_import_refs(self) -> ActionAmountResult:
    """Ensure all items in the database have an import reference.

    Returns:
        ActionAmountResult: Number of import refs that were assigned.
    """
    return ActionAmountResult(**self.client._request("post", "/v1/actions/ensure-import-refs"))

set_primary_photos

set_primary_photos() -> ActionAmountResult

Set the first photo of each item as its primary photo.

Returns:

Name Type Description
ActionAmountResult ActionAmountResult

Number of items whose primary photo was updated.

Source code in homebox/client.py
def set_primary_photos(self) -> ActionAmountResult:
    """Set the first photo of each item as its primary photo.

    Returns:
        ActionAmountResult: Number of items whose primary photo was updated.
    """
    return ActionAmountResult(**self.client._request("post", "/v1/actions/set-primary-photos"))

zero_out_time_fields

zero_out_time_fields() -> ActionAmountResult

Reset all item date fields to the beginning of the day.

Returns:

Name Type Description
ActionAmountResult ActionAmountResult

Number of items whose time fields were zeroed.

Source code in homebox/client.py
def zero_out_time_fields(self) -> ActionAmountResult:
    """Reset all item date fields to the beginning of the day.

    Returns:
        ActionAmountResult: Number of items whose time fields were zeroed.
    """
    return ActionAmountResult(**self.client._request("post", "/v1/actions/zero-item-time-fields"))

wipe_inventory

wipe_inventory(options: WipeInventoryOptions | None = None) -> ActionAmountResult

Delete all items in inventory, with optional related-data cleanup flags.

Source code in homebox/client.py
def wipe_inventory(self, options: WipeInventoryOptions | None = None) -> ActionAmountResult:
    """Delete all items in inventory, with optional related-data cleanup flags."""
    payload = options.model_dump(exclude_none=True) if options else {}
    return ActionAmountResult(**self.client._request("post", "/v1/actions/wipe-inventory", data=payload))