Coverage for polar/benefit/strategies/custom/schemas.py: 100%
26 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 typing import Annotated, Literal 1a
3from pydantic import Field 1a
4from pydantic.json_schema import SkipJsonSchema 1a
6from polar.kit.schemas import Schema 1a
7from polar.models.benefit import BenefitType 1a
9from ..base.schemas import ( 1a
10 BenefitBase,
11 BenefitCreateBase,
12 BenefitSubscriberBase,
13 BenefitUpdateBase,
14)
16Note = Annotated[ 1a
17 str | None,
18 Field(
19 description=(
20 "Private note to be shared with customers who have this benefit granted."
21 ),
22 ),
23]
26class BenefitCustomProperties(Schema): 1a
27 """
28 Properties for a benefit of type `custom`.
29 """
31 note: Note | None 1a
34class BenefitCustomCreateProperties(Schema): 1a
35 """
36 Properties for creating a benefit of type `custom`.
37 """
39 note: Note | None = None 1a
42class BenefitCustomSubscriberProperties(Schema): 1a
43 """
44 Properties available to subscribers for a benefit of type `custom`.
45 """
47 note: Note | None 1a
50class BenefitCustomCreate(BenefitCreateBase): 1a
51 """
52 Schema to create a benefit of type `custom`.
53 """
55 type: Literal[BenefitType.custom] 1a
56 properties: BenefitCustomCreateProperties 1a
59class BenefitCustomUpdate(BenefitUpdateBase): 1a
60 type: Literal[BenefitType.custom] 1a
61 properties: BenefitCustomProperties | None = None 1a
64class BenefitCustom(BenefitBase): 1a
65 """
66 A benefit of type `custom`.
68 Use it to grant any kind of benefit that doesn't fit in the other types.
69 """
71 type: Literal[BenefitType.custom] 1a
72 properties: BenefitCustomProperties 1a
73 is_tax_applicable: SkipJsonSchema[bool] = Field(deprecated=True) 1a
76class BenefitCustomSubscriber(BenefitSubscriberBase): 1a
77 type: Literal[BenefitType.custom] 1a
78 properties: BenefitCustomSubscriberProperties 1a