statuspro_public_api_client.domain¶
statuspro_public_api_client.domain
¶
Pydantic domain models for StatusPro entities.
Hand-written domain models representing business entities from the StatusPro API, separate from the generated attrs API request/response models. Use these for business logic, validation, and ergonomic access to API data.
Example
Classes¶
Customer
¶
Bases: _Frozen
Customer details attached to an order.
Order
¶
Bases: _Frozen
An order as returned by /orders list pages or /orders/{id}.
OrderStatus
¶
Bases: _Frozen
The status currently set on an order (nested Status schema).
Distinct from :class:Status, which is a top-level status definition
returned by /statuses and includes color instead of transition
metadata.
PageMeta
¶
Bases: _Frozen
Pagination envelope returned alongside list endpoints.
Matches the StatusPro OrderListMeta schema. current_page and
last_page are used by the transport layer to auto-walk pages.
Status
¶
Bases: BaseModel
A top-level status definition from the account's status catalog.
StatusProBaseModel
¶
Bases: BaseModel
Base class for all Pydantic domain models.
Provides: - Immutability by default (frozen=True) - Automatic validation - JSON schema generation - Easy serialization for ETL - Common timestamp fields
Example
Functions¶
model_dump_for_etl()
¶
Export to ETL-friendly format.
Removes None values and uses field aliases for cleaner output.
Returns:
Example
Source code in statuspro_public_api_client/domain/base.py
to_dict_with_computed()
¶
Export including computed fields.
Unlike model_dump(), this includes @computed_field properties.
Returns:
Source code in statuspro_public_api_client/domain/base.py
to_warehouse_json()
¶
Export as JSON for data warehouse.
Returns:
-
str–JSON string with all non-None fields
Example
Source code in statuspro_public_api_client/domain/base.py
Functions¶
to_unset(value)
¶
Convert None to UNSET sentinel value.
Useful when building attrs API request models from optional Pydantic fields, where None means "not provided" and should be sent as UNSET to avoid overwriting existing values.
Parameters:
-
value(T | None) –Value that might be None
Returns:
-
T | Unset–The value unchanged if not None, or UNSET if None
Example
Source code in statuspro_public_api_client/domain/converters.py
unwrap_unset(value, default=None)
¶
Unwrap an Unset or None sentinel value.
Parameters:
-
value(T | Unset | None) –Value that might be Unset or None
-
default(T | None, default:None) –Default value to return if Unset or None
Returns:
-
T | None–The unwrapped value, or default if value is Unset or None. When a
-
T | None–non-None default is provided, the return type is narrowed to
T -
T | None–(never None).