whop-sdk 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of whop-sdk might be problematic. Click here for more details.
- whop_sdk/__init__.py +94 -0
- whop_sdk/_base_client.py +1995 -0
- whop_sdk/_client.py +664 -0
- whop_sdk/_compat.py +219 -0
- whop_sdk/_constants.py +14 -0
- whop_sdk/_exceptions.py +112 -0
- whop_sdk/_files.py +123 -0
- whop_sdk/_models.py +835 -0
- whop_sdk/_qs.py +150 -0
- whop_sdk/_resource.py +43 -0
- whop_sdk/_response.py +830 -0
- whop_sdk/_streaming.py +333 -0
- whop_sdk/_types.py +260 -0
- whop_sdk/_utils/__init__.py +64 -0
- whop_sdk/_utils/_compat.py +45 -0
- whop_sdk/_utils/_datetime_parse.py +136 -0
- whop_sdk/_utils/_logs.py +25 -0
- whop_sdk/_utils/_proxy.py +65 -0
- whop_sdk/_utils/_reflection.py +42 -0
- whop_sdk/_utils/_resources_proxy.py +24 -0
- whop_sdk/_utils/_streams.py +12 -0
- whop_sdk/_utils/_sync.py +86 -0
- whop_sdk/_utils/_transform.py +457 -0
- whop_sdk/_utils/_typing.py +156 -0
- whop_sdk/_utils/_utils.py +421 -0
- whop_sdk/_version.py +4 -0
- whop_sdk/lib/.keep +4 -0
- whop_sdk/pagination.py +61 -0
- whop_sdk/py.typed +0 -0
- whop_sdk/resources/__init__.py +316 -0
- whop_sdk/resources/app_builds.py +562 -0
- whop_sdk/resources/apps.py +665 -0
- whop_sdk/resources/authorized_users.py +336 -0
- whop_sdk/resources/chat_channels.py +469 -0
- whop_sdk/resources/checkout_configurations.py +464 -0
- whop_sdk/resources/companies.py +171 -0
- whop_sdk/resources/course_lesson_interactions.py +343 -0
- whop_sdk/resources/entries.py +539 -0
- whop_sdk/resources/experiences.py +859 -0
- whop_sdk/resources/forum_posts.py +512 -0
- whop_sdk/resources/invoices.py +633 -0
- whop_sdk/resources/ledger_accounts.py +171 -0
- whop_sdk/resources/memberships.py +810 -0
- whop_sdk/resources/messages.py +446 -0
- whop_sdk/resources/payments.py +761 -0
- whop_sdk/resources/plans.py +906 -0
- whop_sdk/resources/products.py +969 -0
- whop_sdk/resources/reactions.py +423 -0
- whop_sdk/resources/shipments.py +451 -0
- whop_sdk/resources/support_channels.py +455 -0
- whop_sdk/resources/transfers.py +488 -0
- whop_sdk/resources/users.py +248 -0
- whop_sdk/resources/webhooks.py +69 -0
- whop_sdk/types/__init__.py +135 -0
- whop_sdk/types/app_build_create_params.py +59 -0
- whop_sdk/types/app_build_list_params.py +34 -0
- whop_sdk/types/app_build_list_response.py +50 -0
- whop_sdk/types/app_create_params.py +19 -0
- whop_sdk/types/app_list_params.py +54 -0
- whop_sdk/types/app_list_response.py +91 -0
- whop_sdk/types/app_update_params.py +58 -0
- whop_sdk/types/authorized_user_list_params.py +33 -0
- whop_sdk/types/authorized_user_list_response.py +33 -0
- whop_sdk/types/authorized_user_retrieve_response.py +33 -0
- whop_sdk/types/chat_channel_list_params.py +28 -0
- whop_sdk/types/chat_channel_list_response.py +43 -0
- whop_sdk/types/chat_channel_update_params.py +32 -0
- whop_sdk/types/checkout_configuration_create_params.py +129 -0
- whop_sdk/types/checkout_configuration_list_params.py +33 -0
- whop_sdk/types/checkout_configuration_list_response.py +66 -0
- whop_sdk/types/course_lesson_interaction_list_params.py +34 -0
- whop_sdk/types/entry_approve_response.py +10 -0
- whop_sdk/types/entry_list_params.py +44 -0
- whop_sdk/types/entry_list_response.py +56 -0
- whop_sdk/types/experience_attach_params.py +12 -0
- whop_sdk/types/experience_create_params.py +22 -0
- whop_sdk/types/experience_delete_response.py +7 -0
- whop_sdk/types/experience_detach_params.py +12 -0
- whop_sdk/types/experience_list_params.py +31 -0
- whop_sdk/types/experience_list_response.py +47 -0
- whop_sdk/types/experience_update_params.py +41 -0
- whop_sdk/types/forum_post_create_params.py +85 -0
- whop_sdk/types/forum_post_list_params.py +31 -0
- whop_sdk/types/forum_post_list_response.py +53 -0
- whop_sdk/types/invoice_create_params.py +137 -0
- whop_sdk/types/invoice_create_response.py +16 -0
- whop_sdk/types/invoice_created_webhook_event.py +26 -0
- whop_sdk/types/invoice_list_params.py +50 -0
- whop_sdk/types/invoice_paid_webhook_event.py +26 -0
- whop_sdk/types/invoice_past_due_webhook_event.py +26 -0
- whop_sdk/types/invoice_void_response.py +7 -0
- whop_sdk/types/invoice_voided_webhook_event.py +26 -0
- whop_sdk/types/ledger_account_retrieve_response.py +78 -0
- whop_sdk/types/membership_cancel_params.py +13 -0
- whop_sdk/types/membership_list_params.py +70 -0
- whop_sdk/types/membership_list_response.py +117 -0
- whop_sdk/types/membership_pause_params.py +16 -0
- whop_sdk/types/membership_update_params.py +13 -0
- whop_sdk/types/message_create_params.py +51 -0
- whop_sdk/types/message_list_params.py +30 -0
- whop_sdk/types/message_list_response.py +90 -0
- whop_sdk/types/payment_list_params.py +72 -0
- whop_sdk/types/payment_list_response.py +221 -0
- whop_sdk/types/payment_refund_params.py +13 -0
- whop_sdk/types/plan_create_params.py +106 -0
- whop_sdk/types/plan_delete_response.py +7 -0
- whop_sdk/types/plan_list_params.py +49 -0
- whop_sdk/types/plan_list_response.py +92 -0
- whop_sdk/types/plan_update_params.py +95 -0
- whop_sdk/types/product_create_params.py +170 -0
- whop_sdk/types/product_delete_response.py +7 -0
- whop_sdk/types/product_list_params.py +41 -0
- whop_sdk/types/product_update_params.py +90 -0
- whop_sdk/types/reaction_create_params.py +19 -0
- whop_sdk/types/reaction_list_params.py +25 -0
- whop_sdk/types/reaction_list_response.py +32 -0
- whop_sdk/types/shared/__init__.py +55 -0
- whop_sdk/types/shared/access_pass_type.py +7 -0
- whop_sdk/types/shared/app.py +159 -0
- whop_sdk/types/shared/app_build.py +50 -0
- whop_sdk/types/shared/app_build_platforms.py +7 -0
- whop_sdk/types/shared/app_build_statuses.py +7 -0
- whop_sdk/types/shared/app_statuses.py +7 -0
- whop_sdk/types/shared/app_view_type.py +7 -0
- whop_sdk/types/shared/authorized_user_roles.py +9 -0
- whop_sdk/types/shared/business_types.py +22 -0
- whop_sdk/types/shared/chat_channel.py +43 -0
- whop_sdk/types/shared/checkout_configuration.py +66 -0
- whop_sdk/types/shared/collection_method.py +7 -0
- whop_sdk/types/shared/company.py +71 -0
- whop_sdk/types/shared/course_lesson_interaction.py +44 -0
- whop_sdk/types/shared/course_lesson_interaction_list_item.py +44 -0
- whop_sdk/types/shared/currency.py +92 -0
- whop_sdk/types/shared/custom_cta.py +21 -0
- whop_sdk/types/shared/direction.py +7 -0
- whop_sdk/types/shared/dms_post_types.py +7 -0
- whop_sdk/types/shared/entry.py +70 -0
- whop_sdk/types/shared/entry_status.py +7 -0
- whop_sdk/types/shared/experience.py +66 -0
- whop_sdk/types/shared/forum_post.py +53 -0
- whop_sdk/types/shared/friendly_receipt_status.py +24 -0
- whop_sdk/types/shared/global_affiliate_status.py +7 -0
- whop_sdk/types/shared/industry_types.py +67 -0
- whop_sdk/types/shared/invoice.py +61 -0
- whop_sdk/types/shared/invoice_list_item.py +61 -0
- whop_sdk/types/shared/invoice_status.py +7 -0
- whop_sdk/types/shared/membership.py +117 -0
- whop_sdk/types/shared/membership_status.py +9 -0
- whop_sdk/types/shared/message.py +90 -0
- whop_sdk/types/shared/page_info.py +21 -0
- whop_sdk/types/shared/payment.py +211 -0
- whop_sdk/types/shared/plan.py +123 -0
- whop_sdk/types/shared/plan_type.py +7 -0
- whop_sdk/types/shared/product.py +124 -0
- whop_sdk/types/shared/product_list_item.py +49 -0
- whop_sdk/types/shared/promo_type.py +7 -0
- whop_sdk/types/shared/reaction.py +32 -0
- whop_sdk/types/shared/receipt_status.py +7 -0
- whop_sdk/types/shared/release_method.py +7 -0
- whop_sdk/types/shared/shipment.py +48 -0
- whop_sdk/types/shared/shipment_carrier.py +84 -0
- whop_sdk/types/shared/shipment_status.py +18 -0
- whop_sdk/types/shared/shipment_substatus.py +36 -0
- whop_sdk/types/shared/support_channel.py +39 -0
- whop_sdk/types/shared/tax_type.py +7 -0
- whop_sdk/types/shared/transfer.py +109 -0
- whop_sdk/types/shared/visibility.py +7 -0
- whop_sdk/types/shared/visibility_filter.py +9 -0
- whop_sdk/types/shared/who_can_post.py +7 -0
- whop_sdk/types/shared/who_can_react.py +7 -0
- whop_sdk/types/shared_params/__init__.py +27 -0
- whop_sdk/types/shared_params/access_pass_type.py +9 -0
- whop_sdk/types/shared_params/app_build_platforms.py +9 -0
- whop_sdk/types/shared_params/app_build_statuses.py +9 -0
- whop_sdk/types/shared_params/app_statuses.py +9 -0
- whop_sdk/types/shared_params/app_view_type.py +9 -0
- whop_sdk/types/shared_params/authorized_user_roles.py +11 -0
- whop_sdk/types/shared_params/business_types.py +24 -0
- whop_sdk/types/shared_params/collection_method.py +9 -0
- whop_sdk/types/shared_params/currency.py +94 -0
- whop_sdk/types/shared_params/custom_cta.py +23 -0
- whop_sdk/types/shared_params/direction.py +9 -0
- whop_sdk/types/shared_params/entry_status.py +9 -0
- whop_sdk/types/shared_params/friendly_receipt_status.py +26 -0
- whop_sdk/types/shared_params/global_affiliate_status.py +9 -0
- whop_sdk/types/shared_params/industry_types.py +69 -0
- whop_sdk/types/shared_params/invoice_status.py +9 -0
- whop_sdk/types/shared_params/membership_status.py +11 -0
- whop_sdk/types/shared_params/plan_type.py +9 -0
- whop_sdk/types/shared_params/receipt_status.py +9 -0
- whop_sdk/types/shared_params/release_method.py +9 -0
- whop_sdk/types/shared_params/tax_type.py +9 -0
- whop_sdk/types/shared_params/visibility.py +9 -0
- whop_sdk/types/shared_params/visibility_filter.py +11 -0
- whop_sdk/types/shared_params/who_can_post.py +9 -0
- whop_sdk/types/shared_params/who_can_react.py +9 -0
- whop_sdk/types/shipment_create_params.py +18 -0
- whop_sdk/types/shipment_list_params.py +31 -0
- whop_sdk/types/shipment_list_response.py +48 -0
- whop_sdk/types/support_channel_create_params.py +15 -0
- whop_sdk/types/support_channel_list_params.py +40 -0
- whop_sdk/types/support_channel_list_response.py +39 -0
- whop_sdk/types/transfer_create_params.py +36 -0
- whop_sdk/types/transfer_list_params.py +42 -0
- whop_sdk/types/transfer_list_response.py +35 -0
- whop_sdk/types/unwrap_webhook_event.py +15 -0
- whop_sdk/types/user_check_access_response.py +15 -0
- whop_sdk/types/user_retrieve_response.py +25 -0
- whop_sdk-0.0.1.dist-info/METADATA +522 -0
- whop_sdk-0.0.1.dist-info/RECORD +212 -0
- whop_sdk-0.0.1.dist-info/WHEEL +4 -0
- whop_sdk-0.0.1.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,969 @@
|
|
|
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, Iterable, Optional
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import product_list_params, product_create_params, product_update_params
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
12
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
13
|
+
from .._compat import cached_property
|
|
14
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
15
|
+
from .._response import (
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
)
|
|
21
|
+
from ..pagination import SyncCursorPage, AsyncCursorPage
|
|
22
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
23
|
+
from ..types.shared.product import Product
|
|
24
|
+
from ..types.shared.direction import Direction
|
|
25
|
+
from ..types.shared.custom_cta import CustomCta
|
|
26
|
+
from ..types.shared.visibility import Visibility
|
|
27
|
+
from ..types.shared.business_types import BusinessTypes
|
|
28
|
+
from ..types.shared.industry_types import IndustryTypes
|
|
29
|
+
from ..types.product_delete_response import ProductDeleteResponse
|
|
30
|
+
from ..types.shared.access_pass_type import AccessPassType
|
|
31
|
+
from ..types.shared.product_list_item import ProductListItem
|
|
32
|
+
from ..types.shared.visibility_filter import VisibilityFilter
|
|
33
|
+
from ..types.shared.global_affiliate_status import GlobalAffiliateStatus
|
|
34
|
+
|
|
35
|
+
__all__ = ["ProductsResource", "AsyncProductsResource"]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ProductsResource(SyncAPIResource):
|
|
39
|
+
@cached_property
|
|
40
|
+
def with_raw_response(self) -> ProductsResourceWithRawResponse:
|
|
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 ProductsResourceWithRawResponse(self)
|
|
48
|
+
|
|
49
|
+
@cached_property
|
|
50
|
+
def with_streaming_response(self) -> ProductsResourceWithStreamingResponse:
|
|
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 ProductsResourceWithStreamingResponse(self)
|
|
57
|
+
|
|
58
|
+
def create(
|
|
59
|
+
self,
|
|
60
|
+
*,
|
|
61
|
+
company_id: str,
|
|
62
|
+
title: str,
|
|
63
|
+
access_pass_type: Optional[AccessPassType] | Omit = omit,
|
|
64
|
+
banner_image: Optional[product_create_params.BannerImage] | Omit = omit,
|
|
65
|
+
business_type: Optional[BusinessTypes] | Omit = omit,
|
|
66
|
+
collect_shipping_address: Optional[bool] | Omit = omit,
|
|
67
|
+
custom_cta: Optional[CustomCta] | Omit = omit,
|
|
68
|
+
custom_cta_url: Optional[str] | Omit = omit,
|
|
69
|
+
custom_statement_descriptor: Optional[str] | Omit = omit,
|
|
70
|
+
description: Optional[str] | Omit = omit,
|
|
71
|
+
experience_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
72
|
+
global_affiliate_percentage: Optional[float] | Omit = omit,
|
|
73
|
+
global_affiliate_status: Optional[GlobalAffiliateStatus] | Omit = omit,
|
|
74
|
+
headline: Optional[str] | Omit = omit,
|
|
75
|
+
industry_type: Optional[IndustryTypes] | Omit = omit,
|
|
76
|
+
member_affiliate_percentage: Optional[float] | Omit = omit,
|
|
77
|
+
member_affiliate_status: Optional[GlobalAffiliateStatus] | Omit = omit,
|
|
78
|
+
plan_options: Optional[product_create_params.PlanOptions] | Omit = omit,
|
|
79
|
+
product_highlights: Optional[Iterable[product_create_params.ProductHighlight]] | Omit = omit,
|
|
80
|
+
product_tax_code_id: Optional[str] | Omit = omit,
|
|
81
|
+
redirect_purchase_url: Optional[str] | Omit = omit,
|
|
82
|
+
route: Optional[str] | Omit = omit,
|
|
83
|
+
visibility: Optional[Visibility] | Omit = omit,
|
|
84
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
85
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
86
|
+
extra_headers: Headers | None = None,
|
|
87
|
+
extra_query: Query | None = None,
|
|
88
|
+
extra_body: Body | None = None,
|
|
89
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
90
|
+
) -> Product:
|
|
91
|
+
"""
|
|
92
|
+
Creates a new Product
|
|
93
|
+
|
|
94
|
+
Required permissions:
|
|
95
|
+
|
|
96
|
+
- `access_pass:create`
|
|
97
|
+
- `access_pass:basic:read`
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
company_id: The ID of the company to create the product for.
|
|
101
|
+
|
|
102
|
+
title: The title of the product.
|
|
103
|
+
|
|
104
|
+
access_pass_type: The different types an access pass can be.
|
|
105
|
+
|
|
106
|
+
banner_image: A banner image for the product in png, jpeg format
|
|
107
|
+
|
|
108
|
+
business_type: The different business types a company can be.
|
|
109
|
+
|
|
110
|
+
collect_shipping_address: Whether or not to collect shipping information at checkout from the customer.
|
|
111
|
+
|
|
112
|
+
custom_cta: The different types of custom CTAs that can be selected.
|
|
113
|
+
|
|
114
|
+
custom_cta_url: The custom call to action URL for the product.
|
|
115
|
+
|
|
116
|
+
custom_statement_descriptor: The custom statement descriptor for the product i.e. WHOP\\**SPORTS, must be
|
|
117
|
+
between 5 and 22 characters, contain at least one letter, and not contain any of
|
|
118
|
+
the following characters: <, >, \\,, ', "
|
|
119
|
+
|
|
120
|
+
description: A written description of the product.
|
|
121
|
+
|
|
122
|
+
experience_ids: An array of experience IDs that this pass has
|
|
123
|
+
|
|
124
|
+
global_affiliate_percentage: The percentage of the revenue that goes to the global affiliate program.
|
|
125
|
+
|
|
126
|
+
global_affiliate_status: The different statuses of the global affiliate program for an access pass.
|
|
127
|
+
|
|
128
|
+
headline: The headline of the product.
|
|
129
|
+
|
|
130
|
+
industry_type: The different industry types a company can be in.
|
|
131
|
+
|
|
132
|
+
member_affiliate_percentage: The percentage of the revenue that goes to the member affiliate program.
|
|
133
|
+
|
|
134
|
+
member_affiliate_status: The different statuses of the global affiliate program for an access pass.
|
|
135
|
+
|
|
136
|
+
plan_options: The details to assign an autogenerated plan.
|
|
137
|
+
|
|
138
|
+
product_highlights: The product highlights for the product.
|
|
139
|
+
|
|
140
|
+
product_tax_code_id: The ID of the product tax code to apply to this product.
|
|
141
|
+
|
|
142
|
+
redirect_purchase_url: The URL to redirect the customer to after a purchase.
|
|
143
|
+
|
|
144
|
+
route: The route of the product.
|
|
145
|
+
|
|
146
|
+
visibility: Visibility of a resource
|
|
147
|
+
|
|
148
|
+
extra_headers: Send extra headers
|
|
149
|
+
|
|
150
|
+
extra_query: Add additional query parameters to the request
|
|
151
|
+
|
|
152
|
+
extra_body: Add additional JSON properties to the request
|
|
153
|
+
|
|
154
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
155
|
+
"""
|
|
156
|
+
return self._post(
|
|
157
|
+
"/products",
|
|
158
|
+
body=maybe_transform(
|
|
159
|
+
{
|
|
160
|
+
"company_id": company_id,
|
|
161
|
+
"title": title,
|
|
162
|
+
"access_pass_type": access_pass_type,
|
|
163
|
+
"banner_image": banner_image,
|
|
164
|
+
"business_type": business_type,
|
|
165
|
+
"collect_shipping_address": collect_shipping_address,
|
|
166
|
+
"custom_cta": custom_cta,
|
|
167
|
+
"custom_cta_url": custom_cta_url,
|
|
168
|
+
"custom_statement_descriptor": custom_statement_descriptor,
|
|
169
|
+
"description": description,
|
|
170
|
+
"experience_ids": experience_ids,
|
|
171
|
+
"global_affiliate_percentage": global_affiliate_percentage,
|
|
172
|
+
"global_affiliate_status": global_affiliate_status,
|
|
173
|
+
"headline": headline,
|
|
174
|
+
"industry_type": industry_type,
|
|
175
|
+
"member_affiliate_percentage": member_affiliate_percentage,
|
|
176
|
+
"member_affiliate_status": member_affiliate_status,
|
|
177
|
+
"plan_options": plan_options,
|
|
178
|
+
"product_highlights": product_highlights,
|
|
179
|
+
"product_tax_code_id": product_tax_code_id,
|
|
180
|
+
"redirect_purchase_url": redirect_purchase_url,
|
|
181
|
+
"route": route,
|
|
182
|
+
"visibility": visibility,
|
|
183
|
+
},
|
|
184
|
+
product_create_params.ProductCreateParams,
|
|
185
|
+
),
|
|
186
|
+
options=make_request_options(
|
|
187
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
188
|
+
),
|
|
189
|
+
cast_to=Product,
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
def retrieve(
|
|
193
|
+
self,
|
|
194
|
+
id: str,
|
|
195
|
+
*,
|
|
196
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
197
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
198
|
+
extra_headers: Headers | None = None,
|
|
199
|
+
extra_query: Query | None = None,
|
|
200
|
+
extra_body: Body | None = None,
|
|
201
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
202
|
+
) -> Product:
|
|
203
|
+
"""
|
|
204
|
+
Retrieves a product by ID or route
|
|
205
|
+
|
|
206
|
+
Required permissions:
|
|
207
|
+
|
|
208
|
+
- `access_pass:basic:read`
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
extra_headers: Send extra headers
|
|
212
|
+
|
|
213
|
+
extra_query: Add additional query parameters to the request
|
|
214
|
+
|
|
215
|
+
extra_body: Add additional JSON properties to the request
|
|
216
|
+
|
|
217
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
218
|
+
"""
|
|
219
|
+
if not id:
|
|
220
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
221
|
+
return self._get(
|
|
222
|
+
f"/products/{id}",
|
|
223
|
+
options=make_request_options(
|
|
224
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
225
|
+
),
|
|
226
|
+
cast_to=Product,
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
def update(
|
|
230
|
+
self,
|
|
231
|
+
id: str,
|
|
232
|
+
*,
|
|
233
|
+
banner_image: Optional[product_update_params.BannerImage] | Omit = omit,
|
|
234
|
+
business_type: Optional[BusinessTypes] | Omit = omit,
|
|
235
|
+
collect_shipping_address: Optional[bool] | Omit = omit,
|
|
236
|
+
custom_cta: Optional[CustomCta] | Omit = omit,
|
|
237
|
+
custom_cta_url: Optional[str] | Omit = omit,
|
|
238
|
+
custom_statement_descriptor: Optional[str] | Omit = omit,
|
|
239
|
+
description: Optional[str] | Omit = omit,
|
|
240
|
+
global_affiliate_percentage: Optional[float] | Omit = omit,
|
|
241
|
+
global_affiliate_status: Optional[GlobalAffiliateStatus] | Omit = omit,
|
|
242
|
+
headline: Optional[str] | Omit = omit,
|
|
243
|
+
industry_type: Optional[IndustryTypes] | Omit = omit,
|
|
244
|
+
member_affiliate_percentage: Optional[float] | Omit = omit,
|
|
245
|
+
member_affiliate_status: Optional[GlobalAffiliateStatus] | Omit = omit,
|
|
246
|
+
product_tax_code_id: Optional[str] | Omit = omit,
|
|
247
|
+
redirect_purchase_url: Optional[str] | Omit = omit,
|
|
248
|
+
route: Optional[str] | Omit = omit,
|
|
249
|
+
title: Optional[str] | Omit = omit,
|
|
250
|
+
visibility: Optional[Visibility] | Omit = omit,
|
|
251
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
252
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
253
|
+
extra_headers: Headers | None = None,
|
|
254
|
+
extra_query: Query | None = None,
|
|
255
|
+
extra_body: Body | None = None,
|
|
256
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
257
|
+
) -> Product:
|
|
258
|
+
"""
|
|
259
|
+
Updates an existing Product
|
|
260
|
+
|
|
261
|
+
Required permissions:
|
|
262
|
+
|
|
263
|
+
- `access_pass:update`
|
|
264
|
+
- `access_pass:basic:read`
|
|
265
|
+
|
|
266
|
+
Args:
|
|
267
|
+
banner_image: A banner image for the product in png, jpeg format
|
|
268
|
+
|
|
269
|
+
business_type: The different business types a company can be.
|
|
270
|
+
|
|
271
|
+
collect_shipping_address: Whether or not to collect shipping information at checkout from the customer.
|
|
272
|
+
|
|
273
|
+
custom_cta: The different types of custom CTAs that can be selected.
|
|
274
|
+
|
|
275
|
+
custom_cta_url: The custom call to action URL for the product.
|
|
276
|
+
|
|
277
|
+
custom_statement_descriptor: The custom statement descriptor for the product i.e. WHOP\\**SPORTS, must be
|
|
278
|
+
between 5 and 22 characters, contain at least one letter, and not contain any of
|
|
279
|
+
the following characters: <, >, \\,, ', "
|
|
280
|
+
|
|
281
|
+
description: A written description of the product.
|
|
282
|
+
|
|
283
|
+
global_affiliate_percentage: The percentage of the revenue that goes to the global affiliate program.
|
|
284
|
+
|
|
285
|
+
global_affiliate_status: The different statuses of the global affiliate program for an access pass.
|
|
286
|
+
|
|
287
|
+
headline: The headline of the product.
|
|
288
|
+
|
|
289
|
+
industry_type: The different industry types a company can be in.
|
|
290
|
+
|
|
291
|
+
member_affiliate_percentage: The percentage of the revenue that goes to the member affiliate program.
|
|
292
|
+
|
|
293
|
+
member_affiliate_status: The different statuses of the global affiliate program for an access pass.
|
|
294
|
+
|
|
295
|
+
product_tax_code_id: The ID of the product tax code to apply to this product.
|
|
296
|
+
|
|
297
|
+
redirect_purchase_url: The URL to redirect the customer to after a purchase.
|
|
298
|
+
|
|
299
|
+
route: The route of the product.
|
|
300
|
+
|
|
301
|
+
title: The title of the product.
|
|
302
|
+
|
|
303
|
+
visibility: Visibility of a resource
|
|
304
|
+
|
|
305
|
+
extra_headers: Send extra headers
|
|
306
|
+
|
|
307
|
+
extra_query: Add additional query parameters to the request
|
|
308
|
+
|
|
309
|
+
extra_body: Add additional JSON properties to the request
|
|
310
|
+
|
|
311
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
312
|
+
"""
|
|
313
|
+
if not id:
|
|
314
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
315
|
+
return self._patch(
|
|
316
|
+
f"/products/{id}",
|
|
317
|
+
body=maybe_transform(
|
|
318
|
+
{
|
|
319
|
+
"banner_image": banner_image,
|
|
320
|
+
"business_type": business_type,
|
|
321
|
+
"collect_shipping_address": collect_shipping_address,
|
|
322
|
+
"custom_cta": custom_cta,
|
|
323
|
+
"custom_cta_url": custom_cta_url,
|
|
324
|
+
"custom_statement_descriptor": custom_statement_descriptor,
|
|
325
|
+
"description": description,
|
|
326
|
+
"global_affiliate_percentage": global_affiliate_percentage,
|
|
327
|
+
"global_affiliate_status": global_affiliate_status,
|
|
328
|
+
"headline": headline,
|
|
329
|
+
"industry_type": industry_type,
|
|
330
|
+
"member_affiliate_percentage": member_affiliate_percentage,
|
|
331
|
+
"member_affiliate_status": member_affiliate_status,
|
|
332
|
+
"product_tax_code_id": product_tax_code_id,
|
|
333
|
+
"redirect_purchase_url": redirect_purchase_url,
|
|
334
|
+
"route": route,
|
|
335
|
+
"title": title,
|
|
336
|
+
"visibility": visibility,
|
|
337
|
+
},
|
|
338
|
+
product_update_params.ProductUpdateParams,
|
|
339
|
+
),
|
|
340
|
+
options=make_request_options(
|
|
341
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
342
|
+
),
|
|
343
|
+
cast_to=Product,
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
def list(
|
|
347
|
+
self,
|
|
348
|
+
*,
|
|
349
|
+
company_id: str,
|
|
350
|
+
after: Optional[str] | Omit = omit,
|
|
351
|
+
before: Optional[str] | Omit = omit,
|
|
352
|
+
direction: Optional[Direction] | Omit = omit,
|
|
353
|
+
first: Optional[int] | Omit = omit,
|
|
354
|
+
last: Optional[int] | Omit = omit,
|
|
355
|
+
order: Optional[Literal["active_memberships_count", "created_at", "usd_gmv", "usd_gmv_30_days"]] | Omit = omit,
|
|
356
|
+
product_types: Optional[List[AccessPassType]] | Omit = omit,
|
|
357
|
+
visibilities: Optional[List[VisibilityFilter]] | Omit = omit,
|
|
358
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
359
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
360
|
+
extra_headers: Headers | None = None,
|
|
361
|
+
extra_query: Query | None = None,
|
|
362
|
+
extra_body: Body | None = None,
|
|
363
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
364
|
+
) -> SyncCursorPage[ProductListItem]:
|
|
365
|
+
"""
|
|
366
|
+
Lists products for a company
|
|
367
|
+
|
|
368
|
+
Required permissions:
|
|
369
|
+
|
|
370
|
+
- `access_pass:basic:read`
|
|
371
|
+
|
|
372
|
+
Args:
|
|
373
|
+
company_id: The ID of the company to filter products by
|
|
374
|
+
|
|
375
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
376
|
+
|
|
377
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
378
|
+
|
|
379
|
+
direction: The direction of the sort.
|
|
380
|
+
|
|
381
|
+
first: Returns the first _n_ elements from the list.
|
|
382
|
+
|
|
383
|
+
last: Returns the last _n_ elements from the list.
|
|
384
|
+
|
|
385
|
+
order: The ways a relation of AccessPasses can be ordered
|
|
386
|
+
|
|
387
|
+
product_types: The type of products to filter by
|
|
388
|
+
|
|
389
|
+
visibilities: The visibility of the products to filter by
|
|
390
|
+
|
|
391
|
+
extra_headers: Send extra headers
|
|
392
|
+
|
|
393
|
+
extra_query: Add additional query parameters to the request
|
|
394
|
+
|
|
395
|
+
extra_body: Add additional JSON properties to the request
|
|
396
|
+
|
|
397
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
398
|
+
"""
|
|
399
|
+
return self._get_api_list(
|
|
400
|
+
"/products",
|
|
401
|
+
page=SyncCursorPage[ProductListItem],
|
|
402
|
+
options=make_request_options(
|
|
403
|
+
extra_headers=extra_headers,
|
|
404
|
+
extra_query=extra_query,
|
|
405
|
+
extra_body=extra_body,
|
|
406
|
+
timeout=timeout,
|
|
407
|
+
query=maybe_transform(
|
|
408
|
+
{
|
|
409
|
+
"company_id": company_id,
|
|
410
|
+
"after": after,
|
|
411
|
+
"before": before,
|
|
412
|
+
"direction": direction,
|
|
413
|
+
"first": first,
|
|
414
|
+
"last": last,
|
|
415
|
+
"order": order,
|
|
416
|
+
"product_types": product_types,
|
|
417
|
+
"visibilities": visibilities,
|
|
418
|
+
},
|
|
419
|
+
product_list_params.ProductListParams,
|
|
420
|
+
),
|
|
421
|
+
),
|
|
422
|
+
model=ProductListItem,
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
def delete(
|
|
426
|
+
self,
|
|
427
|
+
id: str,
|
|
428
|
+
*,
|
|
429
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
430
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
431
|
+
extra_headers: Headers | None = None,
|
|
432
|
+
extra_query: Query | None = None,
|
|
433
|
+
extra_body: Body | None = None,
|
|
434
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
435
|
+
) -> ProductDeleteResponse:
|
|
436
|
+
"""
|
|
437
|
+
Deletes an existing Product
|
|
438
|
+
|
|
439
|
+
Required permissions:
|
|
440
|
+
|
|
441
|
+
- `access_pass:delete`
|
|
442
|
+
|
|
443
|
+
Args:
|
|
444
|
+
extra_headers: Send extra headers
|
|
445
|
+
|
|
446
|
+
extra_query: Add additional query parameters to the request
|
|
447
|
+
|
|
448
|
+
extra_body: Add additional JSON properties to the request
|
|
449
|
+
|
|
450
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
451
|
+
"""
|
|
452
|
+
if not id:
|
|
453
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
454
|
+
return self._delete(
|
|
455
|
+
f"/products/{id}",
|
|
456
|
+
options=make_request_options(
|
|
457
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
458
|
+
),
|
|
459
|
+
cast_to=ProductDeleteResponse,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
class AsyncProductsResource(AsyncAPIResource):
|
|
464
|
+
@cached_property
|
|
465
|
+
def with_raw_response(self) -> AsyncProductsResourceWithRawResponse:
|
|
466
|
+
"""
|
|
467
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
468
|
+
the raw response object instead of the parsed content.
|
|
469
|
+
|
|
470
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
471
|
+
"""
|
|
472
|
+
return AsyncProductsResourceWithRawResponse(self)
|
|
473
|
+
|
|
474
|
+
@cached_property
|
|
475
|
+
def with_streaming_response(self) -> AsyncProductsResourceWithStreamingResponse:
|
|
476
|
+
"""
|
|
477
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
478
|
+
|
|
479
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
480
|
+
"""
|
|
481
|
+
return AsyncProductsResourceWithStreamingResponse(self)
|
|
482
|
+
|
|
483
|
+
async def create(
|
|
484
|
+
self,
|
|
485
|
+
*,
|
|
486
|
+
company_id: str,
|
|
487
|
+
title: str,
|
|
488
|
+
access_pass_type: Optional[AccessPassType] | Omit = omit,
|
|
489
|
+
banner_image: Optional[product_create_params.BannerImage] | Omit = omit,
|
|
490
|
+
business_type: Optional[BusinessTypes] | Omit = omit,
|
|
491
|
+
collect_shipping_address: Optional[bool] | Omit = omit,
|
|
492
|
+
custom_cta: Optional[CustomCta] | Omit = omit,
|
|
493
|
+
custom_cta_url: Optional[str] | Omit = omit,
|
|
494
|
+
custom_statement_descriptor: Optional[str] | Omit = omit,
|
|
495
|
+
description: Optional[str] | Omit = omit,
|
|
496
|
+
experience_ids: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
497
|
+
global_affiliate_percentage: Optional[float] | Omit = omit,
|
|
498
|
+
global_affiliate_status: Optional[GlobalAffiliateStatus] | Omit = omit,
|
|
499
|
+
headline: Optional[str] | Omit = omit,
|
|
500
|
+
industry_type: Optional[IndustryTypes] | Omit = omit,
|
|
501
|
+
member_affiliate_percentage: Optional[float] | Omit = omit,
|
|
502
|
+
member_affiliate_status: Optional[GlobalAffiliateStatus] | Omit = omit,
|
|
503
|
+
plan_options: Optional[product_create_params.PlanOptions] | Omit = omit,
|
|
504
|
+
product_highlights: Optional[Iterable[product_create_params.ProductHighlight]] | Omit = omit,
|
|
505
|
+
product_tax_code_id: Optional[str] | Omit = omit,
|
|
506
|
+
redirect_purchase_url: Optional[str] | Omit = omit,
|
|
507
|
+
route: Optional[str] | Omit = omit,
|
|
508
|
+
visibility: Optional[Visibility] | Omit = omit,
|
|
509
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
510
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
511
|
+
extra_headers: Headers | None = None,
|
|
512
|
+
extra_query: Query | None = None,
|
|
513
|
+
extra_body: Body | None = None,
|
|
514
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
515
|
+
) -> Product:
|
|
516
|
+
"""
|
|
517
|
+
Creates a new Product
|
|
518
|
+
|
|
519
|
+
Required permissions:
|
|
520
|
+
|
|
521
|
+
- `access_pass:create`
|
|
522
|
+
- `access_pass:basic:read`
|
|
523
|
+
|
|
524
|
+
Args:
|
|
525
|
+
company_id: The ID of the company to create the product for.
|
|
526
|
+
|
|
527
|
+
title: The title of the product.
|
|
528
|
+
|
|
529
|
+
access_pass_type: The different types an access pass can be.
|
|
530
|
+
|
|
531
|
+
banner_image: A banner image for the product in png, jpeg format
|
|
532
|
+
|
|
533
|
+
business_type: The different business types a company can be.
|
|
534
|
+
|
|
535
|
+
collect_shipping_address: Whether or not to collect shipping information at checkout from the customer.
|
|
536
|
+
|
|
537
|
+
custom_cta: The different types of custom CTAs that can be selected.
|
|
538
|
+
|
|
539
|
+
custom_cta_url: The custom call to action URL for the product.
|
|
540
|
+
|
|
541
|
+
custom_statement_descriptor: The custom statement descriptor for the product i.e. WHOP\\**SPORTS, must be
|
|
542
|
+
between 5 and 22 characters, contain at least one letter, and not contain any of
|
|
543
|
+
the following characters: <, >, \\,, ', "
|
|
544
|
+
|
|
545
|
+
description: A written description of the product.
|
|
546
|
+
|
|
547
|
+
experience_ids: An array of experience IDs that this pass has
|
|
548
|
+
|
|
549
|
+
global_affiliate_percentage: The percentage of the revenue that goes to the global affiliate program.
|
|
550
|
+
|
|
551
|
+
global_affiliate_status: The different statuses of the global affiliate program for an access pass.
|
|
552
|
+
|
|
553
|
+
headline: The headline of the product.
|
|
554
|
+
|
|
555
|
+
industry_type: The different industry types a company can be in.
|
|
556
|
+
|
|
557
|
+
member_affiliate_percentage: The percentage of the revenue that goes to the member affiliate program.
|
|
558
|
+
|
|
559
|
+
member_affiliate_status: The different statuses of the global affiliate program for an access pass.
|
|
560
|
+
|
|
561
|
+
plan_options: The details to assign an autogenerated plan.
|
|
562
|
+
|
|
563
|
+
product_highlights: The product highlights for the product.
|
|
564
|
+
|
|
565
|
+
product_tax_code_id: The ID of the product tax code to apply to this product.
|
|
566
|
+
|
|
567
|
+
redirect_purchase_url: The URL to redirect the customer to after a purchase.
|
|
568
|
+
|
|
569
|
+
route: The route of the product.
|
|
570
|
+
|
|
571
|
+
visibility: Visibility of a resource
|
|
572
|
+
|
|
573
|
+
extra_headers: Send extra headers
|
|
574
|
+
|
|
575
|
+
extra_query: Add additional query parameters to the request
|
|
576
|
+
|
|
577
|
+
extra_body: Add additional JSON properties to the request
|
|
578
|
+
|
|
579
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
580
|
+
"""
|
|
581
|
+
return await self._post(
|
|
582
|
+
"/products",
|
|
583
|
+
body=await async_maybe_transform(
|
|
584
|
+
{
|
|
585
|
+
"company_id": company_id,
|
|
586
|
+
"title": title,
|
|
587
|
+
"access_pass_type": access_pass_type,
|
|
588
|
+
"banner_image": banner_image,
|
|
589
|
+
"business_type": business_type,
|
|
590
|
+
"collect_shipping_address": collect_shipping_address,
|
|
591
|
+
"custom_cta": custom_cta,
|
|
592
|
+
"custom_cta_url": custom_cta_url,
|
|
593
|
+
"custom_statement_descriptor": custom_statement_descriptor,
|
|
594
|
+
"description": description,
|
|
595
|
+
"experience_ids": experience_ids,
|
|
596
|
+
"global_affiliate_percentage": global_affiliate_percentage,
|
|
597
|
+
"global_affiliate_status": global_affiliate_status,
|
|
598
|
+
"headline": headline,
|
|
599
|
+
"industry_type": industry_type,
|
|
600
|
+
"member_affiliate_percentage": member_affiliate_percentage,
|
|
601
|
+
"member_affiliate_status": member_affiliate_status,
|
|
602
|
+
"plan_options": plan_options,
|
|
603
|
+
"product_highlights": product_highlights,
|
|
604
|
+
"product_tax_code_id": product_tax_code_id,
|
|
605
|
+
"redirect_purchase_url": redirect_purchase_url,
|
|
606
|
+
"route": route,
|
|
607
|
+
"visibility": visibility,
|
|
608
|
+
},
|
|
609
|
+
product_create_params.ProductCreateParams,
|
|
610
|
+
),
|
|
611
|
+
options=make_request_options(
|
|
612
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
613
|
+
),
|
|
614
|
+
cast_to=Product,
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
async def retrieve(
|
|
618
|
+
self,
|
|
619
|
+
id: str,
|
|
620
|
+
*,
|
|
621
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
622
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
623
|
+
extra_headers: Headers | None = None,
|
|
624
|
+
extra_query: Query | None = None,
|
|
625
|
+
extra_body: Body | None = None,
|
|
626
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
627
|
+
) -> Product:
|
|
628
|
+
"""
|
|
629
|
+
Retrieves a product by ID or route
|
|
630
|
+
|
|
631
|
+
Required permissions:
|
|
632
|
+
|
|
633
|
+
- `access_pass:basic:read`
|
|
634
|
+
|
|
635
|
+
Args:
|
|
636
|
+
extra_headers: Send extra headers
|
|
637
|
+
|
|
638
|
+
extra_query: Add additional query parameters to the request
|
|
639
|
+
|
|
640
|
+
extra_body: Add additional JSON properties to the request
|
|
641
|
+
|
|
642
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
643
|
+
"""
|
|
644
|
+
if not id:
|
|
645
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
646
|
+
return await self._get(
|
|
647
|
+
f"/products/{id}",
|
|
648
|
+
options=make_request_options(
|
|
649
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
650
|
+
),
|
|
651
|
+
cast_to=Product,
|
|
652
|
+
)
|
|
653
|
+
|
|
654
|
+
async def update(
|
|
655
|
+
self,
|
|
656
|
+
id: str,
|
|
657
|
+
*,
|
|
658
|
+
banner_image: Optional[product_update_params.BannerImage] | Omit = omit,
|
|
659
|
+
business_type: Optional[BusinessTypes] | Omit = omit,
|
|
660
|
+
collect_shipping_address: Optional[bool] | Omit = omit,
|
|
661
|
+
custom_cta: Optional[CustomCta] | Omit = omit,
|
|
662
|
+
custom_cta_url: Optional[str] | Omit = omit,
|
|
663
|
+
custom_statement_descriptor: Optional[str] | Omit = omit,
|
|
664
|
+
description: Optional[str] | Omit = omit,
|
|
665
|
+
global_affiliate_percentage: Optional[float] | Omit = omit,
|
|
666
|
+
global_affiliate_status: Optional[GlobalAffiliateStatus] | Omit = omit,
|
|
667
|
+
headline: Optional[str] | Omit = omit,
|
|
668
|
+
industry_type: Optional[IndustryTypes] | Omit = omit,
|
|
669
|
+
member_affiliate_percentage: Optional[float] | Omit = omit,
|
|
670
|
+
member_affiliate_status: Optional[GlobalAffiliateStatus] | Omit = omit,
|
|
671
|
+
product_tax_code_id: Optional[str] | Omit = omit,
|
|
672
|
+
redirect_purchase_url: Optional[str] | Omit = omit,
|
|
673
|
+
route: Optional[str] | Omit = omit,
|
|
674
|
+
title: Optional[str] | Omit = omit,
|
|
675
|
+
visibility: Optional[Visibility] | Omit = omit,
|
|
676
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
677
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
678
|
+
extra_headers: Headers | None = None,
|
|
679
|
+
extra_query: Query | None = None,
|
|
680
|
+
extra_body: Body | None = None,
|
|
681
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
682
|
+
) -> Product:
|
|
683
|
+
"""
|
|
684
|
+
Updates an existing Product
|
|
685
|
+
|
|
686
|
+
Required permissions:
|
|
687
|
+
|
|
688
|
+
- `access_pass:update`
|
|
689
|
+
- `access_pass:basic:read`
|
|
690
|
+
|
|
691
|
+
Args:
|
|
692
|
+
banner_image: A banner image for the product in png, jpeg format
|
|
693
|
+
|
|
694
|
+
business_type: The different business types a company can be.
|
|
695
|
+
|
|
696
|
+
collect_shipping_address: Whether or not to collect shipping information at checkout from the customer.
|
|
697
|
+
|
|
698
|
+
custom_cta: The different types of custom CTAs that can be selected.
|
|
699
|
+
|
|
700
|
+
custom_cta_url: The custom call to action URL for the product.
|
|
701
|
+
|
|
702
|
+
custom_statement_descriptor: The custom statement descriptor for the product i.e. WHOP\\**SPORTS, must be
|
|
703
|
+
between 5 and 22 characters, contain at least one letter, and not contain any of
|
|
704
|
+
the following characters: <, >, \\,, ', "
|
|
705
|
+
|
|
706
|
+
description: A written description of the product.
|
|
707
|
+
|
|
708
|
+
global_affiliate_percentage: The percentage of the revenue that goes to the global affiliate program.
|
|
709
|
+
|
|
710
|
+
global_affiliate_status: The different statuses of the global affiliate program for an access pass.
|
|
711
|
+
|
|
712
|
+
headline: The headline of the product.
|
|
713
|
+
|
|
714
|
+
industry_type: The different industry types a company can be in.
|
|
715
|
+
|
|
716
|
+
member_affiliate_percentage: The percentage of the revenue that goes to the member affiliate program.
|
|
717
|
+
|
|
718
|
+
member_affiliate_status: The different statuses of the global affiliate program for an access pass.
|
|
719
|
+
|
|
720
|
+
product_tax_code_id: The ID of the product tax code to apply to this product.
|
|
721
|
+
|
|
722
|
+
redirect_purchase_url: The URL to redirect the customer to after a purchase.
|
|
723
|
+
|
|
724
|
+
route: The route of the product.
|
|
725
|
+
|
|
726
|
+
title: The title of the product.
|
|
727
|
+
|
|
728
|
+
visibility: Visibility of a resource
|
|
729
|
+
|
|
730
|
+
extra_headers: Send extra headers
|
|
731
|
+
|
|
732
|
+
extra_query: Add additional query parameters to the request
|
|
733
|
+
|
|
734
|
+
extra_body: Add additional JSON properties to the request
|
|
735
|
+
|
|
736
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
737
|
+
"""
|
|
738
|
+
if not id:
|
|
739
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
740
|
+
return await self._patch(
|
|
741
|
+
f"/products/{id}",
|
|
742
|
+
body=await async_maybe_transform(
|
|
743
|
+
{
|
|
744
|
+
"banner_image": banner_image,
|
|
745
|
+
"business_type": business_type,
|
|
746
|
+
"collect_shipping_address": collect_shipping_address,
|
|
747
|
+
"custom_cta": custom_cta,
|
|
748
|
+
"custom_cta_url": custom_cta_url,
|
|
749
|
+
"custom_statement_descriptor": custom_statement_descriptor,
|
|
750
|
+
"description": description,
|
|
751
|
+
"global_affiliate_percentage": global_affiliate_percentage,
|
|
752
|
+
"global_affiliate_status": global_affiliate_status,
|
|
753
|
+
"headline": headline,
|
|
754
|
+
"industry_type": industry_type,
|
|
755
|
+
"member_affiliate_percentage": member_affiliate_percentage,
|
|
756
|
+
"member_affiliate_status": member_affiliate_status,
|
|
757
|
+
"product_tax_code_id": product_tax_code_id,
|
|
758
|
+
"redirect_purchase_url": redirect_purchase_url,
|
|
759
|
+
"route": route,
|
|
760
|
+
"title": title,
|
|
761
|
+
"visibility": visibility,
|
|
762
|
+
},
|
|
763
|
+
product_update_params.ProductUpdateParams,
|
|
764
|
+
),
|
|
765
|
+
options=make_request_options(
|
|
766
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
767
|
+
),
|
|
768
|
+
cast_to=Product,
|
|
769
|
+
)
|
|
770
|
+
|
|
771
|
+
def list(
|
|
772
|
+
self,
|
|
773
|
+
*,
|
|
774
|
+
company_id: str,
|
|
775
|
+
after: Optional[str] | Omit = omit,
|
|
776
|
+
before: Optional[str] | Omit = omit,
|
|
777
|
+
direction: Optional[Direction] | Omit = omit,
|
|
778
|
+
first: Optional[int] | Omit = omit,
|
|
779
|
+
last: Optional[int] | Omit = omit,
|
|
780
|
+
order: Optional[Literal["active_memberships_count", "created_at", "usd_gmv", "usd_gmv_30_days"]] | Omit = omit,
|
|
781
|
+
product_types: Optional[List[AccessPassType]] | Omit = omit,
|
|
782
|
+
visibilities: Optional[List[VisibilityFilter]] | Omit = omit,
|
|
783
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
784
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
785
|
+
extra_headers: Headers | None = None,
|
|
786
|
+
extra_query: Query | None = None,
|
|
787
|
+
extra_body: Body | None = None,
|
|
788
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
789
|
+
) -> AsyncPaginator[ProductListItem, AsyncCursorPage[ProductListItem]]:
|
|
790
|
+
"""
|
|
791
|
+
Lists products for a company
|
|
792
|
+
|
|
793
|
+
Required permissions:
|
|
794
|
+
|
|
795
|
+
- `access_pass:basic:read`
|
|
796
|
+
|
|
797
|
+
Args:
|
|
798
|
+
company_id: The ID of the company to filter products by
|
|
799
|
+
|
|
800
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
801
|
+
|
|
802
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
803
|
+
|
|
804
|
+
direction: The direction of the sort.
|
|
805
|
+
|
|
806
|
+
first: Returns the first _n_ elements from the list.
|
|
807
|
+
|
|
808
|
+
last: Returns the last _n_ elements from the list.
|
|
809
|
+
|
|
810
|
+
order: The ways a relation of AccessPasses can be ordered
|
|
811
|
+
|
|
812
|
+
product_types: The type of products to filter by
|
|
813
|
+
|
|
814
|
+
visibilities: The visibility of the products to filter by
|
|
815
|
+
|
|
816
|
+
extra_headers: Send extra headers
|
|
817
|
+
|
|
818
|
+
extra_query: Add additional query parameters to the request
|
|
819
|
+
|
|
820
|
+
extra_body: Add additional JSON properties to the request
|
|
821
|
+
|
|
822
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
823
|
+
"""
|
|
824
|
+
return self._get_api_list(
|
|
825
|
+
"/products",
|
|
826
|
+
page=AsyncCursorPage[ProductListItem],
|
|
827
|
+
options=make_request_options(
|
|
828
|
+
extra_headers=extra_headers,
|
|
829
|
+
extra_query=extra_query,
|
|
830
|
+
extra_body=extra_body,
|
|
831
|
+
timeout=timeout,
|
|
832
|
+
query=maybe_transform(
|
|
833
|
+
{
|
|
834
|
+
"company_id": company_id,
|
|
835
|
+
"after": after,
|
|
836
|
+
"before": before,
|
|
837
|
+
"direction": direction,
|
|
838
|
+
"first": first,
|
|
839
|
+
"last": last,
|
|
840
|
+
"order": order,
|
|
841
|
+
"product_types": product_types,
|
|
842
|
+
"visibilities": visibilities,
|
|
843
|
+
},
|
|
844
|
+
product_list_params.ProductListParams,
|
|
845
|
+
),
|
|
846
|
+
),
|
|
847
|
+
model=ProductListItem,
|
|
848
|
+
)
|
|
849
|
+
|
|
850
|
+
async def delete(
|
|
851
|
+
self,
|
|
852
|
+
id: str,
|
|
853
|
+
*,
|
|
854
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
855
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
856
|
+
extra_headers: Headers | None = None,
|
|
857
|
+
extra_query: Query | None = None,
|
|
858
|
+
extra_body: Body | None = None,
|
|
859
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
860
|
+
) -> ProductDeleteResponse:
|
|
861
|
+
"""
|
|
862
|
+
Deletes an existing Product
|
|
863
|
+
|
|
864
|
+
Required permissions:
|
|
865
|
+
|
|
866
|
+
- `access_pass:delete`
|
|
867
|
+
|
|
868
|
+
Args:
|
|
869
|
+
extra_headers: Send extra headers
|
|
870
|
+
|
|
871
|
+
extra_query: Add additional query parameters to the request
|
|
872
|
+
|
|
873
|
+
extra_body: Add additional JSON properties to the request
|
|
874
|
+
|
|
875
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
876
|
+
"""
|
|
877
|
+
if not id:
|
|
878
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
879
|
+
return await self._delete(
|
|
880
|
+
f"/products/{id}",
|
|
881
|
+
options=make_request_options(
|
|
882
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
883
|
+
),
|
|
884
|
+
cast_to=ProductDeleteResponse,
|
|
885
|
+
)
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
class ProductsResourceWithRawResponse:
|
|
889
|
+
def __init__(self, products: ProductsResource) -> None:
|
|
890
|
+
self._products = products
|
|
891
|
+
|
|
892
|
+
self.create = to_raw_response_wrapper(
|
|
893
|
+
products.create,
|
|
894
|
+
)
|
|
895
|
+
self.retrieve = to_raw_response_wrapper(
|
|
896
|
+
products.retrieve,
|
|
897
|
+
)
|
|
898
|
+
self.update = to_raw_response_wrapper(
|
|
899
|
+
products.update,
|
|
900
|
+
)
|
|
901
|
+
self.list = to_raw_response_wrapper(
|
|
902
|
+
products.list,
|
|
903
|
+
)
|
|
904
|
+
self.delete = to_raw_response_wrapper(
|
|
905
|
+
products.delete,
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
class AsyncProductsResourceWithRawResponse:
|
|
910
|
+
def __init__(self, products: AsyncProductsResource) -> None:
|
|
911
|
+
self._products = products
|
|
912
|
+
|
|
913
|
+
self.create = async_to_raw_response_wrapper(
|
|
914
|
+
products.create,
|
|
915
|
+
)
|
|
916
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
917
|
+
products.retrieve,
|
|
918
|
+
)
|
|
919
|
+
self.update = async_to_raw_response_wrapper(
|
|
920
|
+
products.update,
|
|
921
|
+
)
|
|
922
|
+
self.list = async_to_raw_response_wrapper(
|
|
923
|
+
products.list,
|
|
924
|
+
)
|
|
925
|
+
self.delete = async_to_raw_response_wrapper(
|
|
926
|
+
products.delete,
|
|
927
|
+
)
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
class ProductsResourceWithStreamingResponse:
|
|
931
|
+
def __init__(self, products: ProductsResource) -> None:
|
|
932
|
+
self._products = products
|
|
933
|
+
|
|
934
|
+
self.create = to_streamed_response_wrapper(
|
|
935
|
+
products.create,
|
|
936
|
+
)
|
|
937
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
938
|
+
products.retrieve,
|
|
939
|
+
)
|
|
940
|
+
self.update = to_streamed_response_wrapper(
|
|
941
|
+
products.update,
|
|
942
|
+
)
|
|
943
|
+
self.list = to_streamed_response_wrapper(
|
|
944
|
+
products.list,
|
|
945
|
+
)
|
|
946
|
+
self.delete = to_streamed_response_wrapper(
|
|
947
|
+
products.delete,
|
|
948
|
+
)
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
class AsyncProductsResourceWithStreamingResponse:
|
|
952
|
+
def __init__(self, products: AsyncProductsResource) -> None:
|
|
953
|
+
self._products = products
|
|
954
|
+
|
|
955
|
+
self.create = async_to_streamed_response_wrapper(
|
|
956
|
+
products.create,
|
|
957
|
+
)
|
|
958
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
959
|
+
products.retrieve,
|
|
960
|
+
)
|
|
961
|
+
self.update = async_to_streamed_response_wrapper(
|
|
962
|
+
products.update,
|
|
963
|
+
)
|
|
964
|
+
self.list = async_to_streamed_response_wrapper(
|
|
965
|
+
products.list,
|
|
966
|
+
)
|
|
967
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
968
|
+
products.delete,
|
|
969
|
+
)
|