whop-sdk 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of whop-sdk might be problematic. Click here for more details.

Files changed (126) hide show
  1. whop_sdk/_client.py +65 -2
  2. whop_sdk/_version.py +1 -1
  3. whop_sdk/resources/__init__.py +98 -0
  4. whop_sdk/resources/checkout_configurations.py +16 -12
  5. whop_sdk/resources/course_chapters.py +602 -0
  6. whop_sdk/resources/course_lessons.py +722 -0
  7. whop_sdk/resources/courses.py +713 -0
  8. whop_sdk/resources/experiences.py +107 -0
  9. whop_sdk/resources/forum_posts.py +123 -1
  10. whop_sdk/resources/forums.py +446 -0
  11. whop_sdk/resources/members.py +429 -0
  12. whop_sdk/resources/memberships.py +16 -8
  13. whop_sdk/resources/messages.py +113 -1
  14. whop_sdk/resources/payments.py +3 -26
  15. whop_sdk/resources/plans.py +84 -6
  16. whop_sdk/resources/products.py +8 -16
  17. whop_sdk/resources/promo_codes.py +652 -0
  18. whop_sdk/resources/reviews.py +315 -0
  19. whop_sdk/types/__init__.py +64 -0
  20. whop_sdk/types/app_list_response.py +16 -1
  21. whop_sdk/types/assessment_question_types.py +7 -0
  22. whop_sdk/types/billing_reasons.py +9 -0
  23. whop_sdk/types/card_brands.py +24 -0
  24. whop_sdk/types/checkout_configuration_create_params.py +70 -7
  25. whop_sdk/types/checkout_configuration_list_response.py +12 -9
  26. whop_sdk/types/course.py +109 -0
  27. whop_sdk/types/course_chapter.py +32 -0
  28. whop_sdk/types/course_chapter_create_params.py +16 -0
  29. whop_sdk/types/course_chapter_delete_response.py +7 -0
  30. whop_sdk/types/course_chapter_list_params.py +25 -0
  31. whop_sdk/types/course_chapter_list_response.py +16 -0
  32. whop_sdk/types/course_chapter_update_params.py +12 -0
  33. whop_sdk/types/course_create_params.py +41 -0
  34. whop_sdk/types/course_delete_response.py +7 -0
  35. whop_sdk/types/course_lesson_create_params.py +27 -0
  36. whop_sdk/types/course_lesson_delete_response.py +7 -0
  37. whop_sdk/types/course_lesson_interaction_completed_webhook_event.py +26 -0
  38. whop_sdk/types/course_lesson_list_params.py +28 -0
  39. whop_sdk/types/course_lesson_list_response.py +35 -0
  40. whop_sdk/types/course_lesson_update_params.py +144 -0
  41. whop_sdk/types/course_list_params.py +28 -0
  42. whop_sdk/types/course_list_response.py +77 -0
  43. whop_sdk/types/course_update_params.py +89 -0
  44. whop_sdk/types/entry_approved_webhook_event.py +26 -0
  45. whop_sdk/types/entry_created_webhook_event.py +26 -0
  46. whop_sdk/types/entry_deleted_webhook_event.py +26 -0
  47. whop_sdk/types/entry_denied_webhook_event.py +26 -0
  48. whop_sdk/types/experience_duplicate_params.py +13 -0
  49. whop_sdk/types/experience_list_response.py +27 -1
  50. whop_sdk/types/forum_list_params.py +28 -0
  51. whop_sdk/types/forum_list_response.py +33 -0
  52. whop_sdk/types/forum_post_list_response.py +7 -0
  53. whop_sdk/types/forum_post_update_params.py +41 -0
  54. whop_sdk/types/forum_update_params.py +23 -0
  55. whop_sdk/types/invoice_create_params.py +10 -2
  56. whop_sdk/types/languages.py +30 -0
  57. whop_sdk/types/ledger_account_retrieve_response.py +15 -1
  58. whop_sdk/types/lesson.py +159 -0
  59. whop_sdk/types/lesson_types.py +7 -0
  60. whop_sdk/types/lesson_visibilities.py +7 -0
  61. whop_sdk/types/member_list_params.py +73 -0
  62. whop_sdk/types/member_list_response.py +65 -0
  63. whop_sdk/types/member_retrieve_response.py +79 -0
  64. whop_sdk/types/membership_activated_webhook_event.py +29 -0
  65. whop_sdk/types/membership_deactivated_webhook_event.py +29 -0
  66. whop_sdk/types/membership_list_params.py +7 -4
  67. whop_sdk/types/membership_list_response.py +12 -1
  68. whop_sdk/types/message_update_params.py +35 -0
  69. whop_sdk/types/payment_failed_webhook_event.py +26 -0
  70. whop_sdk/types/payment_list_params.py +2 -7
  71. whop_sdk/types/payment_list_response.py +23 -13
  72. whop_sdk/types/payment_method_types.py +92 -0
  73. whop_sdk/types/payment_pending_webhook_event.py +26 -0
  74. whop_sdk/types/payment_succeeded_webhook_event.py +26 -0
  75. whop_sdk/types/plan_create_params.py +29 -3
  76. whop_sdk/types/plan_list_response.py +9 -0
  77. whop_sdk/types/plan_update_params.py +18 -0
  78. whop_sdk/types/product_create_params.py +1 -24
  79. whop_sdk/types/product_update_params.py +12 -1
  80. whop_sdk/types/promo_code.py +90 -0
  81. whop_sdk/types/promo_code_create_params.py +70 -0
  82. whop_sdk/types/promo_code_delete_response.py +7 -0
  83. whop_sdk/types/promo_code_list_params.py +37 -0
  84. whop_sdk/types/promo_code_list_response.py +79 -0
  85. whop_sdk/types/promo_code_status.py +7 -0
  86. whop_sdk/types/promo_duration.py +7 -0
  87. whop_sdk/types/review_list_params.py +31 -0
  88. whop_sdk/types/review_list_response.py +78 -0
  89. whop_sdk/types/review_retrieve_response.py +103 -0
  90. whop_sdk/types/review_status.py +7 -0
  91. whop_sdk/types/shared/__init__.py +7 -0
  92. whop_sdk/types/shared/access_level.py +7 -0
  93. whop_sdk/types/shared/app.py +25 -1
  94. whop_sdk/types/shared/checkout_configuration.py +12 -9
  95. whop_sdk/types/shared/company.py +15 -1
  96. whop_sdk/types/shared/course_lesson_interaction.py +20 -1
  97. whop_sdk/types/shared/email_notification_preferences.py +7 -0
  98. whop_sdk/types/shared/experience.py +27 -1
  99. whop_sdk/types/shared/forum.py +33 -0
  100. whop_sdk/types/shared/forum_post.py +7 -0
  101. whop_sdk/types/shared/invoice.py +4 -1
  102. whop_sdk/types/shared/invoice_list_item.py +4 -1
  103. whop_sdk/types/shared/member_most_recent_actions.py +22 -0
  104. whop_sdk/types/shared/member_statuses.py +7 -0
  105. whop_sdk/types/shared/membership.py +12 -1
  106. whop_sdk/types/shared/payment.py +23 -13
  107. whop_sdk/types/shared/plan.py +9 -0
  108. whop_sdk/types/shared/product.py +8 -0
  109. whop_sdk/types/shared/product_list_item.py +8 -0
  110. whop_sdk/types/shared/who_can_comment_types.py +7 -0
  111. whop_sdk/types/shared/who_can_post_types.py +7 -0
  112. whop_sdk/types/shared_params/__init__.py +7 -0
  113. whop_sdk/types/shared_params/access_level.py +9 -0
  114. whop_sdk/types/shared_params/email_notification_preferences.py +9 -0
  115. whop_sdk/types/shared_params/member_most_recent_actions.py +24 -0
  116. whop_sdk/types/shared_params/member_statuses.py +9 -0
  117. whop_sdk/types/shared_params/promo_type.py +9 -0
  118. whop_sdk/types/shared_params/who_can_comment_types.py +9 -0
  119. whop_sdk/types/shared_params/who_can_post_types.py +9 -0
  120. whop_sdk/types/unwrap_webhook_event.py +24 -1
  121. whop_sdk/types/user_check_access_response.py +2 -3
  122. whop_sdk/types/user_retrieve_response.py +12 -1
  123. {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.3.dist-info}/METADATA +2 -2
  124. {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.3.dist-info}/RECORD +126 -50
  125. {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.3.dist-info}/WHEEL +0 -0
  126. {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.3.dist-info}/licenses/LICENSE +0 -0
