Skip to content

statuspro_public_api_client.helpers.orders

statuspro_public_api_client.helpers.orders

Order helper facade — ergonomic wrappers around the generated order endpoints.

Classes

Orders(client)

Bases: Base

Ergonomic order operations that return domain Order models.

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
get(order_id) async

Get a single order by id.

Source code in statuspro_public_api_client/helpers/orders.py
async def get(self, order_id: int) -> Order:
    """Get a single order by id."""
    from statuspro_public_api_client.api.orders import get_order
    from statuspro_public_api_client.domain import Order
    from statuspro_public_api_client.models.order_response import OrderResponse
    from statuspro_public_api_client.utils import unwrap_as

    response = await get_order.asyncio_detailed(client=self._client, order=order_id)
    raw = unwrap_as(response, OrderResponse)
    return Order.model_validate(raw.to_dict())
list(*, search=None, status_code=None, tags=None, tags_any=None, financial_status=None, fulfillment_status=None, exclude_cancelled=None, due_date_from=None, due_date_to=None, page=None, per_page=None) async

List orders. Auto-paginates when page is not set.

Source code in statuspro_public_api_client/helpers/orders.py
async def list(
    self,
    *,
    search: str | None = None,
    status_code: str | None = None,
    tags: builtins.list[str] | None = None,
    tags_any: builtins.list[str] | None = None,
    financial_status: builtins.list[str] | None = None,
    fulfillment_status: builtins.list[str] | None = None,
    exclude_cancelled: bool | None = None,
    due_date_from: str | None = None,
    due_date_to: str | None = None,
    page: int | None = None,
    per_page: int | None = None,
) -> builtins.list[Order]:
    """List orders. Auto-paginates when ``page`` is not set."""
    from statuspro_public_api_client.api.orders import list_orders
    from statuspro_public_api_client.domain import Order
    from statuspro_public_api_client.utils import unwrap_data

    kwargs: dict[str, Any] = {
        "client": self._client,
        "search": search,
        "status_code": status_code,
        "tags": tags,
        "tags_any": tags_any,
        "financial_status": financial_status,
        "fulfillment_status": fulfillment_status,
        "exclude_cancelled": exclude_cancelled,
        "due_date_from": due_date_from,
        "due_date_to": due_date_to,
        "page": page,
        "per_page": per_page,
    }
    kwargs = {k: v for k, v in kwargs.items() if v is not None}
    response = await list_orders.asyncio_detailed(**kwargs)
    raw_orders = unwrap_data(response, default=[])
    return [Order.model_validate(o.to_dict()) for o in raw_orders]
lookup(*, number, email) async

Look up an order by order number and customer email.

Source code in statuspro_public_api_client/helpers/orders.py
async def lookup(self, *, number: str, email: str) -> Order:
    """Look up an order by order number and customer email."""
    from statuspro_public_api_client.api.orders import lookup_order
    from statuspro_public_api_client.domain import Order
    from statuspro_public_api_client.models.order_response import OrderResponse
    from statuspro_public_api_client.utils import unwrap_as

    response = await lookup_order.asyncio_detailed(
        client=self._client, number=number, email=email
    )
    raw = unwrap_as(response, OrderResponse)
    return Order.model_validate(raw.to_dict())