whop-sdk 0.0.1__py3-none-any.whl → 0.0.2__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/_client.py +18 -0
- whop_sdk/_version.py +1 -1
- whop_sdk/resources/__init__.py +28 -0
- whop_sdk/resources/checkout_configurations.py +12 -12
- whop_sdk/resources/forums.py +446 -0
- whop_sdk/resources/members.py +421 -0
- whop_sdk/resources/plans.py +10 -4
- whop_sdk/types/__init__.py +25 -0
- whop_sdk/types/app_list_response.py +16 -1
- whop_sdk/types/checkout_configuration_create_params.py +5 -5
- whop_sdk/types/checkout_configuration_list_response.py +9 -9
- whop_sdk/types/course_lesson_interaction_completed_webhook_event.py +26 -0
- whop_sdk/types/entry_approved_webhook_event.py +26 -0
- whop_sdk/types/entry_created_webhook_event.py +26 -0
- whop_sdk/types/entry_deleted_webhook_event.py +26 -0
- whop_sdk/types/entry_denied_webhook_event.py +26 -0
- whop_sdk/types/experience_list_response.py +27 -1
- whop_sdk/types/forum_list_params.py +28 -0
- whop_sdk/types/forum_list_response.py +33 -0
- whop_sdk/types/forum_update_params.py +23 -0
- whop_sdk/types/invoice_create_params.py +10 -2
- whop_sdk/types/member_list_params.py +70 -0
- whop_sdk/types/member_list_response.py +65 -0
- whop_sdk/types/member_retrieve_response.py +79 -0
- whop_sdk/types/membership_activated_webhook_event.py +29 -0
- whop_sdk/types/membership_deactivated_webhook_event.py +29 -0
- whop_sdk/types/payment_failed_webhook_event.py +26 -0
- whop_sdk/types/payment_pending_webhook_event.py +26 -0
- whop_sdk/types/payment_succeeded_webhook_event.py +26 -0
- whop_sdk/types/plan_create_params.py +10 -2
- whop_sdk/types/shared/__init__.py +7 -0
- whop_sdk/types/shared/access_level.py +7 -0
- whop_sdk/types/shared/app.py +25 -1
- whop_sdk/types/shared/checkout_configuration.py +9 -9
- whop_sdk/types/shared/company.py +15 -1
- whop_sdk/types/shared/course_lesson_interaction.py +20 -1
- whop_sdk/types/shared/email_notification_preferences.py +7 -0
- whop_sdk/types/shared/experience.py +27 -1
- whop_sdk/types/shared/forum.py +33 -0
- whop_sdk/types/shared/member_most_recent_actions.py +22 -0
- whop_sdk/types/shared/member_statuses.py +7 -0
- whop_sdk/types/shared/who_can_comment_types.py +7 -0
- whop_sdk/types/shared/who_can_post_types.py +7 -0
- whop_sdk/types/shared_params/__init__.py +6 -0
- whop_sdk/types/shared_params/access_level.py +9 -0
- whop_sdk/types/shared_params/email_notification_preferences.py +9 -0
- whop_sdk/types/shared_params/member_most_recent_actions.py +24 -0
- whop_sdk/types/shared_params/member_statuses.py +9 -0
- whop_sdk/types/shared_params/who_can_comment_types.py +9 -0
- whop_sdk/types/shared_params/who_can_post_types.py +9 -0
- whop_sdk/types/unwrap_webhook_event.py +24 -1
- whop_sdk/types/user_check_access_response.py +2 -3
- whop_sdk/types/user_retrieve_response.py +12 -1
- {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.2.dist-info}/METADATA +2 -2
- {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.2.dist-info}/RECORD +57 -26
- {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.2.dist-info}/WHEEL +0 -0
- {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.2.dist-info}/licenses/LICENSE +0 -0
whop_sdk/_client.py
CHANGED
|
@@ -25,7 +25,9 @@ from .resources import (
|
|
|
25
25
|
apps,
|
|
26
26
|
plans,
|
|
27
27
|
users,
|
|
28
|
+
forums,
|
|
28
29
|
entries,
|
|
30
|
+
members,
|
|
29
31
|
invoices,
|
|
30
32
|
messages,
|
|
31
33
|
payments,
|
|
@@ -81,6 +83,8 @@ class Whop(SyncAPIClient):
|
|
|
81
83
|
support_channels: support_channels.SupportChannelsResource
|
|
82
84
|
experiences: experiences.ExperiencesResource
|
|
83
85
|
reactions: reactions.ReactionsResource
|
|
86
|
+
members: members.MembersResource
|
|
87
|
+
forums: forums.ForumsResource
|
|
84
88
|
with_raw_response: WhopWithRawResponse
|
|
85
89
|
with_streaming_response: WhopWithStreamedResponse
|
|
86
90
|
|
|
@@ -180,6 +184,8 @@ class Whop(SyncAPIClient):
|
|
|
180
184
|
self.support_channels = support_channels.SupportChannelsResource(self)
|
|
181
185
|
self.experiences = experiences.ExperiencesResource(self)
|
|
182
186
|
self.reactions = reactions.ReactionsResource(self)
|
|
187
|
+
self.members = members.MembersResource(self)
|
|
188
|
+
self.forums = forums.ForumsResource(self)
|
|
183
189
|
self.with_raw_response = WhopWithRawResponse(self)
|
|
184
190
|
self.with_streaming_response = WhopWithStreamedResponse(self)
|
|
185
191
|
|
|
@@ -317,6 +323,8 @@ class AsyncWhop(AsyncAPIClient):
|
|
|
317
323
|
support_channels: support_channels.AsyncSupportChannelsResource
|
|
318
324
|
experiences: experiences.AsyncExperiencesResource
|
|
319
325
|
reactions: reactions.AsyncReactionsResource
|
|
326
|
+
members: members.AsyncMembersResource
|
|
327
|
+
forums: forums.AsyncForumsResource
|
|
320
328
|
with_raw_response: AsyncWhopWithRawResponse
|
|
321
329
|
with_streaming_response: AsyncWhopWithStreamedResponse
|
|
322
330
|
|
|
@@ -416,6 +424,8 @@ class AsyncWhop(AsyncAPIClient):
|
|
|
416
424
|
self.support_channels = support_channels.AsyncSupportChannelsResource(self)
|
|
417
425
|
self.experiences = experiences.AsyncExperiencesResource(self)
|
|
418
426
|
self.reactions = reactions.AsyncReactionsResource(self)
|
|
427
|
+
self.members = members.AsyncMembersResource(self)
|
|
428
|
+
self.forums = forums.AsyncForumsResource(self)
|
|
419
429
|
self.with_raw_response = AsyncWhopWithRawResponse(self)
|
|
420
430
|
self.with_streaming_response = AsyncWhopWithStreamedResponse(self)
|
|
421
431
|
|
|
@@ -557,6 +567,8 @@ class WhopWithRawResponse:
|
|
|
557
567
|
self.support_channels = support_channels.SupportChannelsResourceWithRawResponse(client.support_channels)
|
|
558
568
|
self.experiences = experiences.ExperiencesResourceWithRawResponse(client.experiences)
|
|
559
569
|
self.reactions = reactions.ReactionsResourceWithRawResponse(client.reactions)
|
|
570
|
+
self.members = members.MembersResourceWithRawResponse(client.members)
|
|
571
|
+
self.forums = forums.ForumsResourceWithRawResponse(client.forums)
|
|
560
572
|
|
|
561
573
|
|
|
562
574
|
class AsyncWhopWithRawResponse:
|
|
@@ -589,6 +601,8 @@ class AsyncWhopWithRawResponse:
|
|
|
589
601
|
self.support_channels = support_channels.AsyncSupportChannelsResourceWithRawResponse(client.support_channels)
|
|
590
602
|
self.experiences = experiences.AsyncExperiencesResourceWithRawResponse(client.experiences)
|
|
591
603
|
self.reactions = reactions.AsyncReactionsResourceWithRawResponse(client.reactions)
|
|
604
|
+
self.members = members.AsyncMembersResourceWithRawResponse(client.members)
|
|
605
|
+
self.forums = forums.AsyncForumsResourceWithRawResponse(client.forums)
|
|
592
606
|
|
|
593
607
|
|
|
594
608
|
class WhopWithStreamedResponse:
|
|
@@ -621,6 +635,8 @@ class WhopWithStreamedResponse:
|
|
|
621
635
|
self.support_channels = support_channels.SupportChannelsResourceWithStreamingResponse(client.support_channels)
|
|
622
636
|
self.experiences = experiences.ExperiencesResourceWithStreamingResponse(client.experiences)
|
|
623
637
|
self.reactions = reactions.ReactionsResourceWithStreamingResponse(client.reactions)
|
|
638
|
+
self.members = members.MembersResourceWithStreamingResponse(client.members)
|
|
639
|
+
self.forums = forums.ForumsResourceWithStreamingResponse(client.forums)
|
|
624
640
|
|
|
625
641
|
|
|
626
642
|
class AsyncWhopWithStreamedResponse:
|
|
@@ -657,6 +673,8 @@ class AsyncWhopWithStreamedResponse:
|
|
|
657
673
|
)
|
|
658
674
|
self.experiences = experiences.AsyncExperiencesResourceWithStreamingResponse(client.experiences)
|
|
659
675
|
self.reactions = reactions.AsyncReactionsResourceWithStreamingResponse(client.reactions)
|
|
676
|
+
self.members = members.AsyncMembersResourceWithStreamingResponse(client.members)
|
|
677
|
+
self.forums = forums.AsyncForumsResourceWithStreamingResponse(client.forums)
|
|
660
678
|
|
|
661
679
|
|
|
662
680
|
Client = Whop
|
whop_sdk/_version.py
CHANGED
whop_sdk/resources/__init__.py
CHANGED
|
@@ -24,6 +24,14 @@ from .users import (
|
|
|
24
24
|
UsersResourceWithStreamingResponse,
|
|
25
25
|
AsyncUsersResourceWithStreamingResponse,
|
|
26
26
|
)
|
|
27
|
+
from .forums import (
|
|
28
|
+
ForumsResource,
|
|
29
|
+
AsyncForumsResource,
|
|
30
|
+
ForumsResourceWithRawResponse,
|
|
31
|
+
AsyncForumsResourceWithRawResponse,
|
|
32
|
+
ForumsResourceWithStreamingResponse,
|
|
33
|
+
AsyncForumsResourceWithStreamingResponse,
|
|
34
|
+
)
|
|
27
35
|
from .entries import (
|
|
28
36
|
EntriesResource,
|
|
29
37
|
AsyncEntriesResource,
|
|
@@ -32,6 +40,14 @@ from .entries import (
|
|
|
32
40
|
EntriesResourceWithStreamingResponse,
|
|
33
41
|
AsyncEntriesResourceWithStreamingResponse,
|
|
34
42
|
)
|
|
43
|
+
from .members import (
|
|
44
|
+
MembersResource,
|
|
45
|
+
AsyncMembersResource,
|
|
46
|
+
MembersResourceWithRawResponse,
|
|
47
|
+
AsyncMembersResourceWithRawResponse,
|
|
48
|
+
MembersResourceWithStreamingResponse,
|
|
49
|
+
AsyncMembersResourceWithStreamingResponse,
|
|
50
|
+
)
|
|
35
51
|
from .invoices import (
|
|
36
52
|
InvoicesResource,
|
|
37
53
|
AsyncInvoicesResource,
|
|
@@ -313,4 +329,16 @@ __all__ = [
|
|
|
313
329
|
"AsyncReactionsResourceWithRawResponse",
|
|
314
330
|
"ReactionsResourceWithStreamingResponse",
|
|
315
331
|
"AsyncReactionsResourceWithStreamingResponse",
|
|
332
|
+
"MembersResource",
|
|
333
|
+
"AsyncMembersResource",
|
|
334
|
+
"MembersResourceWithRawResponse",
|
|
335
|
+
"AsyncMembersResourceWithRawResponse",
|
|
336
|
+
"MembersResourceWithStreamingResponse",
|
|
337
|
+
"AsyncMembersResourceWithStreamingResponse",
|
|
338
|
+
"ForumsResource",
|
|
339
|
+
"AsyncForumsResource",
|
|
340
|
+
"ForumsResourceWithRawResponse",
|
|
341
|
+
"AsyncForumsResourceWithRawResponse",
|
|
342
|
+
"ForumsResourceWithStreamingResponse",
|
|
343
|
+
"AsyncForumsResourceWithStreamingResponse",
|
|
316
344
|
]
|
|
@@ -62,7 +62,7 @@ class CheckoutConfigurationsResource(SyncAPIResource):
|
|
|
62
62
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
63
63
|
) -> CheckoutConfiguration:
|
|
64
64
|
"""
|
|
65
|
-
Creates a new checkout
|
|
65
|
+
Creates a new checkout configuration
|
|
66
66
|
|
|
67
67
|
Required permissions:
|
|
68
68
|
|
|
@@ -70,15 +70,15 @@ class CheckoutConfigurationsResource(SyncAPIResource):
|
|
|
70
70
|
- `plan:create`
|
|
71
71
|
|
|
72
72
|
Args:
|
|
73
|
-
affiliate_code: The affiliate code to use for the checkout
|
|
73
|
+
affiliate_code: The affiliate code to use for the checkout configuration
|
|
74
74
|
|
|
75
|
-
metadata: The metadata to use for the checkout
|
|
75
|
+
metadata: The metadata to use for the checkout configuration
|
|
76
76
|
|
|
77
|
-
plan: Pass this object to create a new plan for this checkout
|
|
77
|
+
plan: Pass this object to create a new plan for this checkout configuration
|
|
78
78
|
|
|
79
|
-
plan_id: The ID of the plan to use for the checkout
|
|
79
|
+
plan_id: The ID of the plan to use for the checkout configuration
|
|
80
80
|
|
|
81
|
-
redirect_url: The URL to redirect the user to after the checkout
|
|
81
|
+
redirect_url: The URL to redirect the user to after the checkout configuration is created
|
|
82
82
|
|
|
83
83
|
extra_headers: Send extra headers
|
|
84
84
|
|
|
@@ -251,7 +251,7 @@ class AsyncCheckoutConfigurationsResource(AsyncAPIResource):
|
|
|
251
251
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
252
252
|
) -> CheckoutConfiguration:
|
|
253
253
|
"""
|
|
254
|
-
Creates a new checkout
|
|
254
|
+
Creates a new checkout configuration
|
|
255
255
|
|
|
256
256
|
Required permissions:
|
|
257
257
|
|
|
@@ -259,15 +259,15 @@ class AsyncCheckoutConfigurationsResource(AsyncAPIResource):
|
|
|
259
259
|
- `plan:create`
|
|
260
260
|
|
|
261
261
|
Args:
|
|
262
|
-
affiliate_code: The affiliate code to use for the checkout
|
|
262
|
+
affiliate_code: The affiliate code to use for the checkout configuration
|
|
263
263
|
|
|
264
|
-
metadata: The metadata to use for the checkout
|
|
264
|
+
metadata: The metadata to use for the checkout configuration
|
|
265
265
|
|
|
266
|
-
plan: Pass this object to create a new plan for this checkout
|
|
266
|
+
plan: Pass this object to create a new plan for this checkout configuration
|
|
267
267
|
|
|
268
|
-
plan_id: The ID of the plan to use for the checkout
|
|
268
|
+
plan_id: The ID of the plan to use for the checkout configuration
|
|
269
269
|
|
|
270
|
-
redirect_url: The URL to redirect the user to after the checkout
|
|
270
|
+
redirect_url: The URL to redirect the user to after the checkout configuration is created
|
|
271
271
|
|
|
272
272
|
extra_headers: Send extra headers
|
|
273
273
|
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..types import forum_list_params, forum_update_params
|
|
10
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
12
|
+
from .._compat import cached_property
|
|
13
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
14
|
+
from .._response import (
|
|
15
|
+
to_raw_response_wrapper,
|
|
16
|
+
to_streamed_response_wrapper,
|
|
17
|
+
async_to_raw_response_wrapper,
|
|
18
|
+
async_to_streamed_response_wrapper,
|
|
19
|
+
)
|
|
20
|
+
from ..pagination import SyncCursorPage, AsyncCursorPage
|
|
21
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
22
|
+
from ..types.shared.forum import Forum
|
|
23
|
+
from ..types.forum_list_response import ForumListResponse
|
|
24
|
+
from ..types.shared.who_can_post_types import WhoCanPostTypes
|
|
25
|
+
from ..types.shared.who_can_comment_types import WhoCanCommentTypes
|
|
26
|
+
from ..types.shared.email_notification_preferences import EmailNotificationPreferences
|
|
27
|
+
|
|
28
|
+
__all__ = ["ForumsResource", "AsyncForumsResource"]
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ForumsResource(SyncAPIResource):
|
|
32
|
+
@cached_property
|
|
33
|
+
def with_raw_response(self) -> ForumsResourceWithRawResponse:
|
|
34
|
+
"""
|
|
35
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
36
|
+
the raw response object instead of the parsed content.
|
|
37
|
+
|
|
38
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
39
|
+
"""
|
|
40
|
+
return ForumsResourceWithRawResponse(self)
|
|
41
|
+
|
|
42
|
+
@cached_property
|
|
43
|
+
def with_streaming_response(self) -> ForumsResourceWithStreamingResponse:
|
|
44
|
+
"""
|
|
45
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
46
|
+
|
|
47
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
48
|
+
"""
|
|
49
|
+
return ForumsResourceWithStreamingResponse(self)
|
|
50
|
+
|
|
51
|
+
def retrieve(
|
|
52
|
+
self,
|
|
53
|
+
id: str,
|
|
54
|
+
*,
|
|
55
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
56
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
57
|
+
extra_headers: Headers | None = None,
|
|
58
|
+
extra_query: Query | None = None,
|
|
59
|
+
extra_body: Body | None = None,
|
|
60
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
61
|
+
) -> Forum:
|
|
62
|
+
"""
|
|
63
|
+
Retrieves a forum
|
|
64
|
+
|
|
65
|
+
Required permissions:
|
|
66
|
+
|
|
67
|
+
- `forum:read`
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
extra_headers: Send extra headers
|
|
71
|
+
|
|
72
|
+
extra_query: Add additional query parameters to the request
|
|
73
|
+
|
|
74
|
+
extra_body: Add additional JSON properties to the request
|
|
75
|
+
|
|
76
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
77
|
+
"""
|
|
78
|
+
if not id:
|
|
79
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
80
|
+
return self._get(
|
|
81
|
+
f"/forums/{id}",
|
|
82
|
+
options=make_request_options(
|
|
83
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
84
|
+
),
|
|
85
|
+
cast_to=Forum,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
def update(
|
|
89
|
+
self,
|
|
90
|
+
id: str,
|
|
91
|
+
*,
|
|
92
|
+
email_notification_preference: Optional[EmailNotificationPreferences] | Omit = omit,
|
|
93
|
+
who_can_comment: Optional[WhoCanCommentTypes] | Omit = omit,
|
|
94
|
+
who_can_post: Optional[WhoCanPostTypes] | Omit = omit,
|
|
95
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
96
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
97
|
+
extra_headers: Headers | None = None,
|
|
98
|
+
extra_query: Query | None = None,
|
|
99
|
+
extra_body: Body | None = None,
|
|
100
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
101
|
+
) -> Forum:
|
|
102
|
+
"""
|
|
103
|
+
Updates a forum
|
|
104
|
+
|
|
105
|
+
Required permissions:
|
|
106
|
+
|
|
107
|
+
- `forum:moderate`
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
email_notification_preference: Email notification preference option for a forum feed
|
|
111
|
+
|
|
112
|
+
who_can_comment: Who can comment on a forum feed
|
|
113
|
+
|
|
114
|
+
who_can_post: Who can post on a forum feed
|
|
115
|
+
|
|
116
|
+
extra_headers: Send extra headers
|
|
117
|
+
|
|
118
|
+
extra_query: Add additional query parameters to the request
|
|
119
|
+
|
|
120
|
+
extra_body: Add additional JSON properties to the request
|
|
121
|
+
|
|
122
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
123
|
+
"""
|
|
124
|
+
if not id:
|
|
125
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
126
|
+
return self._patch(
|
|
127
|
+
f"/forums/{id}",
|
|
128
|
+
body=maybe_transform(
|
|
129
|
+
{
|
|
130
|
+
"email_notification_preference": email_notification_preference,
|
|
131
|
+
"who_can_comment": who_can_comment,
|
|
132
|
+
"who_can_post": who_can_post,
|
|
133
|
+
},
|
|
134
|
+
forum_update_params.ForumUpdateParams,
|
|
135
|
+
),
|
|
136
|
+
options=make_request_options(
|
|
137
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
138
|
+
),
|
|
139
|
+
cast_to=Forum,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
def list(
|
|
143
|
+
self,
|
|
144
|
+
*,
|
|
145
|
+
company_id: str,
|
|
146
|
+
after: Optional[str] | Omit = omit,
|
|
147
|
+
before: Optional[str] | Omit = omit,
|
|
148
|
+
first: Optional[int] | Omit = omit,
|
|
149
|
+
last: Optional[int] | Omit = omit,
|
|
150
|
+
product_id: Optional[str] | Omit = omit,
|
|
151
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
152
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
153
|
+
extra_headers: Headers | None = None,
|
|
154
|
+
extra_query: Query | None = None,
|
|
155
|
+
extra_body: Body | None = None,
|
|
156
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
157
|
+
) -> SyncCursorPage[ForumListResponse]:
|
|
158
|
+
"""
|
|
159
|
+
Lists forums inside a company
|
|
160
|
+
|
|
161
|
+
Required permissions:
|
|
162
|
+
|
|
163
|
+
- `forum:read`
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
company_id: The ID of the company to list forums for
|
|
167
|
+
|
|
168
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
169
|
+
|
|
170
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
171
|
+
|
|
172
|
+
first: Returns the first _n_ elements from the list.
|
|
173
|
+
|
|
174
|
+
last: Returns the last _n_ elements from the list.
|
|
175
|
+
|
|
176
|
+
product_id: If provided, only forums connected to this product are returned
|
|
177
|
+
|
|
178
|
+
extra_headers: Send extra headers
|
|
179
|
+
|
|
180
|
+
extra_query: Add additional query parameters to the request
|
|
181
|
+
|
|
182
|
+
extra_body: Add additional JSON properties to the request
|
|
183
|
+
|
|
184
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
185
|
+
"""
|
|
186
|
+
return self._get_api_list(
|
|
187
|
+
"/forums",
|
|
188
|
+
page=SyncCursorPage[ForumListResponse],
|
|
189
|
+
options=make_request_options(
|
|
190
|
+
extra_headers=extra_headers,
|
|
191
|
+
extra_query=extra_query,
|
|
192
|
+
extra_body=extra_body,
|
|
193
|
+
timeout=timeout,
|
|
194
|
+
query=maybe_transform(
|
|
195
|
+
{
|
|
196
|
+
"company_id": company_id,
|
|
197
|
+
"after": after,
|
|
198
|
+
"before": before,
|
|
199
|
+
"first": first,
|
|
200
|
+
"last": last,
|
|
201
|
+
"product_id": product_id,
|
|
202
|
+
},
|
|
203
|
+
forum_list_params.ForumListParams,
|
|
204
|
+
),
|
|
205
|
+
),
|
|
206
|
+
model=ForumListResponse,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class AsyncForumsResource(AsyncAPIResource):
|
|
211
|
+
@cached_property
|
|
212
|
+
def with_raw_response(self) -> AsyncForumsResourceWithRawResponse:
|
|
213
|
+
"""
|
|
214
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
215
|
+
the raw response object instead of the parsed content.
|
|
216
|
+
|
|
217
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
218
|
+
"""
|
|
219
|
+
return AsyncForumsResourceWithRawResponse(self)
|
|
220
|
+
|
|
221
|
+
@cached_property
|
|
222
|
+
def with_streaming_response(self) -> AsyncForumsResourceWithStreamingResponse:
|
|
223
|
+
"""
|
|
224
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
225
|
+
|
|
226
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
227
|
+
"""
|
|
228
|
+
return AsyncForumsResourceWithStreamingResponse(self)
|
|
229
|
+
|
|
230
|
+
async def retrieve(
|
|
231
|
+
self,
|
|
232
|
+
id: str,
|
|
233
|
+
*,
|
|
234
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
235
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
236
|
+
extra_headers: Headers | None = None,
|
|
237
|
+
extra_query: Query | None = None,
|
|
238
|
+
extra_body: Body | None = None,
|
|
239
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
240
|
+
) -> Forum:
|
|
241
|
+
"""
|
|
242
|
+
Retrieves a forum
|
|
243
|
+
|
|
244
|
+
Required permissions:
|
|
245
|
+
|
|
246
|
+
- `forum:read`
|
|
247
|
+
|
|
248
|
+
Args:
|
|
249
|
+
extra_headers: Send extra headers
|
|
250
|
+
|
|
251
|
+
extra_query: Add additional query parameters to the request
|
|
252
|
+
|
|
253
|
+
extra_body: Add additional JSON properties to the request
|
|
254
|
+
|
|
255
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
256
|
+
"""
|
|
257
|
+
if not id:
|
|
258
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
259
|
+
return await self._get(
|
|
260
|
+
f"/forums/{id}",
|
|
261
|
+
options=make_request_options(
|
|
262
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
263
|
+
),
|
|
264
|
+
cast_to=Forum,
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
async def update(
|
|
268
|
+
self,
|
|
269
|
+
id: str,
|
|
270
|
+
*,
|
|
271
|
+
email_notification_preference: Optional[EmailNotificationPreferences] | Omit = omit,
|
|
272
|
+
who_can_comment: Optional[WhoCanCommentTypes] | Omit = omit,
|
|
273
|
+
who_can_post: Optional[WhoCanPostTypes] | Omit = omit,
|
|
274
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
275
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
276
|
+
extra_headers: Headers | None = None,
|
|
277
|
+
extra_query: Query | None = None,
|
|
278
|
+
extra_body: Body | None = None,
|
|
279
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
280
|
+
) -> Forum:
|
|
281
|
+
"""
|
|
282
|
+
Updates a forum
|
|
283
|
+
|
|
284
|
+
Required permissions:
|
|
285
|
+
|
|
286
|
+
- `forum:moderate`
|
|
287
|
+
|
|
288
|
+
Args:
|
|
289
|
+
email_notification_preference: Email notification preference option for a forum feed
|
|
290
|
+
|
|
291
|
+
who_can_comment: Who can comment on a forum feed
|
|
292
|
+
|
|
293
|
+
who_can_post: Who can post on a forum feed
|
|
294
|
+
|
|
295
|
+
extra_headers: Send extra headers
|
|
296
|
+
|
|
297
|
+
extra_query: Add additional query parameters to the request
|
|
298
|
+
|
|
299
|
+
extra_body: Add additional JSON properties to the request
|
|
300
|
+
|
|
301
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
302
|
+
"""
|
|
303
|
+
if not id:
|
|
304
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
305
|
+
return await self._patch(
|
|
306
|
+
f"/forums/{id}",
|
|
307
|
+
body=await async_maybe_transform(
|
|
308
|
+
{
|
|
309
|
+
"email_notification_preference": email_notification_preference,
|
|
310
|
+
"who_can_comment": who_can_comment,
|
|
311
|
+
"who_can_post": who_can_post,
|
|
312
|
+
},
|
|
313
|
+
forum_update_params.ForumUpdateParams,
|
|
314
|
+
),
|
|
315
|
+
options=make_request_options(
|
|
316
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
317
|
+
),
|
|
318
|
+
cast_to=Forum,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
def list(
|
|
322
|
+
self,
|
|
323
|
+
*,
|
|
324
|
+
company_id: str,
|
|
325
|
+
after: Optional[str] | Omit = omit,
|
|
326
|
+
before: Optional[str] | Omit = omit,
|
|
327
|
+
first: Optional[int] | Omit = omit,
|
|
328
|
+
last: Optional[int] | Omit = omit,
|
|
329
|
+
product_id: Optional[str] | Omit = omit,
|
|
330
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
331
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
332
|
+
extra_headers: Headers | None = None,
|
|
333
|
+
extra_query: Query | None = None,
|
|
334
|
+
extra_body: Body | None = None,
|
|
335
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
336
|
+
) -> AsyncPaginator[ForumListResponse, AsyncCursorPage[ForumListResponse]]:
|
|
337
|
+
"""
|
|
338
|
+
Lists forums inside a company
|
|
339
|
+
|
|
340
|
+
Required permissions:
|
|
341
|
+
|
|
342
|
+
- `forum:read`
|
|
343
|
+
|
|
344
|
+
Args:
|
|
345
|
+
company_id: The ID of the company to list forums for
|
|
346
|
+
|
|
347
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
348
|
+
|
|
349
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
350
|
+
|
|
351
|
+
first: Returns the first _n_ elements from the list.
|
|
352
|
+
|
|
353
|
+
last: Returns the last _n_ elements from the list.
|
|
354
|
+
|
|
355
|
+
product_id: If provided, only forums connected to this product are returned
|
|
356
|
+
|
|
357
|
+
extra_headers: Send extra headers
|
|
358
|
+
|
|
359
|
+
extra_query: Add additional query parameters to the request
|
|
360
|
+
|
|
361
|
+
extra_body: Add additional JSON properties to the request
|
|
362
|
+
|
|
363
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
364
|
+
"""
|
|
365
|
+
return self._get_api_list(
|
|
366
|
+
"/forums",
|
|
367
|
+
page=AsyncCursorPage[ForumListResponse],
|
|
368
|
+
options=make_request_options(
|
|
369
|
+
extra_headers=extra_headers,
|
|
370
|
+
extra_query=extra_query,
|
|
371
|
+
extra_body=extra_body,
|
|
372
|
+
timeout=timeout,
|
|
373
|
+
query=maybe_transform(
|
|
374
|
+
{
|
|
375
|
+
"company_id": company_id,
|
|
376
|
+
"after": after,
|
|
377
|
+
"before": before,
|
|
378
|
+
"first": first,
|
|
379
|
+
"last": last,
|
|
380
|
+
"product_id": product_id,
|
|
381
|
+
},
|
|
382
|
+
forum_list_params.ForumListParams,
|
|
383
|
+
),
|
|
384
|
+
),
|
|
385
|
+
model=ForumListResponse,
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
class ForumsResourceWithRawResponse:
|
|
390
|
+
def __init__(self, forums: ForumsResource) -> None:
|
|
391
|
+
self._forums = forums
|
|
392
|
+
|
|
393
|
+
self.retrieve = to_raw_response_wrapper(
|
|
394
|
+
forums.retrieve,
|
|
395
|
+
)
|
|
396
|
+
self.update = to_raw_response_wrapper(
|
|
397
|
+
forums.update,
|
|
398
|
+
)
|
|
399
|
+
self.list = to_raw_response_wrapper(
|
|
400
|
+
forums.list,
|
|
401
|
+
)
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
class AsyncForumsResourceWithRawResponse:
|
|
405
|
+
def __init__(self, forums: AsyncForumsResource) -> None:
|
|
406
|
+
self._forums = forums
|
|
407
|
+
|
|
408
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
409
|
+
forums.retrieve,
|
|
410
|
+
)
|
|
411
|
+
self.update = async_to_raw_response_wrapper(
|
|
412
|
+
forums.update,
|
|
413
|
+
)
|
|
414
|
+
self.list = async_to_raw_response_wrapper(
|
|
415
|
+
forums.list,
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
class ForumsResourceWithStreamingResponse:
|
|
420
|
+
def __init__(self, forums: ForumsResource) -> None:
|
|
421
|
+
self._forums = forums
|
|
422
|
+
|
|
423
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
424
|
+
forums.retrieve,
|
|
425
|
+
)
|
|
426
|
+
self.update = to_streamed_response_wrapper(
|
|
427
|
+
forums.update,
|
|
428
|
+
)
|
|
429
|
+
self.list = to_streamed_response_wrapper(
|
|
430
|
+
forums.list,
|
|
431
|
+
)
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
class AsyncForumsResourceWithStreamingResponse:
|
|
435
|
+
def __init__(self, forums: AsyncForumsResource) -> None:
|
|
436
|
+
self._forums = forums
|
|
437
|
+
|
|
438
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
439
|
+
forums.retrieve,
|
|
440
|
+
)
|
|
441
|
+
self.update = async_to_streamed_response_wrapper(
|
|
442
|
+
forums.update,
|
|
443
|
+
)
|
|
444
|
+
self.list = async_to_streamed_response_wrapper(
|
|
445
|
+
forums.list,
|
|
446
|
+
)
|