@@ -4,8 +4,11 @@ from typing import Optional
4
4
  from datetime import datetime
5
5
 
6
6
  from .._models import BaseModel
7
+ from .card_brands import CardBrands
8
+ from .billing_reasons import BillingReasons
7
9
  from .shared.currency import Currency
8
10
  from .shared.promo_type import PromoType
11
+ from .payment_method_types import PaymentMethodTypes
9
12
  from .shared.receipt_status import ReceiptStatus
10
13
  from .shared.membership_status import MembershipStatus
11
14
  from .shared.friendly_receipt_status import FriendlyReceiptStatus
@@ -103,7 +106,7 @@ class PromoCode(BaseModel):
103
106
  """The specific code used to apply the promo at checkout."""
104
107
 
105
108
  number_of_intervals: Optional[int] = None
106
- """The number of billing cycles the promo is applied for."""
109
+ """The number of months the promo is applied for."""
107
110
 
108
111
  promo_type: PromoType
109
112
  """The type (% or flat amount) of the promo."""
@@ -136,11 +139,11 @@ class PaymentListResponse(BaseModel):
136
139
  billing_address: Optional[BillingAddress] = None
137
140
  """The address of the user who made the payment."""
138
141
 
139
- billing_reason: Optional[str] = None
140
- """The billing reason"""
142
+ billing_reason: Optional[BillingReasons] = None
143
+ """The reason why a specific payment was billed"""
141
144
 
