whop-sdk 0.0.10__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.
Files changed (352) hide show
  1. whop_sdk/__init__.py +94 -0
  2. whop_sdk/_base_client.py +1995 -0
  3. whop_sdk/_client.py +800 -0
  4. whop_sdk/_compat.py +219 -0
  5. whop_sdk/_constants.py +14 -0
  6. whop_sdk/_exceptions.py +112 -0
  7. whop_sdk/_files.py +123 -0
  8. whop_sdk/_models.py +857 -0
  9. whop_sdk/_qs.py +150 -0
  10. whop_sdk/_resource.py +43 -0
  11. whop_sdk/_response.py +830 -0
  12. whop_sdk/_streaming.py +333 -0
  13. whop_sdk/_types.py +260 -0
  14. whop_sdk/_utils/__init__.py +64 -0
  15. whop_sdk/_utils/_compat.py +45 -0
  16. whop_sdk/_utils/_datetime_parse.py +136 -0
  17. whop_sdk/_utils/_logs.py +25 -0
  18. whop_sdk/_utils/_proxy.py +65 -0
  19. whop_sdk/_utils/_reflection.py +42 -0
  20. whop_sdk/_utils/_resources_proxy.py +24 -0
  21. whop_sdk/_utils/_streams.py +12 -0
  22. whop_sdk/_utils/_sync.py +58 -0
  23. whop_sdk/_utils/_transform.py +457 -0
  24. whop_sdk/_utils/_typing.py +156 -0
  25. whop_sdk/_utils/_utils.py +421 -0
  26. whop_sdk/_version.py +4 -0
  27. whop_sdk/lib/.keep +4 -0
  28. whop_sdk/pagination.py +61 -0
  29. whop_sdk/py.typed +0 -0
  30. whop_sdk/resources/__init__.py +540 -0
  31. whop_sdk/resources/access_tokens.py +341 -0
  32. whop_sdk/resources/account_links.py +211 -0
  33. whop_sdk/resources/app_builds.py +587 -0
  34. whop_sdk/resources/apps.py +684 -0
  35. whop_sdk/resources/authorized_users.py +353 -0
  36. whop_sdk/resources/chat_channels.py +469 -0
  37. whop_sdk/resources/checkout_configurations.py +776 -0
  38. whop_sdk/resources/companies.py +465 -0
  39. whop_sdk/resources/course_chapters.py +602 -0
  40. whop_sdk/resources/course_lesson_interactions.py +343 -0
  41. whop_sdk/resources/course_lessons.py +1040 -0
  42. whop_sdk/resources/course_students.py +327 -0
  43. whop_sdk/resources/courses.py +776 -0
  44. whop_sdk/resources/disputes.py +693 -0
  45. whop_sdk/resources/entries.py +556 -0
  46. whop_sdk/resources/experiences.py +983 -0
  47. whop_sdk/resources/forum_posts.py +656 -0
  48. whop_sdk/resources/forums.py +446 -0
  49. whop_sdk/resources/invoices.py +1099 -0
  50. whop_sdk/resources/ledger_accounts.py +171 -0
  51. whop_sdk/resources/members.py +429 -0
  52. whop_sdk/resources/memberships.py +818 -0
  53. whop_sdk/resources/messages.py +558 -0
  54. whop_sdk/resources/notifications.py +388 -0
  55. whop_sdk/resources/payment_tokens.py +359 -0
  56. whop_sdk/resources/payments.py +1040 -0
  57. whop_sdk/resources/plans.py +1001 -0
  58. whop_sdk/resources/products.py +970 -0
  59. whop_sdk/resources/promo_codes.py +668 -0
  60. whop_sdk/resources/reactions.py +423 -0
  61. whop_sdk/resources/refunds.py +347 -0
  62. whop_sdk/resources/reviews.py +332 -0
  63. whop_sdk/resources/setup_intents.py +349 -0
  64. whop_sdk/resources/shipments.py +451 -0
  65. whop_sdk/resources/support_channels.py +455 -0
  66. whop_sdk/resources/transfers.py +513 -0
  67. whop_sdk/resources/users.py +248 -0
  68. whop_sdk/resources/webhooks.py +69 -0
  69. whop_sdk/resources/withdrawals.py +341 -0
  70. whop_sdk/types/__init__.py +262 -0
  71. whop_sdk/types/access_token_create_params.py +64 -0
  72. whop_sdk/types/access_token_create_response.py +15 -0
  73. whop_sdk/types/account_link_create_params.py +27 -0
  74. whop_sdk/types/account_link_create_response.py +15 -0
  75. whop_sdk/types/app_build_create_params.py +72 -0
  76. whop_sdk/types/app_build_list_params.py +42 -0
  77. whop_sdk/types/app_build_list_response.py +50 -0
  78. whop_sdk/types/app_create_params.py +19 -0
  79. whop_sdk/types/app_list_params.py +59 -0
  80. whop_sdk/types/app_list_response.py +110 -0
  81. whop_sdk/types/app_type.py +7 -0
  82. whop_sdk/types/app_update_params.py +67 -0
  83. whop_sdk/types/assessment_question_types.py +7 -0
  84. whop_sdk/types/authorized_user_list_params.py +41 -0
  85. whop_sdk/types/authorized_user_list_response.py +33 -0
  86. whop_sdk/types/authorized_user_retrieve_response.py +33 -0
  87. whop_sdk/types/billing_reasons.py +9 -0
  88. whop_sdk/types/card_brands.py +25 -0
  89. whop_sdk/types/chat_channel_list_params.py +28 -0
  90. whop_sdk/types/chat_channel_list_response.py +43 -0
  91. whop_sdk/types/chat_channel_update_params.py +32 -0
  92. whop_sdk/types/checkout_configuration_create_params.py +373 -0
  93. whop_sdk/types/checkout_configuration_list_params.py +41 -0
  94. whop_sdk/types/checkout_configuration_list_response.py +104 -0
  95. whop_sdk/types/checkout_modes.py +7 -0
  96. whop_sdk/types/company_create_params.py +22 -0
  97. whop_sdk/types/company_list_params.py +38 -0
  98. whop_sdk/types/company_list_response.py +76 -0
  99. whop_sdk/types/course.py +122 -0
  100. whop_sdk/types/course_chapter.py +32 -0
  101. whop_sdk/types/course_chapter_create_params.py +16 -0
  102. whop_sdk/types/course_chapter_delete_response.py +7 -0
  103. whop_sdk/types/course_chapter_list_params.py +25 -0
  104. whop_sdk/types/course_chapter_list_response.py +16 -0
  105. whop_sdk/types/course_chapter_update_params.py +12 -0
  106. whop_sdk/types/course_create_params.py +78 -0
  107. whop_sdk/types/course_delete_response.py +7 -0
  108. whop_sdk/types/course_lesson_create_params.py +63 -0
  109. whop_sdk/types/course_lesson_delete_response.py +7 -0
  110. whop_sdk/types/course_lesson_interaction_completed_webhook_event.py +26 -0
  111. whop_sdk/types/course_lesson_interaction_list_params.py +34 -0
  112. whop_sdk/types/course_lesson_list_params.py +28 -0
  113. whop_sdk/types/course_lesson_list_response.py +57 -0
  114. whop_sdk/types/course_lesson_mark_as_completed_response.py +7 -0
  115. whop_sdk/types/course_lesson_start_response.py +7 -0
  116. whop_sdk/types/course_lesson_submit_assessment_params.py +26 -0
  117. whop_sdk/types/course_lesson_submit_assessment_response.py +62 -0
  118. whop_sdk/types/course_lesson_update_params.py +222 -0
  119. whop_sdk/types/course_list_params.py +28 -0
  120. whop_sdk/types/course_list_response.py +90 -0
  121. whop_sdk/types/course_student_list_params.py +28 -0
  122. whop_sdk/types/course_student_list_response.py +42 -0
  123. whop_sdk/types/course_student_retrieve_response.py +61 -0
  124. whop_sdk/types/course_update_params.py +114 -0
  125. whop_sdk/types/course_visibilities.py +7 -0
  126. whop_sdk/types/dispute.py +284 -0
  127. whop_sdk/types/dispute_created_webhook_event.py +26 -0
  128. whop_sdk/types/dispute_list_params.py +38 -0
  129. whop_sdk/types/dispute_list_response.py +77 -0
  130. whop_sdk/types/dispute_statuses.py +17 -0
  131. whop_sdk/types/dispute_update_evidence_params.py +159 -0
  132. whop_sdk/types/dispute_updated_webhook_event.py +26 -0
  133. whop_sdk/types/embed_type.py +7 -0
  134. whop_sdk/types/entry_approve_response.py +10 -0
  135. whop_sdk/types/entry_approved_webhook_event.py +26 -0
  136. whop_sdk/types/entry_created_webhook_event.py +26 -0
  137. whop_sdk/types/entry_deleted_webhook_event.py +26 -0
  138. whop_sdk/types/entry_denied_webhook_event.py +26 -0
  139. whop_sdk/types/entry_list_params.py +52 -0
  140. whop_sdk/types/entry_list_response.py +56 -0
  141. whop_sdk/types/experience_attach_params.py +12 -0
  142. whop_sdk/types/experience_create_params.py +22 -0
  143. whop_sdk/types/experience_delete_response.py +7 -0
  144. whop_sdk/types/experience_detach_params.py +12 -0
  145. whop_sdk/types/experience_duplicate_params.py +13 -0
  146. whop_sdk/types/experience_list_params.py +40 -0
  147. whop_sdk/types/experience_list_response.py +73 -0
  148. whop_sdk/types/experience_update_params.py +46 -0
  149. whop_sdk/types/forum_list_params.py +28 -0
  150. whop_sdk/types/forum_list_response.py +33 -0
  151. whop_sdk/types/forum_post_create_params.py +101 -0
  152. whop_sdk/types/forum_post_list_params.py +31 -0
  153. whop_sdk/types/forum_post_list_response.py +60 -0
  154. whop_sdk/types/forum_post_update_params.py +56 -0
  155. whop_sdk/types/forum_post_visibility_type.py +7 -0
  156. whop_sdk/types/forum_update_params.py +23 -0
  157. whop_sdk/types/invoice_create_params.py +515 -0
  158. whop_sdk/types/invoice_created_webhook_event.py +26 -0
  159. whop_sdk/types/invoice_list_params.py +53 -0
  160. whop_sdk/types/invoice_paid_webhook_event.py +26 -0
  161. whop_sdk/types/invoice_past_due_webhook_event.py +26 -0
  162. whop_sdk/types/invoice_void_response.py +7 -0
  163. whop_sdk/types/invoice_voided_webhook_event.py +26 -0
  164. whop_sdk/types/languages.py +30 -0
  165. whop_sdk/types/ledger_account_retrieve_response.py +93 -0
  166. whop_sdk/types/lesson.py +219 -0
  167. whop_sdk/types/lesson_types.py +7 -0
  168. whop_sdk/types/lesson_visibilities.py +7 -0
  169. whop_sdk/types/member_list_params.py +73 -0
  170. whop_sdk/types/member_list_response.py +65 -0
  171. whop_sdk/types/member_retrieve_response.py +79 -0
  172. whop_sdk/types/membership_activated_webhook_event.py +29 -0
  173. whop_sdk/types/membership_cancel_params.py +13 -0
  174. whop_sdk/types/membership_deactivated_webhook_event.py +29 -0
  175. whop_sdk/types/membership_list_params.py +73 -0
  176. whop_sdk/types/membership_list_response.py +128 -0
  177. whop_sdk/types/membership_pause_params.py +16 -0
  178. whop_sdk/types/membership_update_params.py +13 -0
  179. whop_sdk/types/message_create_params.py +63 -0
  180. whop_sdk/types/message_list_params.py +30 -0
  181. whop_sdk/types/message_list_response.py +90 -0
  182. whop_sdk/types/message_update_params.py +45 -0
  183. whop_sdk/types/notification_create_params.py +93 -0
  184. whop_sdk/types/notification_create_response.py +10 -0
  185. whop_sdk/types/payment_create_params.py +162 -0
  186. whop_sdk/types/payment_failed_webhook_event.py +26 -0
  187. whop_sdk/types/payment_list_params.py +67 -0
  188. whop_sdk/types/payment_list_response.py +273 -0
  189. whop_sdk/types/payment_method_types.py +94 -0
  190. whop_sdk/types/payment_pending_webhook_event.py +26 -0
  191. whop_sdk/types/payment_provider.py +9 -0
  192. whop_sdk/types/payment_refund_params.py +13 -0
  193. whop_sdk/types/payment_succeeded_webhook_event.py +26 -0
  194. whop_sdk/types/payment_token_list_params.py +38 -0
  195. whop_sdk/types/payment_token_list_response.py +41 -0
  196. whop_sdk/types/payment_token_retrieve_params.py +12 -0
  197. whop_sdk/types/payment_token_retrieve_response.py +41 -0
  198. whop_sdk/types/plan_create_params.py +162 -0
  199. whop_sdk/types/plan_delete_response.py +7 -0
  200. whop_sdk/types/plan_list_params.py +57 -0
  201. whop_sdk/types/plan_list_response.py +128 -0
  202. whop_sdk/types/plan_update_params.py +155 -0
  203. whop_sdk/types/product_create_params.py +147 -0
  204. whop_sdk/types/product_delete_response.py +7 -0
  205. whop_sdk/types/product_list_params.py +49 -0
  206. whop_sdk/types/product_update_params.py +82 -0
  207. whop_sdk/types/promo_code.py +90 -0
  208. whop_sdk/types/promo_code_create_params.py +70 -0
  209. whop_sdk/types/promo_code_delete_response.py +7 -0
  210. whop_sdk/types/promo_code_list_params.py +45 -0
  211. whop_sdk/types/promo_code_list_response.py +79 -0
  212. whop_sdk/types/promo_code_status.py +7 -0
  213. whop_sdk/types/promo_duration.py +7 -0
  214. whop_sdk/types/reaction_create_params.py +19 -0
  215. whop_sdk/types/reaction_list_params.py +25 -0
  216. whop_sdk/types/reaction_list_response.py +32 -0
  217. whop_sdk/types/refund_created_webhook_event.py +154 -0
  218. whop_sdk/types/refund_list_params.py +38 -0
  219. whop_sdk/types/refund_list_response.py +53 -0
  220. whop_sdk/types/refund_reference_status.py +7 -0
  221. whop_sdk/types/refund_reference_type.py +9 -0
  222. whop_sdk/types/refund_retrieve_response.py +129 -0
  223. whop_sdk/types/refund_status.py +7 -0
  224. whop_sdk/types/refund_updated_webhook_event.py +154 -0
  225. whop_sdk/types/review_list_params.py +40 -0
  226. whop_sdk/types/review_list_response.py +78 -0
  227. whop_sdk/types/review_retrieve_response.py +103 -0
  228. whop_sdk/types/review_status.py +7 -0
  229. whop_sdk/types/setup_intent.py +111 -0
  230. whop_sdk/types/setup_intent_canceled_webhook_event.py +29 -0
  231. whop_sdk/types/setup_intent_list_params.py +38 -0
  232. whop_sdk/types/setup_intent_list_response.py +111 -0
  233. whop_sdk/types/setup_intent_requires_action_webhook_event.py +29 -0
  234. whop_sdk/types/setup_intent_status.py +7 -0
  235. whop_sdk/types/setup_intent_succeeded_webhook_event.py +29 -0
  236. whop_sdk/types/shared/__init__.py +62 -0
  237. whop_sdk/types/shared/access_level.py +7 -0
  238. whop_sdk/types/shared/access_pass_type.py +7 -0
  239. whop_sdk/types/shared/app.py +187 -0
  240. whop_sdk/types/shared/app_build.py +50 -0
  241. whop_sdk/types/shared/app_build_platforms.py +7 -0
  242. whop_sdk/types/shared/app_build_statuses.py +7 -0
  243. whop_sdk/types/shared/app_statuses.py +7 -0
  244. whop_sdk/types/shared/app_view_type.py +7 -0
  245. whop_sdk/types/shared/authorized_user_roles.py +9 -0
  246. whop_sdk/types/shared/business_types.py +22 -0
  247. whop_sdk/types/shared/chat_channel.py +43 -0
  248. whop_sdk/types/shared/checkout_configuration.py +104 -0
  249. whop_sdk/types/shared/collection_method.py +7 -0
  250. whop_sdk/types/shared/company.py +91 -0
  251. whop_sdk/types/shared/course_lesson_interaction.py +63 -0
  252. whop_sdk/types/shared/course_lesson_interaction_list_item.py +44 -0
  253. whop_sdk/types/shared/currency.py +93 -0
  254. whop_sdk/types/shared/custom_cta.py +21 -0
  255. whop_sdk/types/shared/direction.py +7 -0
  256. whop_sdk/types/shared/dms_post_types.py +7 -0
  257. whop_sdk/types/shared/email_notification_preferences.py +7 -0
  258. whop_sdk/types/shared/entry.py +70 -0
  259. whop_sdk/types/shared/entry_status.py +7 -0
  260. whop_sdk/types/shared/experience.py +91 -0
  261. whop_sdk/types/shared/forum.py +33 -0
  262. whop_sdk/types/shared/forum_post.py +60 -0
  263. whop_sdk/types/shared/friendly_receipt_status.py +24 -0
  264. whop_sdk/types/shared/global_affiliate_status.py +7 -0
  265. whop_sdk/types/shared/industry_types.py +67 -0
  266. whop_sdk/types/shared/invoice.py +64 -0
  267. whop_sdk/types/shared/invoice_list_item.py +64 -0
  268. whop_sdk/types/shared/invoice_status.py +7 -0
  269. whop_sdk/types/shared/member_most_recent_actions.py +22 -0
  270. whop_sdk/types/shared/member_statuses.py +7 -0
  271. whop_sdk/types/shared/membership.py +128 -0
  272. whop_sdk/types/shared/membership_status.py +9 -0
  273. whop_sdk/types/shared/message.py +90 -0
  274. whop_sdk/types/shared/page_info.py +21 -0
  275. whop_sdk/types/shared/payment.py +273 -0
  276. whop_sdk/types/shared/plan.py +159 -0
  277. whop_sdk/types/shared/plan_type.py +7 -0
  278. whop_sdk/types/shared/product.py +132 -0
  279. whop_sdk/types/shared/product_list_item.py +57 -0
  280. whop_sdk/types/shared/promo_type.py +7 -0
  281. whop_sdk/types/shared/reaction.py +32 -0
  282. whop_sdk/types/shared/receipt_status.py +7 -0
  283. whop_sdk/types/shared/release_method.py +7 -0
  284. whop_sdk/types/shared/shipment.py +48 -0
  285. whop_sdk/types/shared/shipment_carrier.py +84 -0
  286. whop_sdk/types/shared/shipment_status.py +18 -0
  287. whop_sdk/types/shared/shipment_substatus.py +36 -0
  288. whop_sdk/types/shared/support_channel.py +39 -0
  289. whop_sdk/types/shared/tax_type.py +7 -0
  290. whop_sdk/types/shared/transfer.py +112 -0
  291. whop_sdk/types/shared/visibility.py +7 -0
  292. whop_sdk/types/shared/visibility_filter.py +9 -0
  293. whop_sdk/types/shared/who_can_comment_types.py +7 -0
  294. whop_sdk/types/shared/who_can_post.py +7 -0
  295. whop_sdk/types/shared/who_can_post_types.py +7 -0
  296. whop_sdk/types/shared/who_can_react.py +7 -0
  297. whop_sdk/types/shared_params/__init__.py +34 -0
  298. whop_sdk/types/shared_params/access_level.py +9 -0
  299. whop_sdk/types/shared_params/access_pass_type.py +9 -0
  300. whop_sdk/types/shared_params/app_build_platforms.py +9 -0
  301. whop_sdk/types/shared_params/app_build_statuses.py +9 -0
  302. whop_sdk/types/shared_params/app_statuses.py +9 -0
  303. whop_sdk/types/shared_params/app_view_type.py +9 -0
  304. whop_sdk/types/shared_params/authorized_user_roles.py +11 -0
  305. whop_sdk/types/shared_params/business_types.py +24 -0
  306. whop_sdk/types/shared_params/collection_method.py +9 -0
  307. whop_sdk/types/shared_params/currency.py +95 -0
  308. whop_sdk/types/shared_params/custom_cta.py +23 -0
  309. whop_sdk/types/shared_params/direction.py +9 -0
  310. whop_sdk/types/shared_params/email_notification_preferences.py +9 -0
  311. whop_sdk/types/shared_params/entry_status.py +9 -0
  312. whop_sdk/types/shared_params/friendly_receipt_status.py +26 -0
  313. whop_sdk/types/shared_params/global_affiliate_status.py +9 -0
  314. whop_sdk/types/shared_params/industry_types.py +69 -0
  315. whop_sdk/types/shared_params/invoice_status.py +9 -0
  316. whop_sdk/types/shared_params/member_most_recent_actions.py +24 -0
  317. whop_sdk/types/shared_params/member_statuses.py +9 -0
  318. whop_sdk/types/shared_params/membership_status.py +11 -0
  319. whop_sdk/types/shared_params/plan_type.py +9 -0
  320. whop_sdk/types/shared_params/promo_type.py +9 -0
  321. whop_sdk/types/shared_params/receipt_status.py +9 -0
  322. whop_sdk/types/shared_params/release_method.py +9 -0
  323. whop_sdk/types/shared_params/tax_type.py +9 -0
  324. whop_sdk/types/shared_params/visibility.py +9 -0
  325. whop_sdk/types/shared_params/visibility_filter.py +11 -0
  326. whop_sdk/types/shared_params/who_can_comment_types.py +9 -0
  327. whop_sdk/types/shared_params/who_can_post.py +9 -0
  328. whop_sdk/types/shared_params/who_can_post_types.py +9 -0
  329. whop_sdk/types/shared_params/who_can_react.py +9 -0
  330. whop_sdk/types/shipment_create_params.py +18 -0
  331. whop_sdk/types/shipment_list_params.py +31 -0
  332. whop_sdk/types/shipment_list_response.py +48 -0
  333. whop_sdk/types/support_channel_create_params.py +15 -0
  334. whop_sdk/types/support_channel_list_params.py +40 -0
  335. whop_sdk/types/support_channel_list_response.py +39 -0
  336. whop_sdk/types/transfer_create_params.py +39 -0
  337. whop_sdk/types/transfer_list_params.py +50 -0
  338. whop_sdk/types/transfer_list_response.py +38 -0
  339. whop_sdk/types/unwrap_webhook_event.py +52 -0
  340. whop_sdk/types/user_check_access_response.py +14 -0
  341. whop_sdk/types/user_retrieve_response.py +36 -0
  342. whop_sdk/types/withdrawal_fee_types.py +7 -0
  343. whop_sdk/types/withdrawal_list_params.py +38 -0
  344. whop_sdk/types/withdrawal_list_response.py +45 -0
  345. whop_sdk/types/withdrawal_retrieve_response.py +154 -0
  346. whop_sdk/types/withdrawal_speeds.py +7 -0
  347. whop_sdk/types/withdrawal_status.py +9 -0
  348. whop_sdk/types/withdrawal_types.py +7 -0
  349. whop_sdk-0.0.10.dist-info/METADATA +509 -0
  350. whop_sdk-0.0.10.dist-info/RECORD +352 -0
  351. whop_sdk-0.0.10.dist-info/WHEEL +4 -0
  352. whop_sdk-0.0.10.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,1001 @@
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 List, Union, Iterable, Optional
6
+ from datetime import datetime
7
+ from typing_extensions import Literal
8
+
9
+ import httpx
10
+
11
+ from ..types import plan_list_params, plan_create_params, plan_update_params
12
+ from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
13
+ from .._utils import maybe_transform, async_maybe_transform
14
+ from .._compat import cached_property
15
+ from .._resource import SyncAPIResource, AsyncAPIResource
16
+ from .._response import (
17
+ to_raw_response_wrapper,
18
+ to_streamed_response_wrapper,
19
+ async_to_raw_response_wrapper,
20
+ async_to_streamed_response_wrapper,
21
+ )
22
+ from ..pagination import SyncCursorPage, AsyncCursorPage
23
+ from .._base_client import AsyncPaginator, make_request_options
24
+ from ..types.shared.plan import Plan
25
+ from ..types.shared.currency import Currency
26
+ from ..types.shared.tax_type import TaxType
27
+ from ..types.shared.direction import Direction
28
+ from ..types.shared.plan_type import PlanType
29
+ from ..types.shared.visibility import Visibility
30
+ from ..types.plan_list_response import PlanListResponse
31
+ from ..types.plan_delete_response import PlanDeleteResponse
32
+ from ..types.shared.release_method import ReleaseMethod
33
+ from ..types.shared.visibility_filter import VisibilityFilter
34
+
35
+ __all__ = ["PlansResource", "AsyncPlansResource"]
36
+
37
+
38
+ class PlansResource(SyncAPIResource):
39
+ @cached_property
40
+ def with_raw_response(self) -> PlansResourceWithRawResponse:
41
+ """
42
+ This property can be used as a prefix for any HTTP method call to return
43
+ the raw response object instead of the parsed content.
44
+
45
+ For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
46
+ """
47
+ return PlansResourceWithRawResponse(self)
48
+
49
+ @cached_property
50
+ def with_streaming_response(self) -> PlansResourceWithStreamingResponse:
51
+ """
52
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
53
+
54
+ For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
55
+ """
56
+ return PlansResourceWithStreamingResponse(self)
57
+
58
+ def create(
59
+ self,
60
+ *,
61
+ company_id: str,
62
+ product_id: str,
63
+ billing_period: Optional[int] | Omit = omit,
64
+ currency: Optional[Currency] | Omit = omit,
65
+ custom_fields: Optional[Iterable[plan_create_params.CustomField]] | Omit = omit,
66
+ description: Optional[str] | Omit = omit,
67
+ expiration_days: Optional[int] | Omit = omit,
68
+ image: Optional[plan_create_params.Image] | Omit = omit,
69
+ initial_price: Optional[float] | Omit = omit,
70
+ internal_notes: Optional[str] | Omit = omit,
71
+ override_tax_type: Optional[TaxType] | Omit = omit,
72
+ payment_method_configuration: Optional[plan_create_params.PaymentMethodConfiguration] | Omit = omit,
73
+ plan_type: Optional[PlanType] | Omit = omit,
74
+ release_method: Optional[ReleaseMethod] | Omit = omit,
75
+ renewal_price: Optional[float] | Omit = omit,
76
+ stock: Optional[int] | Omit = omit,
77
+ title: Optional[str] | Omit = omit,
78
+ trial_period_days: Optional[int] | Omit = omit,
79
+ unlimited_stock: Optional[bool] | Omit = omit,
80
+ visibility: Optional[Visibility] | Omit = omit,
81
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
82
+ # The extra values given here take precedence over values defined on the client or passed to this method.
83
+ extra_headers: Headers | None = None,
84
+ extra_query: Query | None = None,
85
+ extra_body: Body | None = None,
86
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
87
+ ) -> Plan:
88
+ """
89
+ Create a new Plan
90
+
91
+ Required permissions:
92
+
93
+ - `plan:create`
94
+ - `access_pass:basic:read`
95
+ - `plan:basic:read`
96
+
97
+ Args:
98
+ company_id: The company the plan should be created for.
99
+
100
+ product_id: The product the plan is related to.
101
+
102
+ billing_period: The interval in days at which the plan charges (renewal plans).
103
+
104
+ currency: The available currencies on the platform
105
+
106
+ custom_fields: An array of custom field objects.
107
+
108
+ description: The description of the plan.
109
+
110
+ expiration_days: The interval at which the plan expires and revokes access (expiration plans).
111
+
112
+ image: An image for the plan. This will be visible on the product page to customers.
113
+
114
+ initial_price: An additional amount charged upon first purchase. Use only if a one time payment
115
+ OR you want to charge an additional amount on top of the renewal price. Provided
116
+ as a number in dollars. Eg: 10.43 for $10.43
117
+
118
+ internal_notes: A personal description or notes section for the business.
119
+
120
+ override_tax_type: Whether or not the tax is included in a plan's price (or if it hasn't been set
121
+ up)
122
+
123
+ payment_method_configuration: The explicit payment method configuration for the plan. If not provided, the
124
+ platform or company's defaults will apply.
125
+
126
+ plan_type: The type of plan that can be attached to a product
127
+
128
+ release_method: The methods of how a plan can be released.
129
+
130
+ renewal_price: The amount the customer is charged every billing period. Use only if a recurring
131
+ payment. Provided as a number in dollars. Eg: 10.43 for $10.43
132
+
133
+ stock: The number of units available for purchase.
134
+
135
+ title: The title of the plan. This will be visible on the product page to customers.
136
+
137
+ trial_period_days: The number of free trial days added before a renewal plan.
138
+
139
+ unlimited_stock: Limits/doesn't limit the number of units available for purchase.
140
+
141
+ visibility: Visibility of a resource
142
+
143
+ extra_headers: Send extra headers
144
+
145
+ extra_query: Add additional query parameters to the request
146
+
147
+ extra_body: Add additional JSON properties to the request
148
+
149
+ timeout: Override the client-level default timeout for this request, in seconds
150
+ """
151
+ return self._post(
152
+ "/plans",
153
+ body=maybe_transform(
154
+ {
155
+ "company_id": company_id,
156
+ "product_id": product_id,
157
+ "billing_period": billing_period,
158
+ "currency": currency,
159
+ "custom_fields": custom_fields,
160
+ "description": description,
161
+ "expiration_days": expiration_days,
162
+ "image": image,
163
+ "initial_price": initial_price,
164
+ "internal_notes": internal_notes,
165
+ "override_tax_type": override_tax_type,
166
+ "payment_method_configuration": payment_method_configuration,
167
+ "plan_type": plan_type,
168
+ "release_method": release_method,
169
+ "renewal_price": renewal_price,
170
+ "stock": stock,
171
+ "title": title,
172
+ "trial_period_days": trial_period_days,
173
+ "unlimited_stock": unlimited_stock,
174
+ "visibility": visibility,
175
+ },
176
+ plan_create_params.PlanCreateParams,
177
+ ),
178
+ options=make_request_options(
179
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
180
+ ),
181
+ cast_to=Plan,
182
+ )
183
+
184
+ def retrieve(
185
+ self,
186
+ id: str,
187
+ *,
188
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
189
+ # The extra values given here take precedence over values defined on the client or passed to this method.
190
+ extra_headers: Headers | None = None,
191
+ extra_query: Query | None = None,
192
+ extra_body: Body | None = None,
193
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
194
+ ) -> Plan:
195
+ """
196
+ Retrieves a plan by ID
197
+
198
+ Required permissions:
199
+
200
+ - `plan:basic:read`
201
+
202
+ Args:
203
+ extra_headers: Send extra headers
204
+
205
+ extra_query: Add additional query parameters to the request
206
+
207
+ extra_body: Add additional JSON properties to the request
208
+
209
+ timeout: Override the client-level default timeout for this request, in seconds
210
+ """
211
+ if not id:
212
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
213
+ return self._get(
214
+ f"/plans/{id}",
215
+ options=make_request_options(
216
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
217
+ ),
218
+ cast_to=Plan,
219
+ )
220
+
221
+ def update(
222
+ self,
223
+ id: str,
224
+ *,
225
+ billing_period: Optional[int] | Omit = omit,
226
+ currency: Optional[Currency] | Omit = omit,
227
+ custom_fields: Optional[Iterable[plan_update_params.CustomField]] | Omit = omit,
228
+ description: Optional[str] | Omit = omit,
229
+ expiration_days: Optional[int] | Omit = omit,
230
+ image: Optional[plan_update_params.Image] | Omit = omit,
231
+ initial_price: Optional[float] | Omit = omit,
232
+ internal_notes: Optional[str] | Omit = omit,
233
+ offer_cancel_discount: Optional[bool] | Omit = omit,
234
+ override_tax_type: Optional[TaxType] | Omit = omit,
235
+ payment_method_configuration: Optional[plan_update_params.PaymentMethodConfiguration] | Omit = omit,
236
+ renewal_price: Optional[float] | Omit = omit,
237
+ stock: Optional[int] | Omit = omit,
238
+ strike_through_initial_price: Optional[float] | Omit = omit,
239
+ strike_through_renewal_price: Optional[float] | Omit = omit,
240
+ title: Optional[str] | Omit = omit,
241
+ trial_period_days: Optional[int] | Omit = omit,
242
+ unlimited_stock: Optional[bool] | Omit = omit,
243
+ visibility: Optional[Visibility] | Omit = omit,
244
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
245
+ # The extra values given here take precedence over values defined on the client or passed to this method.
246
+ extra_headers: Headers | None = None,
247
+ extra_query: Query | None = None,
248
+ extra_body: Body | None = None,
249
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
250
+ ) -> Plan:
251
+ """
252
+ Update an existing Plan
253
+
254
+ Required permissions:
255
+
256
+ - `plan:update`
257
+ - `access_pass:basic:read`
258
+ - `plan:basic:read`
259
+
260
+ Args:
261
+ billing_period: The interval at which the plan charges (renewal plans).
262
+
263
+ currency: The available currencies on the platform
264
+
265
+ custom_fields: An array of custom field objects.
266
+
267
+ description: The description of the plan.
268
+
269
+ expiration_days: The interval at which the plan charges (expiration plans).
270
+
271
+ image: An image for the plan. This will be visible on the product page to customers.
272
+
273
+ initial_price: An additional amount charged upon first purchase.
274
+
275
+ internal_notes: A personal description or notes section for the business.
276
+
277
+ offer_cancel_discount: Whether or not to offer a discount to cancel a subscription.
278
+
279
+ override_tax_type: Whether or not the tax is included in a plan's price (or if it hasn't been set
280
+ up)
281
+
282
+ payment_method_configuration: The explicit payment method configuration for the plan. If sent as null, the
283
+ custom configuration will be removed.
284
+
285
+ renewal_price: The amount the customer is charged every billing period.
286
+
287
+ stock: The number of units available for purchase.
288
+
289
+ strike_through_initial_price: The price to display with a strikethrough for the initial price. Provided as a
290
+ number in dollars. Eg: 19.99 for $19.99
291
+
292
+ strike_through_renewal_price: The price to display with a strikethrough for the renewal price. Provided as a
293
+ number in dollars. Eg: 19.99 for $19.99
294
+
295
+ title: The title of the plan. This will be visible on the product page to customers.
296
+
297
+ trial_period_days: The number of free trial days added before a renewal plan.
298
+
299
+ unlimited_stock: Limits/doesn't limit the number of units available for purchase.
300
+
301
+ visibility: Visibility of a resource
302
+
303
+ extra_headers: Send extra headers
304
+
305
+ extra_query: Add additional query parameters to the request
306
+
307
+ extra_body: Add additional JSON properties to the request
308
+
309
+ timeout: Override the client-level default timeout for this request, in seconds
310
+ """
311
+ if not id:
312
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
313
+ return self._patch(
314
+ f"/plans/{id}",
315
+ body=maybe_transform(
316
+ {
317
+ "billing_period": billing_period,
318
+ "currency": currency,
319
+ "custom_fields": custom_fields,
320
+ "description": description,
321
+ "expiration_days": expiration_days,
322
+ "image": image,
323
+ "initial_price": initial_price,
324
+ "internal_notes": internal_notes,
325
+ "offer_cancel_discount": offer_cancel_discount,
326
+ "override_tax_type": override_tax_type,
327
+ "payment_method_configuration": payment_method_configuration,
328
+ "renewal_price": renewal_price,
329
+ "stock": stock,
330
+ "strike_through_initial_price": strike_through_initial_price,
331
+ "strike_through_renewal_price": strike_through_renewal_price,
332
+ "title": title,
333
+ "trial_period_days": trial_period_days,
334
+ "unlimited_stock": unlimited_stock,
335
+ "visibility": visibility,
336
+ },
337
+ plan_update_params.PlanUpdateParams,
338
+ ),
339
+ options=make_request_options(
340
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
341
+ ),
342
+ cast_to=Plan,
343
+ )
344
+
345
+ def list(
346
+ self,
347
+ *,
348
+ company_id: str,
349
+ after: Optional[str] | Omit = omit,
350
+ before: Optional[str] | Omit = omit,
351
+ created_after: Union[str, datetime, None] | Omit = omit,
352
+ created_before: Union[str, datetime, None] | Omit = omit,
353
+ direction: Optional[Direction] | Omit = omit,
354
+ first: Optional[int] | Omit = omit,
355
+ last: Optional[int] | Omit = omit,
356
+ order: Optional[Literal["id", "active_members_count", "created_at", "internal_notes", "expires_at"]]
357
+ | Omit = omit,
358
+ plan_types: Optional[List[PlanType]] | Omit = omit,
359
+ product_ids: Optional[SequenceNotStr[str]] | Omit = omit,
360
+ release_methods: Optional[List[ReleaseMethod]] | Omit = omit,
361
+ visibilities: Optional[List[VisibilityFilter]] | Omit = omit,
362
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
363
+ # The extra values given here take precedence over values defined on the client or passed to this method.
364
+ extra_headers: Headers | None = None,
365
+ extra_query: Query | None = None,
366
+ extra_body: Body | None = None,
367
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
368
+ ) -> SyncCursorPage[PlanListResponse]:
369
+ """
370
+ Lists plans for a company
371
+
372
+ Required permissions:
373
+
374
+ - `plan:basic:read`
375
+
376
+ Args:
377
+ company_id: The ID of the company
378
+
379
+ after: Returns the elements in the list that come after the specified cursor.
380
+
381
+ before: Returns the elements in the list that come before the specified cursor.
382
+
383
+ created_after: The minimum creation date to filter by
384
+
385
+ created_before: The maximum creation date to filter by
386
+
387
+ direction: The direction of the sort.
388
+
389
+ first: Returns the first _n_ elements from the list.
390
+
391
+ last: Returns the last _n_ elements from the list.
392
+
393
+ order: The ways a relation of Plans can be ordered
394
+
395
+ plan_types: The plan type to filter the plans by
396
+
397
+ product_ids: The product IDs to filter the plans by
398
+
399
+ release_methods: The release method to filter the plans by
400
+
401
+ visibilities: The visibility to filter the plans by
402
+
403
+ extra_headers: Send extra headers
404
+
405
+ extra_query: Add additional query parameters to the request
406
+
407
+ extra_body: Add additional JSON properties to the request
408
+
409
+ timeout: Override the client-level default timeout for this request, in seconds
410
+ """
411
+ return self._get_api_list(
412
+ "/plans",
413
+ page=SyncCursorPage[PlanListResponse],
414
+ options=make_request_options(
415
+ extra_headers=extra_headers,
416
+ extra_query=extra_query,
417
+ extra_body=extra_body,
418
+ timeout=timeout,
419
+ query=maybe_transform(
420
+ {
421
+ "company_id": company_id,
422
+ "after": after,
423
+ "before": before,
424
+ "created_after": created_after,
425
+ "created_before": created_before,
426
+ "direction": direction,
427
+ "first": first,
428
+ "last": last,
429
+ "order": order,
430
+ "plan_types": plan_types,
431
+ "product_ids": product_ids,
432
+ "release_methods": release_methods,
433
+ "visibilities": visibilities,
434
+ },
435
+ plan_list_params.PlanListParams,
436
+ ),
437
+ ),
438
+ model=PlanListResponse,
439
+ )
440
+
441
+ def delete(
442
+ self,
443
+ id: str,
444
+ *,
445
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
446
+ # The extra values given here take precedence over values defined on the client or passed to this method.
447
+ extra_headers: Headers | None = None,
448
+ extra_query: Query | None = None,
449
+ extra_body: Body | None = None,
450
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
451
+ ) -> PlanDeleteResponse:
452
+ """
453
+ Delete an existing Plan
454
+
455
+ Required permissions:
456
+
457
+ - `plan:delete`
458
+
459
+ Args:
460
+ extra_headers: Send extra headers
461
+
462
+ extra_query: Add additional query parameters to the request
463
+
464
+ extra_body: Add additional JSON properties to the request
465
+
466
+ timeout: Override the client-level default timeout for this request, in seconds
467
+ """
468
+ if not id:
469
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
470
+ return self._delete(
471
+ f"/plans/{id}",
472
+ options=make_request_options(
473
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
474
+ ),
475
+ cast_to=PlanDeleteResponse,
476
+ )
477
+
478
+
479
+ class AsyncPlansResource(AsyncAPIResource):
480
+ @cached_property
481
+ def with_raw_response(self) -> AsyncPlansResourceWithRawResponse:
482
+ """
483
+ This property can be used as a prefix for any HTTP method call to return
484
+ the raw response object instead of the parsed content.
485
+
486
+ For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
487
+ """
488
+ return AsyncPlansResourceWithRawResponse(self)
489
+
490
+ @cached_property
491
+ def with_streaming_response(self) -> AsyncPlansResourceWithStreamingResponse:
492
+ """
493
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
494
+
495
+ For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
496
+ """
497
+ return AsyncPlansResourceWithStreamingResponse(self)
498
+
499
+ async def create(
500
+ self,
501
+ *,
502
+ company_id: str,
503
+ product_id: str,
504
+ billing_period: Optional[int] | Omit = omit,
505
+ currency: Optional[Currency] | Omit = omit,
506
+ custom_fields: Optional[Iterable[plan_create_params.CustomField]] | Omit = omit,
507
+ description: Optional[str] | Omit = omit,
508
+ expiration_days: Optional[int] | Omit = omit,
509
+ image: Optional[plan_create_params.Image] | Omit = omit,
510
+ initial_price: Optional[float] | Omit = omit,
511
+ internal_notes: Optional[str] | Omit = omit,
512
+ override_tax_type: Optional[TaxType] | Omit = omit,
513
+ payment_method_configuration: Optional[plan_create_params.PaymentMethodConfiguration] | Omit = omit,
514
+ plan_type: Optional[PlanType] | Omit = omit,
515
+ release_method: Optional[ReleaseMethod] | Omit = omit,
516
+ renewal_price: Optional[float] | Omit = omit,
517
+ stock: Optional[int] | Omit = omit,
518
+ title: Optional[str] | Omit = omit,
519
+ trial_period_days: Optional[int] | Omit = omit,
520
+ unlimited_stock: Optional[bool] | Omit = omit,
521
+ visibility: Optional[Visibility] | Omit = omit,
522
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
523
+ # The extra values given here take precedence over values defined on the client or passed to this method.
524
+ extra_headers: Headers | None = None,
525
+ extra_query: Query | None = None,
526
+ extra_body: Body | None = None,
527
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
528
+ ) -> Plan:
529
+ """
530
+ Create a new Plan
531
+
532
+ Required permissions:
533
+
534
+ - `plan:create`
535
+ - `access_pass:basic:read`
536
+ - `plan:basic:read`
537
+
538
+ Args:
539
+ company_id: The company the plan should be created for.
540
+
541
+ product_id: The product the plan is related to.
542
+
543
+ billing_period: The interval in days at which the plan charges (renewal plans).
544
+
545
+ currency: The available currencies on the platform
546
+
547
+ custom_fields: An array of custom field objects.
548
+
549
+ description: The description of the plan.
550
+
551
+ expiration_days: The interval at which the plan expires and revokes access (expiration plans).
552
+
553
+ image: An image for the plan. This will be visible on the product page to customers.
554
+
555
+ initial_price: An additional amount charged upon first purchase. Use only if a one time payment
556
+ OR you want to charge an additional amount on top of the renewal price. Provided
557
+ as a number in dollars. Eg: 10.43 for $10.43
558
+
559
+ internal_notes: A personal description or notes section for the business.
560
+
561
+ override_tax_type: Whether or not the tax is included in a plan's price (or if it hasn't been set
562
+ up)
563
+
564
+ payment_method_configuration: The explicit payment method configuration for the plan. If not provided, the
565
+ platform or company's defaults will apply.
566
+
567
+ plan_type: The type of plan that can be attached to a product
568
+
569
+ release_method: The methods of how a plan can be released.
570
+
571
+ renewal_price: The amount the customer is charged every billing period. Use only if a recurring
572
+ payment. Provided as a number in dollars. Eg: 10.43 for $10.43
573
+
574
+ stock: The number of units available for purchase.
575
+
576
+ title: The title of the plan. This will be visible on the product page to customers.
577
+
578
+ trial_period_days: The number of free trial days added before a renewal plan.
579
+
580
+ unlimited_stock: Limits/doesn't limit the number of units available for purchase.
581
+
582
+ visibility: Visibility of a resource
583
+
584
+ extra_headers: Send extra headers
585
+
586
+ extra_query: Add additional query parameters to the request
587
+
588
+ extra_body: Add additional JSON properties to the request
589
+
590
+ timeout: Override the client-level default timeout for this request, in seconds
591
+ """
592
+ return await self._post(
593
+ "/plans",
594
+ body=await async_maybe_transform(
595
+ {
596
+ "company_id": company_id,
597
+ "product_id": product_id,
598
+ "billing_period": billing_period,
599
+ "currency": currency,
600
+ "custom_fields": custom_fields,
601
+ "description": description,
602
+ "expiration_days": expiration_days,
603
+ "image": image,
604
+ "initial_price": initial_price,
605
+ "internal_notes": internal_notes,
606
+ "override_tax_type": override_tax_type,
607
+ "payment_method_configuration": payment_method_configuration,
608
+ "plan_type": plan_type,
609
+ "release_method": release_method,
610
+ "renewal_price": renewal_price,
611
+ "stock": stock,
612
+ "title": title,
613
+ "trial_period_days": trial_period_days,
614
+ "unlimited_stock": unlimited_stock,
615
+ "visibility": visibility,
616
+ },
617
+ plan_create_params.PlanCreateParams,
618
+ ),
619
+ options=make_request_options(
620
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
621
+ ),
622
+ cast_to=Plan,
623
+ )
624
+
625
+ async def retrieve(
626
+ self,
627
+ id: str,
628
+ *,
629
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
630
+ # The extra values given here take precedence over values defined on the client or passed to this method.
631
+ extra_headers: Headers | None = None,
632
+ extra_query: Query | None = None,
633
+ extra_body: Body | None = None,
634
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
635
+ ) -> Plan:
636
+ """
637
+ Retrieves a plan by ID
638
+
639
+ Required permissions:
640
+
641
+ - `plan:basic:read`
642
+
643
+ Args:
644
+ extra_headers: Send extra headers
645
+
646
+ extra_query: Add additional query parameters to the request
647
+
648
+ extra_body: Add additional JSON properties to the request
649
+
650
+ timeout: Override the client-level default timeout for this request, in seconds
651
+ """
652
+ if not id:
653
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
654
+ return await self._get(
655
+ f"/plans/{id}",
656
+ options=make_request_options(
657
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
658
+ ),
659
+ cast_to=Plan,
660
+ )
661
+
662
+ async def update(
663
+ self,
664
+ id: str,
665
+ *,
666
+ billing_period: Optional[int] | Omit = omit,
667
+ currency: Optional[Currency] | Omit = omit,
668
+ custom_fields: Optional[Iterable[plan_update_params.CustomField]] | Omit = omit,
669
+ description: Optional[str] | Omit = omit,
670
+ expiration_days: Optional[int] | Omit = omit,
671
+ image: Optional[plan_update_params.Image] | Omit = omit,
672
+ initial_price: Optional[float] | Omit = omit,
673
+ internal_notes: Optional[str] | Omit = omit,
674
+ offer_cancel_discount: Optional[bool] | Omit = omit,
675
+ override_tax_type: Optional[TaxType] | Omit = omit,
676
+ payment_method_configuration: Optional[plan_update_params.PaymentMethodConfiguration] | Omit = omit,
677
+ renewal_price: Optional[float] | Omit = omit,
678
+ stock: Optional[int] | Omit = omit,
679
+ strike_through_initial_price: Optional[float] | Omit = omit,
680
+ strike_through_renewal_price: Optional[float] | Omit = omit,
681
+ title: Optional[str] | Omit = omit,
682
+ trial_period_days: Optional[int] | Omit = omit,
683
+ unlimited_stock: Optional[bool] | Omit = omit,
684
+ visibility: Optional[Visibility] | Omit = omit,
685
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
686
+ # The extra values given here take precedence over values defined on the client or passed to this method.
687
+ extra_headers: Headers | None = None,
688
+ extra_query: Query | None = None,
689
+ extra_body: Body | None = None,
690
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
691
+ ) -> Plan:
692
+ """
693
+ Update an existing Plan
694
+
695
+ Required permissions:
696
+
697
+ - `plan:update`
698
+ - `access_pass:basic:read`
699
+ - `plan:basic:read`
700
+
701
+ Args:
702
+ billing_period: The interval at which the plan charges (renewal plans).
703
+
704
+ currency: The available currencies on the platform
705
+
706
+ custom_fields: An array of custom field objects.
707
+
708
+ description: The description of the plan.
709
+
710
+ expiration_days: The interval at which the plan charges (expiration plans).
711
+
712
+ image: An image for the plan. This will be visible on the product page to customers.
713
+
714
+ initial_price: An additional amount charged upon first purchase.
715
+
716
+ internal_notes: A personal description or notes section for the business.
717
+
718
+ offer_cancel_discount: Whether or not to offer a discount to cancel a subscription.
719
+
720
+ override_tax_type: Whether or not the tax is included in a plan's price (or if it hasn't been set
721
+ up)
722
+
723
+ payment_method_configuration: The explicit payment method configuration for the plan. If sent as null, the
724
+ custom configuration will be removed.
725
+
726
+ renewal_price: The amount the customer is charged every billing period.
727
+
728
+ stock: The number of units available for purchase.
729
+
730
+ strike_through_initial_price: The price to display with a strikethrough for the initial price. Provided as a
731
+ number in dollars. Eg: 19.99 for $19.99
732
+
733
+ strike_through_renewal_price: The price to display with a strikethrough for the renewal price. Provided as a
734
+ number in dollars. Eg: 19.99 for $19.99
735
+
736
+ title: The title of the plan. This will be visible on the product page to customers.
737
+
738
+ trial_period_days: The number of free trial days added before a renewal plan.
739
+
740
+ unlimited_stock: Limits/doesn't limit the number of units available for purchase.
741
+
742
+ visibility: Visibility of a resource
743
+
744
+ extra_headers: Send extra headers
745
+
746
+ extra_query: Add additional query parameters to the request
747
+
748
+ extra_body: Add additional JSON properties to the request
749
+
750
+ timeout: Override the client-level default timeout for this request, in seconds
751
+ """
752
+ if not id:
753
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
754
+ return await self._patch(
755
+ f"/plans/{id}",
756
+ body=await async_maybe_transform(
757
+ {
758
+ "billing_period": billing_period,
759
+ "currency": currency,
760
+ "custom_fields": custom_fields,
761
+ "description": description,
762
+ "expiration_days": expiration_days,
763
+ "image": image,
764
+ "initial_price": initial_price,
765
+ "internal_notes": internal_notes,
766
+ "offer_cancel_discount": offer_cancel_discount,
767
+ "override_tax_type": override_tax_type,
768
+ "payment_method_configuration": payment_method_configuration,
769
+ "renewal_price": renewal_price,
770
+ "stock": stock,
771
+ "strike_through_initial_price": strike_through_initial_price,
772
+ "strike_through_renewal_price": strike_through_renewal_price,
773
+ "title": title,
774
+ "trial_period_days": trial_period_days,
775
+ "unlimited_stock": unlimited_stock,
776
+ "visibility": visibility,
777
+ },
778
+ plan_update_params.PlanUpdateParams,
779
+ ),
780
+ options=make_request_options(
781
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
782
+ ),
783
+ cast_to=Plan,
784
+ )
785
+
786
+ def list(
787
+ self,
788
+ *,
789
+ company_id: str,
790
+ after: Optional[str] | Omit = omit,
791
+ before: Optional[str] | Omit = omit,
792
+ created_after: Union[str, datetime, None] | Omit = omit,
793
+ created_before: Union[str, datetime, None] | Omit = omit,
794
+ direction: Optional[Direction] | Omit = omit,
795
+ first: Optional[int] | Omit = omit,
796
+ last: Optional[int] | Omit = omit,
797
+ order: Optional[Literal["id", "active_members_count", "created_at", "internal_notes", "expires_at"]]
798
+ | Omit = omit,
799
+ plan_types: Optional[List[PlanType]] | Omit = omit,
800
+ product_ids: Optional[SequenceNotStr[str]] | Omit = omit,
801
+ release_methods: Optional[List[ReleaseMethod]] | Omit = omit,
802
+ visibilities: Optional[List[VisibilityFilter]] | Omit = omit,
803
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
804
+ # The extra values given here take precedence over values defined on the client or passed to this method.
805
+ extra_headers: Headers | None = None,
806
+ extra_query: Query | None = None,
807
+ extra_body: Body | None = None,
808
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
809
+ ) -> AsyncPaginator[PlanListResponse, AsyncCursorPage[PlanListResponse]]:
810
+ """
811
+ Lists plans for a company
812
+
813
+ Required permissions:
814
+
815
+ - `plan:basic:read`
816
+
817
+ Args:
818
+ company_id: The ID of the company
819
+
820
+ after: Returns the elements in the list that come after the specified cursor.
821
+
822
+ before: Returns the elements in the list that come before the specified cursor.
823
+
824
+ created_after: The minimum creation date to filter by
825
+
826
+ created_before: The maximum creation date to filter by
827
+
828
+ direction: The direction of the sort.
829
+
830
+ first: Returns the first _n_ elements from the list.
831
+
832
+ last: Returns the last _n_ elements from the list.
833
+
834
+ order: The ways a relation of Plans can be ordered
835
+
836
+ plan_types: The plan type to filter the plans by
837
+
838
+ product_ids: The product IDs to filter the plans by
839
+
840
+ release_methods: The release method to filter the plans by
841
+
842
+ visibilities: The visibility to filter the plans by
843
+
844
+ extra_headers: Send extra headers
845
+
846
+ extra_query: Add additional query parameters to the request
847
+
848
+ extra_body: Add additional JSON properties to the request
849
+
850
+ timeout: Override the client-level default timeout for this request, in seconds
851
+ """
852
+ return self._get_api_list(
853
+ "/plans",
854
+ page=AsyncCursorPage[PlanListResponse],
855
+ options=make_request_options(
856
+ extra_headers=extra_headers,
857
+ extra_query=extra_query,
858
+ extra_body=extra_body,
859
+ timeout=timeout,
860
+ query=maybe_transform(
861
+ {
862
+ "company_id": company_id,
863
+ "after": after,
864
+ "before": before,
865
+ "created_after": created_after,
866
+ "created_before": created_before,
867
+ "direction": direction,
868
+ "first": first,
869
+ "last": last,
870
+ "order": order,
871
+ "plan_types": plan_types,
872
+ "product_ids": product_ids,
873
+ "release_methods": release_methods,
874
+ "visibilities": visibilities,
875
+ },
876
+ plan_list_params.PlanListParams,
877
+ ),
878
+ ),
879
+ model=PlanListResponse,
880
+ )
881
+
882
+ async def delete(
883
+ self,
884
+ id: str,
885
+ *,
886
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
887
+ # The extra values given here take precedence over values defined on the client or passed to this method.
888
+ extra_headers: Headers | None = None,
889
+ extra_query: Query | None = None,
890
+ extra_body: Body | None = None,
891
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
892
+ ) -> PlanDeleteResponse:
893
+ """
894
+ Delete an existing Plan
895
+
896
+ Required permissions:
897
+
898
+ - `plan:delete`
899
+
900
+ Args:
901
+ extra_headers: Send extra headers
902
+
903
+ extra_query: Add additional query parameters to the request
904
+
905
+ extra_body: Add additional JSON properties to the request
906
+
907
+ timeout: Override the client-level default timeout for this request, in seconds
908
+ """
909
+ if not id:
910
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
911
+ return await self._delete(
912
+ f"/plans/{id}",
913
+ options=make_request_options(
914
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
915
+ ),
916
+ cast_to=PlanDeleteResponse,
917
+ )
918
+
919
+
920
+ class PlansResourceWithRawResponse:
921
+ def __init__(self, plans: PlansResource) -> None:
922
+ self._plans = plans
923
+
924
+ self.create = to_raw_response_wrapper(
925
+ plans.create,
926
+ )
927
+ self.retrieve = to_raw_response_wrapper(
928
+ plans.retrieve,
929
+ )
930
+ self.update = to_raw_response_wrapper(
931
+ plans.update,
932
+ )
933
+ self.list = to_raw_response_wrapper(
934
+ plans.list,
935
+ )
936
+ self.delete = to_raw_response_wrapper(
937
+ plans.delete,
938
+ )
939
+
940
+
941
+ class AsyncPlansResourceWithRawResponse:
942
+ def __init__(self, plans: AsyncPlansResource) -> None:
943
+ self._plans = plans
944
+
945
+ self.create = async_to_raw_response_wrapper(
946
+ plans.create,
947
+ )
948
+ self.retrieve = async_to_raw_response_wrapper(
949
+ plans.retrieve,
950
+ )
951
+ self.update = async_to_raw_response_wrapper(
952
+ plans.update,
953
+ )
954
+ self.list = async_to_raw_response_wrapper(
955
+ plans.list,
956
+ )
957
+ self.delete = async_to_raw_response_wrapper(
958
+ plans.delete,
959
+ )
960
+
961
+
962
+ class PlansResourceWithStreamingResponse:
963
+ def __init__(self, plans: PlansResource) -> None:
964
+ self._plans = plans
965
+
966
+ self.create = to_streamed_response_wrapper(
967
+ plans.create,
968
+ )
969
+ self.retrieve = to_streamed_response_wrapper(
970
+ plans.retrieve,
971
+ )
972
+ self.update = to_streamed_response_wrapper(
973
+ plans.update,
974
+ )
975
+ self.list = to_streamed_response_wrapper(
976
+ plans.list,
977
+ )
978
+ self.delete = to_streamed_response_wrapper(
979
+ plans.delete,
980
+ )
981
+
982
+
983
+ class AsyncPlansResourceWithStreamingResponse:
984
+ def __init__(self, plans: AsyncPlansResource) -> None:
985
+ self._plans = plans
986
+
987
+ self.create = async_to_streamed_response_wrapper(
988
+ plans.create,
989
+ )
990
+ self.retrieve = async_to_streamed_response_wrapper(
991
+ plans.retrieve,
992
+ )
993
+ self.update = async_to_streamed_response_wrapper(
994
+ plans.update,
995
+ )
996
+ self.list = async_to_streamed_response_wrapper(
997
+ plans.list,
998
+ )
999
+ self.delete = async_to_streamed_response_wrapper(
1000
+ plans.delete,
1001
+ )