katana_public_api_client.domain.product¶
katana_public_api_client.domain.product
¶
Domain model for Product entities.
This module provides a Pydantic model representing a Product (finished good or component) optimized for ETL, data processing, and business logic.
Classes¶
KatanaProduct
¶
Bases: KatanaBaseModel
Domain model for a Product.
A Product represents a finished good or component that can be sold, manufactured, or purchased, with support for variants and configurations. This is a Pydantic model optimized for: - ETL and data processing - Business logic - Data validation - JSON schema generation
Unlike the generated attrs model, this model: - Has no Unset sentinel values - Provides ETL-friendly methods - Is immutable by default - Clean Optional types
Example
product = KatanaProduct(
id=1,
name="Standard-hilt lightsaber",
type="product",
uom="pcs",
category_name="lightsaber",
is_sellable=True,
is_producible=True,
is_purchasable=True,
)
# Business methods available
print(product.get_display_name()) # "Standard-hilt lightsaber"
# ETL export
csv_row = product.to_csv_row()
schema = KatanaProduct.model_json_schema()
Functions¶
get_display_name()
¶
Get formatted display name.
Returns:
-
str–Product name, or "Unnamed Product {id}" if no name
Example
Source code in katana_public_api_client/domain/product.py
matches_search(query)
¶
Check if product matches search query.
Searches across: - Product name - Category name
Parameters:
-
query(str) –Search query string (case-insensitive)
Returns:
-
bool–True if product matches query
Example
Source code in katana_public_api_client/domain/product.py
to_csv_row()
¶
Export as CSV-friendly row.
Returns: