Skip to content

statuspro_public_api_client.helpers.statuses

statuspro_public_api_client.helpers.statuses

Status helper facade — ergonomic wrappers around the generated status endpoints.

Classes

Statuses(client)

Bases: Base

Ergonomic status catalog operations.

Source code in statuspro_public_api_client/helpers/base.py
def __init__(self, client: StatusProClient) -> None:
    """Initialize with a client instance.

    Args:
        client: The StatusProClient instance to use for API calls.
    """
    self._client = client
Functions
list() async

Return the full status catalog (/statuses).

Source code in statuspro_public_api_client/helpers/statuses.py
async def list(self) -> builtins.list[Status]:
    """Return the full status catalog (``/statuses``)."""
    from statuspro_public_api_client.api.statuses import get_statuses
    from statuspro_public_api_client.domain import Status
    from statuspro_public_api_client.utils import unwrap_data

    response = await get_statuses.asyncio_detailed(client=self._client)
    raw = unwrap_data(response, default=[])
    return [Status.model_validate(s.to_dict()) for s in raw]
viable_for(order_id) async

Return statuses that are valid transitions from the order's current state.

Source code in statuspro_public_api_client/helpers/statuses.py
async def viable_for(self, order_id: int) -> builtins.list[Status]:
    """Return statuses that are valid transitions from the order's current state."""
    from statuspro_public_api_client.api.orders import get_viable_statuses
    from statuspro_public_api_client.domain import Status
    from statuspro_public_api_client.utils import unwrap_data

    response = await get_viable_statuses.asyncio_detailed(
        client=self._client, order=order_id
    )
    raw = unwrap_data(response, default=[])
    return [Status.model_validate(s.to_dict()) for s in raw]