142
- card_brand: Optional[str] = None
143
- """The type of card used as the payment method."""
145
+ card_brand: Optional[CardBrands] = None
146
+ """Possible card brands that a payment token can have"""
144
147
 
145
148
  card_last4: Optional[str] = None
146
149
  """The last 4 digits of the card used to make the payment."""
@@ -172,11 +175,8 @@ class PaymentListResponse(BaseModel):
172
175
  paid_at: Optional[datetime] = None
173
176
  """The datetime the payment was paid"""
174
177
 
175
- payment_method_type: Optional[str] = None
176
- """Returns the type of payment method used for the payment, if available.
177
-
178
- Ex. klarna, affirm, card, cashapp
179
- """
178
+ payment_method_type: Optional[PaymentMethodTypes] = None
179
+ """The different types of payment methods that can be used."""
180
180
 
181
181
  plan: Optional[Plan] = None
182
182
  """The plan attached to this payment."""
@@ -188,7 +188,10 @@ class PaymentListResponse(BaseModel):
188
188
  """The promo code used for this payment."""
189
189
 
190
190
  refundable: bool
191
- """Whether the payment can be refunded."""
191
+ """
192
+ True only for payments that are `paid`, have not been fully refunded, and were
193
+ processed by a payment processor that allows refunds.
194
+ """
192
195
 
193
196
  refunded_amount: Optional[float] = None
194
197
  """The payment refund amount(if applicable)."""
@@ -197,7 +200,11 @@ class PaymentListResponse(BaseModel):
197
200
  """When the payment was refunded (if applicable)."""
198
201
 
199
202
  retryable: bool
200
- """Whether the payment can be retried."""
203
+ """
204
+ True when the payment status is `open` and its membership is in one of the
205
+ retry-eligible states (`active`, `trialing`, `completed`, or `past_due`);
206
+ otherwise false. Used to decide if Whop can attempt the charge again.
207
+ """
201
208
 
202
209
  status: Optional[ReceiptStatus] = None
203
210
  """The status of a receipt"""
@@ -218,4 +225,7 @@ class PaymentListResponse(BaseModel):
218
225
  """The user that made this payment."""
219
226
 
220
227
  voidable: bool
221
- """Whether the payment can be voided."""
228
+ """
229
+ True when the payment is tied to a membership in `past_due`, the payment status
230
+ is `open`, and the processor allows voiding payments; otherwise false.
231
+ """
@@ -0,0 +1,92 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import Literal, TypeAlias
4
+
5
+ __all__ = ["PaymentMethodTypes"]
6
+
7
+ PaymentMethodTypes: TypeAlias = Literal[
8
+ "acss_debit",
9
+ "affirm",
10
+ "afterpay_clearpay",
11
+ "alipay",
12
+ "alma",
13
+ "amazon_pay",
14
+ "apple_pay",
15
+ "au_becs_debit",
16
+ "bacs_debit",
17
+ "bancontact",
18
+ "billie",
19
+ "blik",
20
+ "boleto",
21
+ "card",
22
+ "cashapp",
23
+ "crypto",
24
+ "eps",
25
+ "fpx",
26
+ "giropay",
27
+ "google_pay",
28
+ "grabpay",
29
+ "ideal",
30
+ "kakao_pay",
31
+ "klarna",
32
+ "konbini",
33
+ "kr_card",
34
+ "link",
35
+ "mobilepay",
36
+ "multibanco",
37
+ "naver_pay",
38
+ "nz_bank_account",
39
+ "oxxo",
40
+ "p24",
41
+ "pay_by_bank",
42
+ "payco",
43
+ "paynow",
44
+ "pix",
45
+ "promptpay",
46
+ "revolut_pay",
47
+ "samsung_pay",
48
+ "satispay",
49
+ "sepa_debit",
50
+ "sofort",
51
+ "swish",
52
+ "twint",
53
+ "us_bank_account",
54
+ "wechat_pay",
55
+ "zip",
56
+ "bizum",
57
+ "capchase_pay",
58
+ "kriya",
59
+ "mondu",
60
+ "ng_wallet",
61
+ "paypay",
62
+ "sequra",
63
+ "scalapay",
64
+ "vipps",
65
+ "custom",
66
+ "customer_balance",
67
+ "gopay",
68
+ "mb_way",
69
+ "ng_bank",
70
+ "ng_bank_transfer",
71
+ "ng_card",
72
+ "ng_market",
73
+ "ng_ussd",
74
+ "paypal",
75
+ "payto",
76
+ "qris",
77
+ "rechnung",
78
+ "south_korea_market",
79
+ "kr_market",
80
+ "shopeepay",
81
+ "upi",
82
+ "sunbit",
83
+ "netbanking",
84
+ "id_bank_transfer",
85
+ "demo_pay",
86
+ "shop_pay",
87
+ "apple",
88
+ "sezzle",
89
+ "coinbase",
90
+ "splitit",
91
+ "unknown",
92
+ ]
@@ -0,0 +1,26 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from datetime import datetime
4
+ from typing_extensions import Literal
5
+
6
+ from .._models import BaseModel
7
+ from .shared.payment import Payment
8
+
9
+ __all__ = ["PaymentPendingWebhookEvent"]
10
+
11
+
12
+ class PaymentPendingWebhookEvent(BaseModel):
13
+ id: str
14
+ """A unique ID for every single webhook request"""
15
+
16
+ api_version: Literal["v1"]
17
+ """The API version for this webhook"""
18
+
19
+ data: Payment
20
+ """An object representing a receipt for a membership."""
21
+
22
+ timestamp: datetime
23
+ """The timestamp in ISO 8601 format that the webhook was sent at on the server"""
24
+
25
+ type: Literal["payment.pending"]
26
+ """The webhook event type"""
@@ -0,0 +1,26 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from datetime import datetime
4
+ from typing_extensions import Literal
5
+
6
+ from .._models import BaseModel
7
+ from .shared.payment import Payment
8
+
9
+ __all__ = ["PaymentSucceededWebhookEvent"]
10
+
11
+
12
+ class PaymentSucceededWebhookEvent(BaseModel):
13
+ id: str
14
+ """A unique ID for every single webhook request"""
15
+
16
+ api_version: Literal["v1"]
17
+ """The API version for this webhook"""
18
+
19
+ data: Payment
20
+ """An object representing a receipt for a membership."""
21
+
22
+ timestamp: datetime
23
+ """The timestamp in ISO 8601 format that the webhook was sent at on the server"""
24
+
25
+ type: Literal["payment.succeeded"]
26
+ """The webhook event type"""
@@ -22,7 +22,7 @@ class PlanCreateParams(TypedDict, total=False):
22
22
  """The product the plan is related to."""
