Skip to content

product

konigle.models.commerce.product

Product models for the Konigle SDK.

This module provides Pydantic models for product resources including creation, update, and response models with comprehensive validation.

Product

Bases: ProductBase, TimestampedResource, IDMixin, BaseResource

Complete product resource model.

Represents a product from the API with all fields including computed values, relationships, and Active Record capabilities.

currency = Field(default=None, max_length=3, title='Currency', description='Currency code for price fields.') class-attribute instance-attribute

Currency code for price fields.

djcom_tags = Field(default_factory=list, title='Parsed Tags', description='List of tags parsed from tags field.') class-attribute instance-attribute

List of tags parsed from tags field.

handle = Field(..., title='Handle', description='URL-friendly product identifier.') class-attribute instance-attribute

URL-friendly product identifier.

has_variants = Field(..., title='Has Variants', description='Whether product has multiple variants.') class-attribute instance-attribute

Whether product has multiple variants.

image = Field(default=None, title='Image ID', description='ID of the main product image.') class-attribute instance-attribute

ID of the main product image.

original_price = Field(default=None, gt=0, max_digits=19, decimal_places=2, title='Original Price', description='Original price before discount.') class-attribute instance-attribute

Original price before discount.

pathname = Field(default=None, title='Pathname', description='Full pathname of the product page') class-attribute instance-attribute

Full pathname of the product page

preview_url = Field(default=None, title='Preview URL', description='Preview URL of the product page') class-attribute instance-attribute

Preview URL of the product page

price = Field(default=None, gt=0, max_digits=19, decimal_places=2, title='Price', description='Product price for single variant products.') class-attribute instance-attribute

Product price for single variant products.

product_type = Field(..., title='Product Type', description='Product category or type.') class-attribute instance-attribute

Product category or type.

published_at = Field(default=None, title='Published At', description='Product publication timestamp.') class-attribute instance-attribute

Product publication timestamp.

seo_meta = Field(default=None, title='SEO Meta', description='SEO metadata including title, description, keywords.') class-attribute instance-attribute

SEO metadata including title, description, keywords.

status = Field(..., title='Status', description='Product publication status.') class-attribute instance-attribute

Product publication status.

tags = Field(..., title='Tags', description='Comma-separated list of product tags.') class-attribute instance-attribute

Comma-separated list of product tags.

url = Field(default=None, title='URL', description='Public URL of the produc page') class-attribute instance-attribute

Public URL of the product page. Results in 404 if the product is not published.

vendor = Field(..., title='Vendor', description='Product vendor or manufacturer.') class-attribute instance-attribute

Product vendor or manufacturer.

ProductBase

Bases: BaseModel

Base product model with truly shared fields.

Contains only fields that have the same optionality and validation requirements in both creation and response contexts.

content = Field(default_factory=dict, title='Content', description='Body content blocks in EditorJS JSON format.') class-attribute instance-attribute

Body content blocks in EditorJS JSON format.

options = Field(default_factory=list, title='Options', description='List of product option names.') class-attribute instance-attribute

List of product option names.

title = Field(..., min_length=1, max_length=255, title='Title', description='Product title or name.') class-attribute instance-attribute

Product title or name.

ProductCreate

Bases: ProductBase, CreateModel

Model for creating a new product.

Includes all fields required for product creation plus optional file upload for the main product image.

currency = Field(default=None, max_length=3, title='Currency', description='Currency code for price fields.') class-attribute instance-attribute

Currency code for price fields.

handle = Field(default=None, max_length=255, title='Handle', description='URL-friendly product identifier.') class-attribute instance-attribute

URL-friendly product identifier. Will be auto-generated from title if not provided.

original_price = Field(default=None, gt=0, max_digits=19, decimal_places=2, title='Original Price', description='Original price before discount.') class-attribute instance-attribute

Original price before discount.

price = Field(default=None, gt=0, max_digits=19, decimal_places=2, title='Price', description='Product price for single variant products.') class-attribute instance-attribute

Product price for single variant products.

product_type = Field(default='', max_length=255, title='Product Type', description='Product category or type.') class-attribute instance-attribute

Product category or type.

seo_meta = Field(default_factory=(lambda: SEOMeta()), title='SEO Meta', description='SEO metadata including title, description, keywords.') class-attribute instance-attribute

SEO metadata including title, description, keywords.

status = Field(default=(ProductStatus.DRAFT), title='Status', description='Product publication status.') class-attribute instance-attribute

Product publication status.

tags = Field(default='', title='Tags', description='Comma-separated list of product tags.') class-attribute instance-attribute

Comma-separated list of product tags.

variants = Field(default_factory=list, title='Variants', description='List of product variants to create with the product.') class-attribute instance-attribute

List of product variants to create with the product. The options must match the product options defined above.

vendor = Field(default='', max_length=255, title='Vendor', description='Product vendor or manufacturer.') class-attribute instance-attribute

Product vendor or manufacturer.

ProductOption

Bases: BaseModel

Model representing a product option.

Each option can have multiple values, such as size or color.

name = Field(..., max_length=255, title='Option Name', description='Name of the product option (e.g., Size, Color).') class-attribute instance-attribute

Name of the product option (e.g., Size, Color).

values = Field(..., title='Option Values', description='List of possible values for this option.') class-attribute instance-attribute

List of possible values for this option.

ProductStatus

Bases: str, Enum

Product publication status.

ProductUpdate

Bases: UpdateModel

Model for updating an existing product.

All fields are optional for partial updates. Supports updating any product field including status and image.

content = Field(default=None, title='Content', description='Body content blocks in EditrJS JSON format.') class-attribute instance-attribute

Body content blocks in EditorJS JSON format.

currency = Field(default=None, max_length=3, title='Currency', description='Currency code for price fields.') class-attribute instance-attribute

Currency code for price fields.

handle = Field(default=None, max_length=255, title='Handle', description='URL-friendly product identifier.') class-attribute instance-attribute

URL-friendly product identifier.

image = Field(default=None, title='Image ID', description='ID of the product image to set as the main image.') class-attribute instance-attribute

ID of the product image to set as the main image.

options = Field(default=None, title='Options', description='List of product option names.') class-attribute instance-attribute

List of product option names.

original_price = Field(default=None, gt=0, max_digits=19, decimal_places=2, title='Original Price', description='Original price before discount.') class-attribute instance-attribute

Original price before discount.

price = Field(default=None, gt=0, max_digits=19, decimal_places=2, title='Price', description='Product price for single variant products.') class-attribute instance-attribute

Product price for single variant products.

product_type = Field(default=None, max_length=255, title='Product Type', description='Product category or type.') class-attribute instance-attribute

Product category or type.

seo_meta = Field(default=None, title='SEO Meta', description='SEO metadata including title, description, keywords.') class-attribute instance-attribute

SEO metadata including title, description, keywords.

status = Field(default=None, title='Status', description='Product publication status.') class-attribute instance-attribute

Product publication status.

tags = Field(default=None, title='Tags', description='Comma-separated list of product tags.') class-attribute instance-attribute

Comma-separated list of product tags.

title = Field(default=None, min_length=1, max_length=255, title='Title', description='Product title or name.') class-attribute instance-attribute

Product title or name.

variants = Field(default=None, title='Variants', description='List of product variants to update.') class-attribute instance-attribute

List of product variants to update. Specify the right options to match existing variants.

vendor = Field(default=None, max_length=255, title='Vendor', description='Product vendor or manufacturer.') class-attribute instance-attribute

Product vendor or manufacturer.