statuspro_public_api_client.domain.converters¶
statuspro_public_api_client.domain.converters
¶
Generic conversion utilities for attrs API models.
These helpers bridge the attrs-based generated models (which use UNSET for
unprovided fields) and Pydantic domain models (which use None).
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).