23
23
 
24
24
  billing_period: Optional[int]
25
- """The interval at which the plan charges (renewal plans)."""
25
+ """The interval in days at which the plan charges (renewal plans)."""
26
26
 
27
27
  currency: Optional[Currency]
28
28
  """The available currencies on the platform"""
@@ -40,7 +40,11 @@ class PlanCreateParams(TypedDict, total=False):
40
40
  """An image for the plan. This will be visible on the product page to customers."""
41
41
 
42
42
  initial_price: Optional[float]
43
- """An additional amount charged upon first purchase."""
43
+ """An additional amount charged upon first purchase.
44
+
45
+ Use only if a one time payment OR you want to charge an additional amount on top
46
+ of the renewal price. Provided as a number in dollars. Eg: 10.43 for $10.43
47
+ """
44
48
 
45
49
  internal_notes: Optional[str]
46
50
  """A personal description or notes section for the business."""
@@ -58,7 +62,26 @@ class PlanCreateParams(TypedDict, total=False):
58
62
  """The methods of how a plan can be released."""
59
63
 
60
64
  renewal_price: Optional[float]
61
- """The amount the customer is charged every billing period."""
65
+ """The amount the customer is charged every billing period.
66
+
67
+ Use only if a recurring payment. Provided as a number in dollars. Eg: 10.43 for
68
+ $10.43
69
+ """
70
+
71
+ stock: Optional[int]
72
+ """The number of units available for purchase."""
73
+
74
+ strike_through_initial_price: Optional[float]
75
+ """The price to display with a strikethrough for the initial price.
76
+
77
+ Provided as a number in dollars. Eg: 19.99 for $19.99
78
+ """
79
+
80
+ strike_through_renewal_price: Optional[float]
81
+ """The price to display with a strikethrough for the renewal price.
82
+
83
+ Provided as a number in dollars. Eg: 19.99 for $19.99
84
+ """
62
85
 
63
86
  title: Optional[str]
64
87
  """The title of the plan. This will be visible on the product page to customers."""
@@ -66,6 +89,9 @@ class PlanCreateParams(TypedDict, total=False):
66
89
  trial_period_days: Optional[int]
67
90
  """The number of free trial days added before a renewal plan."""
68
91
 
92
+ unlimited_stock: Optional[bool]
93
+ """Limits/doesn't limit the number of units available for purchase."""
94
+
69
95
  visibility: Optional[Visibility]
70
96
  """Visibility of a resource"""
71
97
 
@@ -82,9 +82,18 @@ class PlanListResponse(BaseModel):
82
82
  renewal_price: float
83
83
  """The price a person has to pay for a plan on the renewal purchase."""
84
84
 
