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,1099 @@
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, Optional
6
+ from datetime import datetime
7
+ from typing_extensions import Literal, overload
8
+
9
+ import httpx
10
+
11
+ from ..types import invoice_list_params, invoice_create_params
12
+ from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
13
+ from .._utils import required_args, 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.invoice import Invoice
25
+ from ..types.shared.direction import Direction
26
+ from ..types.invoice_void_response import InvoiceVoidResponse
27
+ from ..types.shared.invoice_status import InvoiceStatus
28
+ from ..types.shared.collection_method import CollectionMethod
29
+ from ..types.shared.invoice_list_item import InvoiceListItem
30
+
31
+ __all__ = ["InvoicesResource", "AsyncInvoicesResource"]
32
+
33
+
34
+ class InvoicesResource(SyncAPIResource):
35
+ @cached_property
36
+ def with_raw_response(self) -> InvoicesResourceWithRawResponse:
37
+ """
38
+ This property can be used as a prefix for any HTTP method call to return
39
+ the raw response object instead of the parsed content.
40
+
41
+ For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
42
+ """
43
+ return InvoicesResourceWithRawResponse(self)
44
+
45
+ @cached_property
46
+ def with_streaming_response(self) -> InvoicesResourceWithStreamingResponse:
47
+ """
48
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
49
+
50
+ For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
51
+ """
52
+ return InvoicesResourceWithStreamingResponse(self)
53
+
54
+ @overload
55
+ def create(
56
+ self,
57
+ *,
58
+ collection_method: CollectionMethod,
59
+ company_id: str,
60
+ due_date: Union[str, datetime],
61
+ member_id: str,
62
+ plan: invoice_create_params.CreateInvoiceInputWithProductAndMemberIDPlan,
63
+ product: invoice_create_params.CreateInvoiceInputWithProductAndMemberIDProduct,
64
+ charge_buyer_fee: Optional[bool] | Omit = omit,
65
+ customer_name: Optional[str] | Omit = omit,
66
+ payment_token_id: Optional[str] | Omit = omit,
67
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
68
+ # The extra values given here take precedence over values defined on the client or passed to this method.
69
+ extra_headers: Headers | None = None,
70
+ extra_query: Query | None = None,
71
+ extra_body: Body | None = None,
72
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
73
+ ) -> Invoice:
74
+ """
75
+ Creates an invoice
76
+
77
+ Required permissions:
78
+
79
+ - `invoice:create`
80
+ - `plan:basic:read`
81
+
82
+ Args:
83
+ collection_method: The method of collection for this invoice. If using charge_automatically, you
84
+ must provide a payment_token.
85
+
86
+ company_id: The company ID to create this invoice for.
87
+
88
+ due_date: The date the invoice is due, if applicable.
89
+
90
+ member_id: The member ID to create this invoice for. Include this if you want to create an
91
+ invoice for an existing member. If you do not have a member ID, you must provide
92
+ an email_address and customer_name.
93
+
94
+ plan: The properties of the plan to create for this invoice.
95
+
96
+ product: The properties of the product to create for this invoice. Include this if you
97
+ want to create an invoice for a new product.
98
+
99
+ charge_buyer_fee: Whether or not to charge the customer a buyer fee.
100
+
101
+ customer_name: The name of the customer to create this invoice for. This is required if you
102
+ want to create an invoice for a customer who does not have a member of your
103
+ company yet.
104
+
105
+ payment_token_id: The payment token ID to use for this invoice. If using charge_automatically, you
106
+ must provide a payment_token.
107
+
108
+ extra_headers: Send extra headers
109
+
110
+ extra_query: Add additional query parameters to the request
111
+
112
+ extra_body: Add additional JSON properties to the request
113
+
114
+ timeout: Override the client-level default timeout for this request, in seconds
115
+ """
116
+ ...
117
+
118
+ @overload
119
+ def create(
120
+ self,
121
+ *,
122
+ collection_method: CollectionMethod,
123
+ company_id: str,
124
+ due_date: Union[str, datetime],
125
+ email_address: str,
126
+ plan: invoice_create_params.CreateInvoiceInputWithProductAndEmailAddressPlan,
127
+ product: invoice_create_params.CreateInvoiceInputWithProductAndEmailAddressProduct,
128
+ charge_buyer_fee: Optional[bool] | Omit = omit,
129
+ customer_name: Optional[str] | Omit = omit,
130
+ payment_token_id: Optional[str] | Omit = omit,
131
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
132
+ # The extra values given here take precedence over values defined on the client or passed to this method.
133
+ extra_headers: Headers | None = None,
134
+ extra_query: Query | None = None,
135
+ extra_body: Body | None = None,
136
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
137
+ ) -> Invoice:
138
+ """
139
+ Creates an invoice
140
+
141
+ Required permissions:
142
+
143
+ - `invoice:create`
144
+ - `plan:basic:read`
145
+
146
+ Args:
147
+ collection_method: The method of collection for this invoice. If using charge_automatically, you
148
+ must provide a payment_token.
149
+
150
+ company_id: The company ID to create this invoice for.
151
+
152
+ due_date: The date the invoice is due, if applicable.
153
+
154
+ email_address: The email address to create this invoice for. This is required if you want to
155
+ create an invoice for a user who does not have a member of your company yet.
156
+
157
+ plan: The properties of the plan to create for this invoice.
158
+
159
+ product: The properties of the product to create for this invoice. Include this if you
160
+ want to create an invoice for a new product.
161
+
162
+ charge_buyer_fee: Whether or not to charge the customer a buyer fee.
163
+
164
+ customer_name: The name of the customer to create this invoice for. This is required if you
165
+ want to create an invoice for a customer who does not have a member of your
166
+ company yet.
167
+
168
+ payment_token_id: The payment token ID to use for this invoice. If using charge_automatically, you
169
+ must provide a payment_token.
170
+
171
+ extra_headers: Send extra headers
172
+
173
+ extra_query: Add additional query parameters to the request
174
+
175
+ extra_body: Add additional JSON properties to the request
176
+
177
+ timeout: Override the client-level default timeout for this request, in seconds
178
+ """
179
+ ...
180
+
181
+ @overload
182
+ def create(
183
+ self,
184
+ *,
185
+ collection_method: CollectionMethod,
186
+ company_id: str,
187
+ due_date: Union[str, datetime],
188
+ member_id: str,
189
+ plan: invoice_create_params.CreateInvoiceInputWithProductIDAndMemberIDPlan,
190
+ product_id: str,
191
+ charge_buyer_fee: Optional[bool] | Omit = omit,
192
+ customer_name: Optional[str] | Omit = omit,
193
+ payment_token_id: Optional[str] | Omit = omit,
194
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
195
+ # The extra values given here take precedence over values defined on the client or passed to this method.
196
+ extra_headers: Headers | None = None,
197
+ extra_query: Query | None = None,
198
+ extra_body: Body | None = None,
199
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
200
+ ) -> Invoice:
201
+ """
202
+ Creates an invoice
203
+
204
+ Required permissions:
205
+
206
+ - `invoice:create`
207
+ - `plan:basic:read`
208
+
209
+ Args:
210
+ collection_method: The method of collection for this invoice. If using charge_automatically, you
211
+ must provide a payment_token.
212
+
213
+ company_id: The company ID to create this invoice for.
214
+
215
+ due_date: The date the invoice is due, if applicable.
216
+
217
+ member_id: The member ID to create this invoice for. Include this if you want to create an
218
+ invoice for an existing member. If you do not have a member ID, you must provide
219
+ an email_address and customer_name.
220
+
221
+ plan: The properties of the plan to create for this invoice.
222
+
223
+ product_id: The product ID to create this invoice for. Include this if you want to create an
224
+ invoice for an existing product.
225
+
226
+ charge_buyer_fee: Whether or not to charge the customer a buyer fee.
227
+
228
+ customer_name: The name of the customer to create this invoice for. This is required if you
229
+ want to create an invoice for a customer who does not have a member of your
230
+ company yet.
231
+
232
+ payment_token_id: The payment token ID to use for this invoice. If using charge_automatically, you
233
+ must provide a payment_token.
234
+
235
+ extra_headers: Send extra headers
236
+
237
+ extra_query: Add additional query parameters to the request
238
+
239
+ extra_body: Add additional JSON properties to the request
240
+
241
+ timeout: Override the client-level default timeout for this request, in seconds
242
+ """
243
+ ...
244
+
245
+ @overload
246
+ def create(
247
+ self,
248
+ *,
249
+ collection_method: CollectionMethod,
250
+ company_id: str,
251
+ due_date: Union[str, datetime],
252
+ email_address: str,
253
+ plan: invoice_create_params.CreateInvoiceInputWithProductIDAndEmailAddressPlan,
254
+ product_id: str,
255
+ charge_buyer_fee: Optional[bool] | Omit = omit,
256
+ customer_name: Optional[str] | Omit = omit,
257
+ payment_token_id: Optional[str] | Omit = omit,
258
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
259
+ # The extra values given here take precedence over values defined on the client or passed to this method.
260
+ extra_headers: Headers | None = None,
261
+ extra_query: Query | None = None,
262
+ extra_body: Body | None = None,
263
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
264
+ ) -> Invoice:
265
+ """
266
+ Creates an invoice
267
+
268
+ Required permissions:
269
+
270
+ - `invoice:create`
271
+ - `plan:basic:read`
272
+
273
+ Args:
274
+ collection_method: The method of collection for this invoice. If using charge_automatically, you
275
+ must provide a payment_token.
276
+
277
+ company_id: The company ID to create this invoice for.
278
+
279
+ due_date: The date the invoice is due, if applicable.
280
+
281
+ email_address: The email address to create this invoice for. This is required if you want to
282
+ create an invoice for a user who does not have a member of your company yet.
283
+
284
+ plan: The properties of the plan to create for this invoice.
285
+
286
+ product_id: The product ID to create this invoice for. Include this if you want to create an
287
+ invoice for an existing product.
288
+
289
+ charge_buyer_fee: Whether or not to charge the customer a buyer fee.
290
+
291
+ customer_name: The name of the customer to create this invoice for. This is required if you
292
+ want to create an invoice for a customer who does not have a member of your
293
+ company yet.
294
+
295
+ payment_token_id: The payment token ID to use for this invoice. If using charge_automatically, you
296
+ must provide a payment_token.
297
+
298
+ extra_headers: Send extra headers
299
+
300
+ extra_query: Add additional query parameters to the request
301
+
302
+ extra_body: Add additional JSON properties to the request
303
+
304
+ timeout: Override the client-level default timeout for this request, in seconds
305
+ """
306
+ ...
307
+
308
+ @required_args(
309
+ ["collection_method", "company_id", "due_date", "member_id", "plan", "product"],
310
+ ["collection_method", "company_id", "due_date", "email_address", "plan", "product"],
311
+ ["collection_method", "company_id", "due_date", "member_id", "plan", "product_id"],
312
+ ["collection_method", "company_id", "due_date", "email_address", "plan", "product_id"],
313
+ )
314
+ def create(
315
+ self,
316
+ *,
317
+ collection_method: CollectionMethod,
318
+ company_id: str,
319
+ due_date: Union[str, datetime],
320
+ member_id: str | Omit = omit,
321
+ plan: invoice_create_params.CreateInvoiceInputWithProductAndMemberIDPlan
322
+ | invoice_create_params.CreateInvoiceInputWithProductAndEmailAddressPlan
323
+ | invoice_create_params.CreateInvoiceInputWithProductIDAndMemberIDPlan
324
+ | invoice_create_params.CreateInvoiceInputWithProductIDAndEmailAddressPlan,
325
+ product: invoice_create_params.CreateInvoiceInputWithProductAndMemberIDProduct
326
+ | invoice_create_params.CreateInvoiceInputWithProductAndEmailAddressProduct
327
+ | Omit = omit,
328
+ charge_buyer_fee: Optional[bool] | Omit = omit,
329
+ customer_name: Optional[str] | Omit = omit,
330
+ payment_token_id: Optional[str] | Omit = omit,
331
+ email_address: str | Omit = omit,
332
+ product_id: str | Omit = omit,
333
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
334
+ # The extra values given here take precedence over values defined on the client or passed to this method.
335
+ extra_headers: Headers | None = None,
336
+ extra_query: Query | None = None,
337
+ extra_body: Body | None = None,
338
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
339
+ ) -> Invoice:
340
+ return self._post(
341
+ "/invoices",
342
+ body=maybe_transform(
343
+ {
344
+ "collection_method": collection_method,
345
+ "company_id": company_id,
346
+ "due_date": due_date,
347
+ "member_id": member_id,
348
+ "plan": plan,
349
+ "product": product,
350
+ "charge_buyer_fee": charge_buyer_fee,
351
+ "customer_name": customer_name,
352
+ "payment_token_id": payment_token_id,
353
+ "email_address": email_address,
354
+ "product_id": product_id,
355
+ },
356
+ invoice_create_params.InvoiceCreateParams,
357
+ ),
358
+ options=make_request_options(
359
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
360
+ ),
361
+ cast_to=Invoice,
362
+ )
363
+
364
+ def retrieve(
365
+ self,
366
+ id: str,
367
+ *,
368
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
369
+ # The extra values given here take precedence over values defined on the client or passed to this method.
370
+ extra_headers: Headers | None = None,
371
+ extra_query: Query | None = None,
372
+ extra_body: Body | None = None,
373
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
374
+ ) -> Invoice:
375
+ """
376
+ Retrieves an invoice by ID or token
377
+
378
+ Required permissions:
379
+
380
+ - `invoice:basic:read`
381
+ - `plan:basic:read`
382
+
383
+ Args:
384
+ extra_headers: Send extra headers
385
+
386
+ extra_query: Add additional query parameters to the request
387
+
388
+ extra_body: Add additional JSON properties to the request
389
+
390
+ timeout: Override the client-level default timeout for this request, in seconds
391
+ """
392
+ if not id:
393
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
394
+ return self._get(
395
+ f"/invoices/{id}",
396
+ options=make_request_options(
397
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
398
+ ),
399
+ cast_to=Invoice,
400
+ )
401
+
402
+ def list(
403
+ self,
404
+ *,
405
+ company_id: str,
406
+ after: Optional[str] | Omit = omit,
407
+ before: Optional[str] | Omit = omit,
408
+ collection_methods: Optional[List[CollectionMethod]] | Omit = omit,
409
+ created_after: Union[str, datetime, None] | Omit = omit,
410
+ created_before: Union[str, datetime, None] | Omit = omit,
411
+ direction: Optional[Direction] | Omit = omit,
412
+ first: Optional[int] | Omit = omit,
413
+ last: Optional[int] | Omit = omit,
414
+ order: Optional[Literal["id", "created_at", "due_date"]] | Omit = omit,
415
+ product_ids: Optional[SequenceNotStr[str]] | Omit = omit,
416
+ statuses: Optional[List[InvoiceStatus]] | Omit = omit,
417
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
418
+ # The extra values given here take precedence over values defined on the client or passed to this method.
419
+ extra_headers: Headers | None = None,
420
+ extra_query: Query | None = None,
421
+ extra_body: Body | None = None,
422
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
423
+ ) -> SyncCursorPage[InvoiceListItem]:
424
+ """
425
+ Lists invoices
426
+
427
+ Required permissions:
428
+
429
+ - `invoice:basic:read`
430
+ - `plan:basic:read`
431
+
432
+ Args:
433
+ company_id: The ID of the company to list invoices for
434
+
435
+ after: Returns the elements in the list that come after the specified cursor.
436
+
437
+ before: Returns the elements in the list that come before the specified cursor.
438
+
439
+ collection_methods: Filter invoices by their collection method
440
+
441
+ created_after: The minimum creation date to filter by
442
+
443
+ created_before: The maximum creation date to filter by
444
+
445
+ direction: The direction of the sort.
446
+
447
+ first: Returns the first _n_ elements from the list.
448
+
449
+ last: Returns the last _n_ elements from the list.
450
+
451
+ order: Which columns can be used to sort.
452
+
453
+ product_ids: Return only invoices created for these specific product ids
454
+
455
+ statuses: The statuses to filter the invoices by
456
+
457
+ extra_headers: Send extra headers
458
+
459
+ extra_query: Add additional query parameters to the request
460
+
461
+ extra_body: Add additional JSON properties to the request
462
+
463
+ timeout: Override the client-level default timeout for this request, in seconds
464
+ """
465
+ return self._get_api_list(
466
+ "/invoices",
467
+ page=SyncCursorPage[InvoiceListItem],
468
+ options=make_request_options(
469
+ extra_headers=extra_headers,
470
+ extra_query=extra_query,
471
+ extra_body=extra_body,
472
+ timeout=timeout,
473
+ query=maybe_transform(
474
+ {
475
+ "company_id": company_id,
476
+ "after": after,
477
+ "before": before,
478
+ "collection_methods": collection_methods,
479
+ "created_after": created_after,
480
+ "created_before": created_before,
481
+ "direction": direction,
482
+ "first": first,
483
+ "last": last,
484
+ "order": order,
485
+ "product_ids": product_ids,
486
+ "statuses": statuses,
487
+ },
488
+ invoice_list_params.InvoiceListParams,
489
+ ),
490
+ ),
491
+ model=InvoiceListItem,
492
+ )
493
+
494
+ def void(
495
+ self,
496
+ id: str,
497
+ *,
498
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
499
+ # The extra values given here take precedence over values defined on the client or passed to this method.
500
+ extra_headers: Headers | None = None,
501
+ extra_query: Query | None = None,
502
+ extra_body: Body | None = None,
503
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
504
+ ) -> InvoiceVoidResponse:
505
+ """
506
+ Void an invoice
507
+
508
+ Required permissions:
509
+
510
+ - `invoice:update`
511
+
512
+ Args:
513
+ extra_headers: Send extra headers
514
+
515
+ extra_query: Add additional query parameters to the request
516
+
517
+ extra_body: Add additional JSON properties to the request
518
+
519
+ timeout: Override the client-level default timeout for this request, in seconds
520
+ """
521
+ if not id:
522
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
523
+ return self._post(
524
+ f"/invoices/{id}/void",
525
+ options=make_request_options(
526
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
527
+ ),
528
+ cast_to=InvoiceVoidResponse,
529
+ )
530
+
531
+
532
+ class AsyncInvoicesResource(AsyncAPIResource):
533
+ @cached_property
534
+ def with_raw_response(self) -> AsyncInvoicesResourceWithRawResponse:
535
+ """
536
+ This property can be used as a prefix for any HTTP method call to return
537
+ the raw response object instead of the parsed content.
538
+
539
+ For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
540
+ """
541
+ return AsyncInvoicesResourceWithRawResponse(self)
542
+
543
+ @cached_property
544
+ def with_streaming_response(self) -> AsyncInvoicesResourceWithStreamingResponse:
545
+ """
546
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
547
+
548
+ For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
549
+ """
550
+ return AsyncInvoicesResourceWithStreamingResponse(self)
551
+
552
+ @overload
553
+ async def create(
554
+ self,
555
+ *,
556
+ collection_method: CollectionMethod,
557
+ company_id: str,
558
+ due_date: Union[str, datetime],
559
+ member_id: str,
560
+ plan: invoice_create_params.CreateInvoiceInputWithProductAndMemberIDPlan,
561
+ product: invoice_create_params.CreateInvoiceInputWithProductAndMemberIDProduct,
562
+ charge_buyer_fee: Optional[bool] | Omit = omit,
563
+ customer_name: Optional[str] | Omit = omit,
564
+ payment_token_id: Optional[str] | Omit = omit,
565
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
566
+ # The extra values given here take precedence over values defined on the client or passed to this method.
567
+ extra_headers: Headers | None = None,
568
+ extra_query: Query | None = None,
569
+ extra_body: Body | None = None,
570
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
571
+ ) -> Invoice:
572
+ """
573
+ Creates an invoice
574
+
575
+ Required permissions:
576
+
577
+ - `invoice:create`
578
+ - `plan:basic:read`
579
+
580
+ Args:
581
+ collection_method: The method of collection for this invoice. If using charge_automatically, you
582
+ must provide a payment_token.
583
+
584
+ company_id: The company ID to create this invoice for.
585
+
586
+ due_date: The date the invoice is due, if applicable.
587
+
588
+ member_id: The member ID to create this invoice for. Include this if you want to create an
589
+ invoice for an existing member. If you do not have a member ID, you must provide
590
+ an email_address and customer_name.
591
+
592
+ plan: The properties of the plan to create for this invoice.
593
+
594
+ product: The properties of the product to create for this invoice. Include this if you
595
+ want to create an invoice for a new product.
596
+
597
+ charge_buyer_fee: Whether or not to charge the customer a buyer fee.
598
+
599
+ customer_name: The name of the customer to create this invoice for. This is required if you
600
+ want to create an invoice for a customer who does not have a member of your
601
+ company yet.
602
+
603
+ payment_token_id: The payment token ID to use for this invoice. If using charge_automatically, you
604
+ must provide a payment_token.
605
+
606
+ extra_headers: Send extra headers
607
+
608
+ extra_query: Add additional query parameters to the request
609
+
610
+ extra_body: Add additional JSON properties to the request
611
+
612
+ timeout: Override the client-level default timeout for this request, in seconds
613
+ """
614
+ ...
615
+
616
+ @overload
617
+ async def create(
618
+ self,
619
+ *,
620
+ collection_method: CollectionMethod,
621
+ company_id: str,
622
+ due_date: Union[str, datetime],
623
+ email_address: str,
624
+ plan: invoice_create_params.CreateInvoiceInputWithProductAndEmailAddressPlan,
625
+ product: invoice_create_params.CreateInvoiceInputWithProductAndEmailAddressProduct,
626
+ charge_buyer_fee: Optional[bool] | Omit = omit,
627
+ customer_name: Optional[str] | Omit = omit,
628
+ payment_token_id: Optional[str] | Omit = omit,
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
+ ) -> Invoice:
636
+ """
637
+ Creates an invoice
638
+
639
+ Required permissions:
640
+
641
+ - `invoice:create`
642
+ - `plan:basic:read`
643
+
644
+ Args:
645
+ collection_method: The method of collection for this invoice. If using charge_automatically, you
646
+ must provide a payment_token.
647
+
648
+ company_id: The company ID to create this invoice for.
649
+
650
+ due_date: The date the invoice is due, if applicable.
651
+
652
+ email_address: The email address to create this invoice for. This is required if you want to
653
+ create an invoice for a user who does not have a member of your company yet.
654
+
655
+ plan: The properties of the plan to create for this invoice.
656
+
657
+ product: The properties of the product to create for this invoice. Include this if you
658
+ want to create an invoice for a new product.
659
+
660
+ charge_buyer_fee: Whether or not to charge the customer a buyer fee.
661
+
662
+ customer_name: The name of the customer to create this invoice for. This is required if you
663
+ want to create an invoice for a customer who does not have a member of your
664
+ company yet.
665
+
666
+ payment_token_id: The payment token ID to use for this invoice. If using charge_automatically, you
667
+ must provide a payment_token.
668
+
669
+ extra_headers: Send extra headers
670
+
671
+ extra_query: Add additional query parameters to the request
672
+
673
+ extra_body: Add additional JSON properties to the request
674
+
675
+ timeout: Override the client-level default timeout for this request, in seconds
676
+ """
677
+ ...
678
+
679
+ @overload
680
+ async def create(
681
+ self,
682
+ *,
683
+ collection_method: CollectionMethod,
684
+ company_id: str,
685
+ due_date: Union[str, datetime],
686
+ member_id: str,
687
+ plan: invoice_create_params.CreateInvoiceInputWithProductIDAndMemberIDPlan,
688
+ product_id: str,
689
+ charge_buyer_fee: Optional[bool] | Omit = omit,
690
+ customer_name: Optional[str] | Omit = omit,
691
+ payment_token_id: Optional[str] | Omit = omit,
692
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
693
+ # The extra values given here take precedence over values defined on the client or passed to this method.
694
+ extra_headers: Headers | None = None,
695
+ extra_query: Query | None = None,
696
+ extra_body: Body | None = None,
697
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
698
+ ) -> Invoice:
699
+ """
700
+ Creates an invoice
701
+
702
+ Required permissions:
703
+
704
+ - `invoice:create`
705
+ - `plan:basic:read`
706
+
707
+ Args:
708
+ collection_method: The method of collection for this invoice. If using charge_automatically, you
709
+ must provide a payment_token.
710
+
711
+ company_id: The company ID to create this invoice for.
712
+
713
+ due_date: The date the invoice is due, if applicable.
714
+
715
+ member_id: The member ID to create this invoice for. Include this if you want to create an
716
+ invoice for an existing member. If you do not have a member ID, you must provide
717
+ an email_address and customer_name.
718
+
719
+ plan: The properties of the plan to create for this invoice.
720
+
721
+ product_id: The product ID to create this invoice for. Include this if you want to create an
722
+ invoice for an existing product.
723
+
724
+ charge_buyer_fee: Whether or not to charge the customer a buyer fee.
725
+
726
+ customer_name: The name of the customer to create this invoice for. This is required if you
727
+ want to create an invoice for a customer who does not have a member of your
728
+ company yet.
729
+
730
+ payment_token_id: The payment token ID to use for this invoice. If using charge_automatically, you
731
+ must provide a payment_token.
732
+
733
+ extra_headers: Send extra headers
734
+
735
+ extra_query: Add additional query parameters to the request
736
+
737
+ extra_body: Add additional JSON properties to the request
738
+
739
+ timeout: Override the client-level default timeout for this request, in seconds
740
+ """
741
+ ...
742
+
743
+ @overload
744
+ async def create(
745
+ self,
746
+ *,
747
+ collection_method: CollectionMethod,
748
+ company_id: str,
749
+ due_date: Union[str, datetime],
750
+ email_address: str,
751
+ plan: invoice_create_params.CreateInvoiceInputWithProductIDAndEmailAddressPlan,
752
+ product_id: str,
753
+ charge_buyer_fee: Optional[bool] | Omit = omit,
754
+ customer_name: Optional[str] | Omit = omit,
755
+ payment_token_id: Optional[str] | Omit = omit,
756
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
757
+ # The extra values given here take precedence over values defined on the client or passed to this method.
758
+ extra_headers: Headers | None = None,
759
+ extra_query: Query | None = None,
760
+ extra_body: Body | None = None,
761
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
762
+ ) -> Invoice:
763
+ """
764
+ Creates an invoice
765
+
766
+ Required permissions:
767
+
768
+ - `invoice:create`
769
+ - `plan:basic:read`
770
+
771
+ Args:
772
+ collection_method: The method of collection for this invoice. If using charge_automatically, you
773
+ must provide a payment_token.
774
+
775
+ company_id: The company ID to create this invoice for.
776
+
777
+ due_date: The date the invoice is due, if applicable.
778
+
779
+ email_address: The email address to create this invoice for. This is required if you want to
780
+ create an invoice for a user who does not have a member of your company yet.
781
+
782
+ plan: The properties of the plan to create for this invoice.
783
+
784
+ product_id: The product ID to create this invoice for. Include this if you want to create an
785
+ invoice for an existing product.
786
+
787
+ charge_buyer_fee: Whether or not to charge the customer a buyer fee.
788
+
789
+ customer_name: The name of the customer to create this invoice for. This is required if you
790
+ want to create an invoice for a customer who does not have a member of your
791
+ company yet.
792
+
793
+ payment_token_id: The payment token ID to use for this invoice. If using charge_automatically, you
794
+ must provide a payment_token.
795
+
796
+ extra_headers: Send extra headers
797
+
798
+ extra_query: Add additional query parameters to the request
799
+
800
+ extra_body: Add additional JSON properties to the request
801
+
802
+ timeout: Override the client-level default timeout for this request, in seconds
803
+ """
804
+ ...
805
+
806
+ @required_args(
807
+ ["collection_method", "company_id", "due_date", "member_id", "plan", "product"],
808
+ ["collection_method", "company_id", "due_date", "email_address", "plan", "product"],
809
+ ["collection_method", "company_id", "due_date", "member_id", "plan", "product_id"],
810
+ ["collection_method", "company_id", "due_date", "email_address", "plan", "product_id"],
811
+ )
812
+ async def create(
813
+ self,
814
+ *,
815
+ collection_method: CollectionMethod,
816
+ company_id: str,
817
+ due_date: Union[str, datetime],
818
+ member_id: str | Omit = omit,
819
+ plan: invoice_create_params.CreateInvoiceInputWithProductAndMemberIDPlan
820
+ | invoice_create_params.CreateInvoiceInputWithProductAndEmailAddressPlan
821
+ | invoice_create_params.CreateInvoiceInputWithProductIDAndMemberIDPlan
822
+ | invoice_create_params.CreateInvoiceInputWithProductIDAndEmailAddressPlan,
823
+ product: invoice_create_params.CreateInvoiceInputWithProductAndMemberIDProduct
824
+ | invoice_create_params.CreateInvoiceInputWithProductAndEmailAddressProduct
825
+ | Omit = omit,
826
+ charge_buyer_fee: Optional[bool] | Omit = omit,
827
+ customer_name: Optional[str] | Omit = omit,
828
+ payment_token_id: Optional[str] | Omit = omit,
829
+ email_address: str | Omit = omit,
830
+ product_id: str | Omit = omit,
831
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
832
+ # The extra values given here take precedence over values defined on the client or passed to this method.
833
+ extra_headers: Headers | None = None,
834
+ extra_query: Query | None = None,
835
+ extra_body: Body | None = None,
836
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
837
+ ) -> Invoice:
838
+ return await self._post(
839
+ "/invoices",
840
+ body=await async_maybe_transform(
841
+ {
842
+ "collection_method": collection_method,
843
+ "company_id": company_id,
844
+ "due_date": due_date,
845
+ "member_id": member_id,
846
+ "plan": plan,
847
+ "product": product,
848
+ "charge_buyer_fee": charge_buyer_fee,
849
+ "customer_name": customer_name,
850
+ "payment_token_id": payment_token_id,
851
+ "email_address": email_address,
852
+ "product_id": product_id,
853
+ },
854
+ invoice_create_params.InvoiceCreateParams,
855
+ ),
856
+ options=make_request_options(
857
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
858
+ ),
859
+ cast_to=Invoice,
860
+ )
861
+
862
+ async def retrieve(
863
+ self,
864
+ id: str,
865
+ *,
866
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
867
+ # The extra values given here take precedence over values defined on the client or passed to this method.
868
+ extra_headers: Headers | None = None,
869
+ extra_query: Query | None = None,
870
+ extra_body: Body | None = None,
871
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
872
+ ) -> Invoice:
873
+ """
874
+ Retrieves an invoice by ID or token
875
+
876
+ Required permissions:
877
+
878
+ - `invoice:basic:read`
879
+ - `plan:basic:read`
880
+
881
+ Args:
882
+ extra_headers: Send extra headers
883
+
884
+ extra_query: Add additional query parameters to the request
885
+
886
+ extra_body: Add additional JSON properties to the request
887
+
888
+ timeout: Override the client-level default timeout for this request, in seconds
889
+ """
890
+ if not id:
891
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
892
+ return await self._get(
893
+ f"/invoices/{id}",
894
+ options=make_request_options(
895
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
896
+ ),
897
+ cast_to=Invoice,
898
+ )
899
+
900
+ def list(
901
+ self,
902
+ *,
903
+ company_id: str,
904
+ after: Optional[str] | Omit = omit,
905
+ before: Optional[str] | Omit = omit,
906
+ collection_methods: Optional[List[CollectionMethod]] | Omit = omit,
907
+ created_after: Union[str, datetime, None] | Omit = omit,
908
+ created_before: Union[str, datetime, None] | Omit = omit,
909
+ direction: Optional[Direction] | Omit = omit,
910
+ first: Optional[int] | Omit = omit,
911
+ last: Optional[int] | Omit = omit,
912
+ order: Optional[Literal["id", "created_at", "due_date"]] | Omit = omit,
913
+ product_ids: Optional[SequenceNotStr[str]] | Omit = omit,
914
+ statuses: Optional[List[InvoiceStatus]] | Omit = omit,
915
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
916
+ # The extra values given here take precedence over values defined on the client or passed to this method.
917
+ extra_headers: Headers | None = None,
918
+ extra_query: Query | None = None,
919
+ extra_body: Body | None = None,
920
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
921
+ ) -> AsyncPaginator[InvoiceListItem, AsyncCursorPage[InvoiceListItem]]:
922
+ """
923
+ Lists invoices
924
+
925
+ Required permissions:
926
+
927
+ - `invoice:basic:read`
928
+ - `plan:basic:read`
929
+
930
+ Args:
931
+ company_id: The ID of the company to list invoices for
932
+
933
+ after: Returns the elements in the list that come after the specified cursor.
934
+
935
+ before: Returns the elements in the list that come before the specified cursor.
936
+
937
+ collection_methods: Filter invoices by their collection method
938
+
939
+ created_after: The minimum creation date to filter by
940
+
941
+ created_before: The maximum creation date to filter by
942
+
943
+ direction: The direction of the sort.
944
+
945
+ first: Returns the first _n_ elements from the list.
946
+
947
+ last: Returns the last _n_ elements from the list.
948
+
949
+ order: Which columns can be used to sort.
950
+
951
+ product_ids: Return only invoices created for these specific product ids
952
+
953
+ statuses: The statuses to filter the invoices by
954
+
955
+ extra_headers: Send extra headers
956
+
957
+ extra_query: Add additional query parameters to the request
958
+
959
+ extra_body: Add additional JSON properties to the request
960
+
961
+ timeout: Override the client-level default timeout for this request, in seconds
962
+ """
963
+ return self._get_api_list(
964
+ "/invoices",
965
+ page=AsyncCursorPage[InvoiceListItem],
966
+ options=make_request_options(
967
+ extra_headers=extra_headers,
968
+ extra_query=extra_query,
969
+ extra_body=extra_body,
970
+ timeout=timeout,
971
+ query=maybe_transform(
972
+ {
973
+ "company_id": company_id,
974
+ "after": after,
975
+ "before": before,
976
+ "collection_methods": collection_methods,
977
+ "created_after": created_after,
978
+ "created_before": created_before,
979
+ "direction": direction,
980
+ "first": first,
981
+ "last": last,
982
+ "order": order,
983
+ "product_ids": product_ids,
984
+ "statuses": statuses,
985
+ },
986
+ invoice_list_params.InvoiceListParams,
987
+ ),
988
+ ),
989
+ model=InvoiceListItem,
990
+ )
991
+
992
+ async def void(
993
+ self,
994
+ id: str,
995
+ *,
996
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
997
+ # The extra values given here take precedence over values defined on the client or passed to this method.
998
+ extra_headers: Headers | None = None,
999
+ extra_query: Query | None = None,
1000
+ extra_body: Body | None = None,
1001
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1002
+ ) -> InvoiceVoidResponse:
1003
+ """
1004
+ Void an invoice
1005
+
1006
+ Required permissions:
1007
+
1008
+ - `invoice:update`
1009
+
1010
+ Args:
1011
+ extra_headers: Send extra headers
1012
+
1013
+ extra_query: Add additional query parameters to the request
1014
+
1015
+ extra_body: Add additional JSON properties to the request
1016
+
1017
+ timeout: Override the client-level default timeout for this request, in seconds
1018
+ """
1019
+ if not id:
1020
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1021
+ return await self._post(
1022
+ f"/invoices/{id}/void",
1023
+ options=make_request_options(
1024
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1025
+ ),
1026
+ cast_to=InvoiceVoidResponse,
1027
+ )
1028
+
1029
+
1030
+ class InvoicesResourceWithRawResponse:
1031
+ def __init__(self, invoices: InvoicesResource) -> None:
1032
+ self._invoices = invoices
1033
+
1034
+ self.create = to_raw_response_wrapper(
1035
+ invoices.create,
1036
+ )
1037
+ self.retrieve = to_raw_response_wrapper(
1038
+ invoices.retrieve,
1039
+ )
1040
+ self.list = to_raw_response_wrapper(
1041
+ invoices.list,
1042
+ )
1043
+ self.void = to_raw_response_wrapper(
1044
+ invoices.void,
1045
+ )
1046
+
1047
+
1048
+ class AsyncInvoicesResourceWithRawResponse:
1049
+ def __init__(self, invoices: AsyncInvoicesResource) -> None:
1050
+ self._invoices = invoices
1051
+
1052
+ self.create = async_to_raw_response_wrapper(
1053
+ invoices.create,
1054
+ )
1055
+ self.retrieve = async_to_raw_response_wrapper(
1056
+ invoices.retrieve,
1057
+ )
1058
+ self.list = async_to_raw_response_wrapper(
1059
+ invoices.list,
1060
+ )
1061
+ self.void = async_to_raw_response_wrapper(
1062
+ invoices.void,
1063
+ )
1064
+
1065
+
1066
+ class InvoicesResourceWithStreamingResponse:
1067
+ def __init__(self, invoices: InvoicesResource) -> None:
1068
+ self._invoices = invoices
1069
+
1070
+ self.create = to_streamed_response_wrapper(
1071
+ invoices.create,
1072
+ )
1073
+ self.retrieve = to_streamed_response_wrapper(
1074
+ invoices.retrieve,
1075
+ )
1076
+ self.list = to_streamed_response_wrapper(
1077
+ invoices.list,
1078
+ )
1079
+ self.void = to_streamed_response_wrapper(
1080
+ invoices.void,
1081
+ )
1082
+
1083
+
1084
+ class AsyncInvoicesResourceWithStreamingResponse:
1085
+ def __init__(self, invoices: AsyncInvoicesResource) -> None:
1086
+ self._invoices = invoices
1087
+
1088
+ self.create = async_to_streamed_response_wrapper(
1089
+ invoices.create,
1090
+ )
1091
+ self.retrieve = async_to_streamed_response_wrapper(
1092
+ invoices.retrieve,
1093
+ )
1094
+ self.list = async_to_streamed_response_wrapper(
1095
+ invoices.list,
1096
+ )
1097
+ self.void = async_to_streamed_response_wrapper(
1098
+ invoices.void,
1099
+ )