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