85
+ stock: Optional[int] = None
86
+ """The number of units available for purchase. Only displayed to authorized actors"""
87
+
88
+ title: Optional[str] = None
89
+ """The title of the plan. This will be visible on the product page to customers."""
90
+
85
91
  trial_period_days: Optional[int] = None
86
92
  """The number of free trial days added before a renewal plan."""
87
93
 
94
+ unlimited_stock: bool
95
+ """Limits/doesn't limit the number of units available for purchase."""
96
+
88
97
  updated_at: datetime
89
98
  """When the plan was last updated."""
90
99
 
@@ -49,12 +49,30 @@ class PlanUpdateParams(TypedDict, total=False):
49
49
  renewal_price: Optional[float]
50
50
  """The amount the customer is charged every billing period."""
51
51
 
52
+ stock: Optional[int]
53
+ """The number of units available for purchase."""
54
+
55
+ strike_through_initial_price: Optional[float]
56
+ """The price to display with a strikethrough for the initial price.
57
+
58
+ Provided as a number in dollars. Eg: 19.99 for $19.99
59
+ """
60
+
61
+ strike_through_renewal_price: Optional[float]
62
+ """The price to display with a strikethrough for the renewal price.
63
+
64
+ Provided as a number in dollars. Eg: 19.99 for $19.99
65
+ """
66
+
52
67
  title: Optional[str]
53
68
  """The title of the plan. This will be visible on the product page to customers."""
54
69
 
55
70
  trial_period_days: Optional[int]
56
71
  """The number of free trial days added before a renewal plan."""
57
72
 
73
+ unlimited_stock: Optional[bool]
74
+ """Limits/doesn't limit the number of units available for purchase."""
75
+
58
76
  visibility: Optional[Visibility]
59
77
  """Visibility of a resource"""
60
78
 
@@ -13,10 +13,9 @@ from .shared.visibility import Visibility
13
13
  from .shared.business_types import BusinessTypes
14
14
  from .shared.industry_types import IndustryTypes
15
15
  from .shared.release_method import ReleaseMethod
16
- from .shared.access_pass_type import AccessPassType
17
16
  from .shared.global_affiliate_status import GlobalAffiliateStatus
18
17
 
19
- __all__ = ["ProductCreateParams", "BannerImage", "PlanOptions", "PlanOptionsCustomField", "ProductHighlight"]
18
+ __all__ = ["ProductCreateParams", "PlanOptions", "PlanOptionsCustomField", "ProductHighlight"]
20
19
 
21
20
 
22
21
  class ProductCreateParams(TypedDict, total=False):
@@ -26,12 +25,6 @@ class ProductCreateParams(TypedDict, total=False):
26
25
  title: Required[str]
27
26
  """The title of the product."""
28
27
 
29
- access_pass_type: Optional[AccessPassType]
30
- """The different types an access pass can be."""
31
-
32
- banner_image: Optional[BannerImage]
33
- """A banner image for the product in png, jpeg format"""
34
-
35
28
  business_type: Optional[BusinessTypes]
36
29
  """The different business types a company can be."""
37
30
 
@@ -94,22 +87,6 @@ class ProductCreateParams(TypedDict, total=False):
94
87
  """Visibility of a resource"""
95
88
 
96
89
 
97
- class BannerImage(TypedDict, total=False):
98
- id: Optional[str]
99
- """The ID of an existing attachment object.
100
-
101
- Use this when updating a resource and keeping a subset of the attachments. Don't
102
- use this unless you know what you're doing.
103
- """
104
-
105
- direct_upload_id: Optional[str]
106
- """This ID should be used the first time you upload an attachment.
107
-
108
- It is the ID of the direct upload that was created when uploading the file to S3
109
- via the mediaDirectUpload mutation.
110
- """
111
-
112
-
113
90
  class PlanOptionsCustomField(TypedDict, total=False):
114
91
  field_type: Required[Literal["text"]]
115
92
  """The type of the custom field."""
@@ -11,7 +11,7 @@ from .shared.business_types import BusinessTypes
11
11
  from .shared.industry_types import IndustryTypes
