Coverage for polar/storefront/schemas.py: 100%
15 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 12:42 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 12:42 +0000
1from pydantic import Field
3from polar.benefit.schemas import BenefitPublic
4from polar.file.schemas import ProductMediaFileRead
5from polar.kit.schemas import Schema
6from polar.organization.schemas import Organization
7from polar.product.schemas import ProductBase, ProductPrice
10class ProductStorefront(ProductBase):
11 """Schema of a public product."""
13 prices: list[ProductPrice] = Field(
14 description="List of available prices for this product."
15 )
16 benefits: list[BenefitPublic] = Field(
17 title="BenefitPublic", description="The benefits granted by the product."
18 )
19 medias: list[ProductMediaFileRead] = Field(
20 description="The medias associated to the product."
21 )
24class StorefrontCustomer(Schema):
25 name: str
28class StorefrontCustomers(Schema):
29 total: int
30 customers: list[StorefrontCustomer]
33class Storefront(Schema):
34 """Schema of a public storefront."""
36 organization: Organization
37 products: list[ProductStorefront]
38 donation_product: ProductStorefront | None
39 customers: StorefrontCustomers
42class OrganizationSlugLookup(Schema):
43 """Schema for organization slug lookup response."""
45 organization_slug: str = Field(
46 description="The slug of the organization that owns the product or subscription."
47 )