12
12
  from .shared.global_affiliate_status import GlobalAffiliateStatus
13
13
 
14
- __all__ = ["ProductUpdateParams", "BannerImage"]
14
+ __all__ = ["ProductUpdateParams", "BannerImage", "StorePageConfig"]
15
15
 
16
16
 
17
17
  class ProductUpdateParams(TypedDict, total=False):
@@ -67,6 +67,9 @@ class ProductUpdateParams(TypedDict, total=False):
67
67
  route: Optional[str]
68
68
  """The route of the product."""
69
69
 
70
+ store_page_config: Optional[StorePageConfig]
71
+ """Configuration for a product on the company's store page."""
72
+
70
73
  title: Optional[str]
71
74
  """The title of the product."""
72
75
 
@@ -88,3 +91,11 @@ class BannerImage(TypedDict, total=False):
88
91
  It is the ID of the direct upload that was created when uploading the file to S3
89
92
  via the mediaDirectUpload mutation.
90
93
  """
94
+
95
+
96
+ class StorePageConfig(TypedDict, total=False):
97
+ custom_cta: Optional[str]
98
+ """Custom call-to-action text for the product's store page."""
99
+
100
+ show_price: Optional[bool]
101
+ """Whether or not to show the price on the product's store page."""
@@ -0,0 +1,90 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+ from datetime import datetime
5
+
6
+ from .._models import BaseModel
7
+ from .promo_duration import PromoDuration
8
+ from .shared.currency import Currency
9
+ from .promo_code_status import PromoCodeStatus
10
+ from .shared.promo_type import PromoType
11
+
12
+ __all__ = ["PromoCode", "Company", "Product"]
13
+
14
+
15
+ class Company(BaseModel):
16
+ id: str
17
+ """The ID of the company"""
18
+
19
+ title: str
20
+ """The written name of the company."""
21
+
22
+
23
+ class Product(BaseModel):
24
+ id: str
25
+ """The internal ID of the public product."""
26
+
27
+ title: str
28
+ """The title of the product. Use for Whop 4.0."""
29
+
30
+
31
+ class PromoCode(BaseModel):
32
+ id: str
33
+ """The ID of the promo."""
34
+
35
+ amount_off: float
36
+ """The amount off (% or flat amount) for the promo."""
37
+
38
+ churned_users_only: bool
39
+ """Restricts promo use to only users who have churned from the company before."""
40
+
41
+ code: Optional[str] = None
42
+ """The specific code used to apply the promo at checkout."""
43
+
44
+ company: Company
45
+ """The company for the promo code."""
46
+
47
+ created_at: datetime
48
+ """The timestamp of when the promo was created."""
49
+
50
+ currency: Currency
51
+ """The monetary currency of the promo code."""
52
+
53
+ duration: Optional[PromoDuration] = None
54
+ """The duration setting for the promo code"""
55
+
56
+ existing_memberships_only: bool
57
+ """Restricts promo use to only be applied to already purchased memberships."""
58
+
59
+ expires_at: Optional[datetime] = None
60
+ """The date/time of when the promo expires."""
61
+
62
+ new_users_only: bool
63
+ """
64
+ Restricts promo use to only users who have never purchased from the company
65
+ before.
66
+ """
67
+
68
+ one_per_customer: bool
69
+ """Restricts promo use to only be applied once per customer."""
70
+
71
+ product: Optional[Product] = None
72
+ """The access pass associated with the promo code."""
73
+
74
+ promo_duration_months: Optional[int] = None
75
+ """The number of months the promo is applied for."""
76
+
77
+ promo_type: PromoType
78
+ """The type (% or flat amount) of the promo."""
79
+
80
+ status: PromoCodeStatus
81
+ """Indicates if the promo code is live or disabled."""
82
+
83
+ stock: int
84
+ """The quantity limit on the number of uses."""
85
+
86
+ unlimited_stock: bool
87
+ """Whether or not the promo code has unlimited stock."""
88
+
89
+ uses: int
90
+ """The amount of times the promo codes has been used."""
@@ -0,0 +1,70 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union, Optional
6
+ from datetime import datetime
7
+ from typing_extensions import Required, Annotated, TypedDict
8
+
9
+ from .._types import SequenceNotStr
10
+ from .._utils import PropertyInfo
11
+ from .shared.currency import Currency
12
+ from .shared.promo_type import PromoType
13
+
14
+ __all__ = ["PromoCodeCreateParams"]
15
+
16
+
17
+ class PromoCodeCreateParams(TypedDict, total=False):
18
+ amount_off: Required[float]
19
+ """The amount off (% or flat amount) for the promo."""
20
+
21
+ base_currency: Required[Currency]
22
+ """The monetary currency of the promo code."""
23
+
24
+ code: Required[str]
25
+ """The specific code used to apply the promo at checkout."""
26
+
27
+ company_id: Required[str]
28
+ """The id of the company to create the promo code for."""
29
+
30
+ new_users_only: Required[bool]
31
+ """
32
+ Restricts promo use to only users who have never purchased from the company
33
+ before.
34
+ """
35
+
36
+ promo_duration_months: Required[int]
37
+ """The number of months this promo code is applied and valid for."""
38
+
39
+ promo_type: Required[PromoType]
40
+ """The type (% or flat amount) of the promo."""
41
+
42
+ churned_users_only: Optional[bool]
43
+ """Restricts promo use to only users who have churned from the company before."""
44
+
45
+ existing_memberships_only: Optional[bool]
46
+ """Whether this promo code is for existing memberships only (cancelations)"""
47
+
48
+ expires_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
49
+ """The date/time of when the promo expires."""
50
+
51
+ one_per_customer: Optional[bool]
52
+ """Restricts promo use to only be applied once per customer."""
53
+
54
+ plan_ids: Optional[SequenceNotStr[str]]
55
+ """The IDs of the plans that the promo code applies to.
56
+
57
+ If product_id is provided, it will only apply to plans attached to that product
58
+ """
59
+
60
+ product_id: Optional[str]
61
+ """The product to lock the promo code to, if any.
62
+
63
+ If provided will filter out any plan ids not attached to this product
64
+ """
65
+
66
+ stock: Optional[int]
67
+ """The quantity limit on the number of uses."""
68
+
69
+ unlimited_stock: Optional[bool]
70
+ """Whether or not the promo code should have unlimited stock."""
@@ -0,0 +1,7 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing_extensions import TypeAlias
4
+
5
+ __all__ = ["PromoCodeDeleteResponse"]
6
+
7
+ PromoCodeDeleteResponse: TypeAlias = bool
@@ -0,0 +1,37 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Required, TypedDict
7
+
8
+ from .._types import SequenceNotStr
9
+ from .promo_code_status import PromoCodeStatus
10
+
11
+ __all__ = ["PromoCodeListParams"]
12
+
13
+
14
+ class PromoCodeListParams(TypedDict, total=False):
15
+ company_id: Required[str]
16
+ """The ID of the company to list promo codes for"""
17
+
18
+ after: Optional[str]
19
+ """Returns the elements in the list that come after the specified cursor."""
20
+
21
+ before: Optional[str]
22
+ """Returns the elements in the list that come before the specified cursor."""
23
+
24
+ first: Optional[int]
25
+ """Returns the first _n_ elements from the list."""
26
+
27
+ last: Optional[int]
28
+ """Returns the last _n_ elements from the list."""
29
+
30
+ plan_ids: Optional[SequenceNotStr[str]]
31
+ """Filter promo codes by plan ID(s)"""
32
+
33
+ product_ids: Optional[SequenceNotStr[str]]
34
+ """Filter promo codes by product ID(s)"""
35
+
36
+ status: Optional[PromoCodeStatus]
37
+ """Statuses for promo codes"""