whop-sdk 0.0.1__py3-none-any.whl → 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of whop-sdk might be problematic. Click here for more details.
- whop_sdk/_client.py +65 -2
- whop_sdk/_version.py +1 -1
- whop_sdk/resources/__init__.py +98 -0
- whop_sdk/resources/checkout_configurations.py +16 -12
- whop_sdk/resources/course_chapters.py +602 -0
- whop_sdk/resources/course_lessons.py +722 -0
- whop_sdk/resources/courses.py +713 -0
- whop_sdk/resources/experiences.py +107 -0
- whop_sdk/resources/forum_posts.py +123 -1
- whop_sdk/resources/forums.py +446 -0
- whop_sdk/resources/members.py +429 -0
- whop_sdk/resources/memberships.py +16 -8
- whop_sdk/resources/messages.py +113 -1
- whop_sdk/resources/payments.py +3 -26
- whop_sdk/resources/plans.py +84 -6
- whop_sdk/resources/products.py +8 -16
- whop_sdk/resources/promo_codes.py +652 -0
- whop_sdk/resources/reviews.py +315 -0
- whop_sdk/types/__init__.py +64 -0
- whop_sdk/types/app_list_response.py +16 -1
- whop_sdk/types/assessment_question_types.py +7 -0
- whop_sdk/types/billing_reasons.py +9 -0
- whop_sdk/types/card_brands.py +24 -0
- whop_sdk/types/checkout_configuration_create_params.py +70 -7
- whop_sdk/types/checkout_configuration_list_response.py +12 -9
- whop_sdk/types/course.py +109 -0
- whop_sdk/types/course_chapter.py +32 -0
- whop_sdk/types/course_chapter_create_params.py +16 -0
- whop_sdk/types/course_chapter_delete_response.py +7 -0
- whop_sdk/types/course_chapter_list_params.py +25 -0
- whop_sdk/types/course_chapter_list_response.py +16 -0
- whop_sdk/types/course_chapter_update_params.py +12 -0
- whop_sdk/types/course_create_params.py +41 -0
- whop_sdk/types/course_delete_response.py +7 -0
- whop_sdk/types/course_lesson_create_params.py +27 -0
- whop_sdk/types/course_lesson_delete_response.py +7 -0
- whop_sdk/types/course_lesson_interaction_completed_webhook_event.py +26 -0
- whop_sdk/types/course_lesson_list_params.py +28 -0
- whop_sdk/types/course_lesson_list_response.py +35 -0
- whop_sdk/types/course_lesson_update_params.py +144 -0
- whop_sdk/types/course_list_params.py +28 -0
- whop_sdk/types/course_list_response.py +77 -0
- whop_sdk/types/course_update_params.py +89 -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_duplicate_params.py +13 -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_post_list_response.py +7 -0
- whop_sdk/types/forum_post_update_params.py +41 -0
- whop_sdk/types/forum_update_params.py +23 -0
- whop_sdk/types/invoice_create_params.py +10 -2
- whop_sdk/types/languages.py +30 -0
- whop_sdk/types/ledger_account_retrieve_response.py +15 -1
- whop_sdk/types/lesson.py +159 -0
- whop_sdk/types/lesson_types.py +7 -0
- whop_sdk/types/lesson_visibilities.py +7 -0
- whop_sdk/types/member_list_params.py +73 -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/membership_list_params.py +7 -4
- whop_sdk/types/membership_list_response.py +12 -1
- whop_sdk/types/message_update_params.py +35 -0
- whop_sdk/types/payment_failed_webhook_event.py +26 -0
- whop_sdk/types/payment_list_params.py +2 -7
- whop_sdk/types/payment_list_response.py +23 -13
- whop_sdk/types/payment_method_types.py +92 -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 +29 -3
- whop_sdk/types/plan_list_response.py +9 -0
- whop_sdk/types/plan_update_params.py +18 -0
- whop_sdk/types/product_create_params.py +1 -24
- whop_sdk/types/product_update_params.py +12 -1
- whop_sdk/types/promo_code.py +90 -0
- whop_sdk/types/promo_code_create_params.py +70 -0
- whop_sdk/types/promo_code_delete_response.py +7 -0
- whop_sdk/types/promo_code_list_params.py +37 -0
- whop_sdk/types/promo_code_list_response.py +79 -0
- whop_sdk/types/promo_code_status.py +7 -0
- whop_sdk/types/promo_duration.py +7 -0
- whop_sdk/types/review_list_params.py +31 -0
- whop_sdk/types/review_list_response.py +78 -0
- whop_sdk/types/review_retrieve_response.py +103 -0
- whop_sdk/types/review_status.py +7 -0
- 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 +12 -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/forum_post.py +7 -0
- whop_sdk/types/shared/invoice.py +4 -1
- whop_sdk/types/shared/invoice_list_item.py +4 -1
- whop_sdk/types/shared/member_most_recent_actions.py +22 -0
- whop_sdk/types/shared/member_statuses.py +7 -0
- whop_sdk/types/shared/membership.py +12 -1
- whop_sdk/types/shared/payment.py +23 -13
- whop_sdk/types/shared/plan.py +9 -0
- whop_sdk/types/shared/product.py +8 -0
- whop_sdk/types/shared/product_list_item.py +8 -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 +7 -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/promo_type.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.3.dist-info}/METADATA +2 -2
- {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.3.dist-info}/RECORD +126 -50
- {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.3.dist-info}/WHEEL +0 -0
- {whop_sdk-0.0.1.dist-info → whop_sdk-0.0.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,713 @@
|
|
|
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 Iterable, Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..types import Languages, course_list_params, course_create_params, course_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.course import Course
|
|
23
|
+
from ..types.languages import Languages
|
|
24
|
+
from ..types.course_list_response import CourseListResponse
|
|
25
|
+
from ..types.course_delete_response import CourseDeleteResponse
|
|
26
|
+
|
|
27
|
+
__all__ = ["CoursesResource", "AsyncCoursesResource"]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class CoursesResource(SyncAPIResource):
|
|
31
|
+
@cached_property
|
|
32
|
+
def with_raw_response(self) -> CoursesResourceWithRawResponse:
|
|
33
|
+
"""
|
|
34
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
35
|
+
the raw response object instead of the parsed content.
|
|
36
|
+
|
|
37
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
38
|
+
"""
|
|
39
|
+
return CoursesResourceWithRawResponse(self)
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def with_streaming_response(self) -> CoursesResourceWithStreamingResponse:
|
|
43
|
+
"""
|
|
44
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
45
|
+
|
|
46
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
47
|
+
"""
|
|
48
|
+
return CoursesResourceWithStreamingResponse(self)
|
|
49
|
+
|
|
50
|
+
def create(
|
|
51
|
+
self,
|
|
52
|
+
*,
|
|
53
|
+
experience_id: str,
|
|
54
|
+
title: str,
|
|
55
|
+
cover_image: Optional[str] | Omit = omit,
|
|
56
|
+
tagline: Optional[str] | Omit = omit,
|
|
57
|
+
thumbnail: Optional[course_create_params.Thumbnail] | Omit = omit,
|
|
58
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
59
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
60
|
+
extra_headers: Headers | None = None,
|
|
61
|
+
extra_query: Query | None = None,
|
|
62
|
+
extra_body: Body | None = None,
|
|
63
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
64
|
+
) -> Course:
|
|
65
|
+
"""
|
|
66
|
+
Creates a new course module in an experience
|
|
67
|
+
|
|
68
|
+
Required permissions:
|
|
69
|
+
|
|
70
|
+
- `courses:update`
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
experience_id: The ID of the experience to create the course in
|
|
74
|
+
|
|
75
|
+
title: The title of the course
|
|
76
|
+
|
|
77
|
+
cover_image: The cover image URL of the course
|
|
78
|
+
|
|
79
|
+
tagline: The tagline of the course
|
|
80
|
+
|
|
81
|
+
thumbnail: The thumbnail for the course in png, jpeg, or gif format
|
|
82
|
+
|
|
83
|
+
extra_headers: Send extra headers
|
|
84
|
+
|
|
85
|
+
extra_query: Add additional query parameters to the request
|
|
86
|
+
|
|
87
|
+
extra_body: Add additional JSON properties to the request
|
|
88
|
+
|
|
89
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
90
|
+
"""
|
|
91
|
+
return self._post(
|
|
92
|
+
"/courses",
|
|
93
|
+
body=maybe_transform(
|
|
94
|
+
{
|
|
95
|
+
"experience_id": experience_id,
|
|
96
|
+
"title": title,
|
|
97
|
+
"cover_image": cover_image,
|
|
98
|
+
"tagline": tagline,
|
|
99
|
+
"thumbnail": thumbnail,
|
|
100
|
+
},
|
|
101
|
+
course_create_params.CourseCreateParams,
|
|
102
|
+
),
|
|
103
|
+
options=make_request_options(
|
|
104
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
105
|
+
),
|
|
106
|
+
cast_to=Course,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def retrieve(
|
|
110
|
+
self,
|
|
111
|
+
id: str,
|
|
112
|
+
*,
|
|
113
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
114
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
115
|
+
extra_headers: Headers | None = None,
|
|
116
|
+
extra_query: Query | None = None,
|
|
117
|
+
extra_body: Body | None = None,
|
|
118
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
119
|
+
) -> Course:
|
|
120
|
+
"""
|
|
121
|
+
Retrieves a course by ID
|
|
122
|
+
|
|
123
|
+
Required permissions:
|
|
124
|
+
|
|
125
|
+
- `courses:read`
|
|
126
|
+
|
|
127
|
+
Args:
|
|
128
|
+
extra_headers: Send extra headers
|
|
129
|
+
|
|
130
|
+
extra_query: Add additional query parameters to the request
|
|
131
|
+
|
|
132
|
+
extra_body: Add additional JSON properties to the request
|
|
133
|
+
|
|
134
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
135
|
+
"""
|
|
136
|
+
if not id:
|
|
137
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
138
|
+
return self._get(
|
|
139
|
+
f"/courses/{id}",
|
|
140
|
+
options=make_request_options(
|
|
141
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
142
|
+
),
|
|
143
|
+
cast_to=Course,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
def update(
|
|
147
|
+
self,
|
|
148
|
+
id: str,
|
|
149
|
+
*,
|
|
150
|
+
certificate_after_completion_enabled: Optional[bool] | Omit = omit,
|
|
151
|
+
chapters: Optional[Iterable[course_update_params.Chapter]] | Omit = omit,
|
|
152
|
+
cover_image: Optional[str] | Omit = omit,
|
|
153
|
+
description: Optional[str] | Omit = omit,
|
|
154
|
+
language: Optional[Languages] | Omit = omit,
|
|
155
|
+
require_completing_lessons_in_order: Optional[bool] | Omit = omit,
|
|
156
|
+
tagline: Optional[str] | Omit = omit,
|
|
157
|
+
thumbnail: Optional[course_update_params.Thumbnail] | Omit = omit,
|
|
158
|
+
title: Optional[str] | Omit = omit,
|
|
159
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
160
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
161
|
+
extra_headers: Headers | None = None,
|
|
162
|
+
extra_query: Query | None = None,
|
|
163
|
+
extra_body: Body | None = None,
|
|
164
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
165
|
+
) -> Course:
|
|
166
|
+
"""
|
|
167
|
+
Updates a course
|
|
168
|
+
|
|
169
|
+
Required permissions:
|
|
170
|
+
|
|
171
|
+
- `courses:update`
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
certificate_after_completion_enabled: Whether the course will award its students a PDF certificate after completing
|
|
175
|
+
all lessons
|
|
176
|
+
|
|
177
|
+
chapters: The chapters and lessons to update
|
|
178
|
+
|
|
179
|
+
cover_image: The cover image URL of the course
|
|
180
|
+
|
|
181
|
+
description: A short description of the course
|
|
182
|
+
|
|
183
|
+
language: The available languages for a course
|
|
184
|
+
|
|
185
|
+
require_completing_lessons_in_order: Whether the course requires students to complete the previous lesson before
|
|
186
|
+
moving on to the next one
|
|
187
|
+
|
|
188
|
+
tagline: A short tagline for the course
|
|
189
|
+
|
|
190
|
+
thumbnail: The thumbnail for the course in png, jpeg, or gif format
|
|
191
|
+
|
|
192
|
+
title: The title of the course
|
|
193
|
+
|
|
194
|
+
extra_headers: Send extra headers
|
|
195
|
+
|
|
196
|
+
extra_query: Add additional query parameters to the request
|
|
197
|
+
|
|
198
|
+
extra_body: Add additional JSON properties to the request
|
|
199
|
+
|
|
200
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
201
|
+
"""
|
|
202
|
+
if not id:
|
|
203
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
204
|
+
return self._patch(
|
|
205
|
+
f"/courses/{id}",
|
|
206
|
+
body=maybe_transform(
|
|
207
|
+
{
|
|
208
|
+
"certificate_after_completion_enabled": certificate_after_completion_enabled,
|
|
209
|
+
"chapters": chapters,
|
|
210
|
+
"cover_image": cover_image,
|
|
211
|
+
"description": description,
|
|
212
|
+
"language": language,
|
|
213
|
+
"require_completing_lessons_in_order": require_completing_lessons_in_order,
|
|
214
|
+
"tagline": tagline,
|
|
215
|
+
"thumbnail": thumbnail,
|
|
216
|
+
"title": title,
|
|
217
|
+
},
|
|
218
|
+
course_update_params.CourseUpdateParams,
|
|
219
|
+
),
|
|
220
|
+
options=make_request_options(
|
|
221
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
222
|
+
),
|
|
223
|
+
cast_to=Course,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
def list(
|
|
227
|
+
self,
|
|
228
|
+
*,
|
|
229
|
+
after: Optional[str] | Omit = omit,
|
|
230
|
+
before: Optional[str] | Omit = omit,
|
|
231
|
+
company_id: Optional[str] | Omit = omit,
|
|
232
|
+
experience_id: Optional[str] | Omit = omit,
|
|
233
|
+
first: Optional[int] | Omit = omit,
|
|
234
|
+
last: Optional[int] | Omit = omit,
|
|
235
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
236
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
237
|
+
extra_headers: Headers | None = None,
|
|
238
|
+
extra_query: Query | None = None,
|
|
239
|
+
extra_body: Body | None = None,
|
|
240
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
241
|
+
) -> SyncCursorPage[CourseListResponse]:
|
|
242
|
+
"""
|
|
243
|
+
Lists courses for an experience or company
|
|
244
|
+
|
|
245
|
+
Required permissions:
|
|
246
|
+
|
|
247
|
+
- `courses:read`
|
|
248
|
+
|
|
249
|
+
Args:
|
|
250
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
251
|
+
|
|
252
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
253
|
+
|
|
254
|
+
company_id: The ID of the company
|
|
255
|
+
|
|
256
|
+
experience_id: The ID of the experience
|
|
257
|
+
|
|
258
|
+
first: Returns the first _n_ elements from the list.
|
|
259
|
+
|
|
260
|
+
last: Returns the last _n_ elements from the list.
|
|
261
|
+
|
|
262
|
+
extra_headers: Send extra headers
|
|
263
|
+
|
|
264
|
+
extra_query: Add additional query parameters to the request
|
|
265
|
+
|
|
266
|
+
extra_body: Add additional JSON properties to the request
|
|
267
|
+
|
|
268
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
269
|
+
"""
|
|
270
|
+
return self._get_api_list(
|
|
271
|
+
"/courses",
|
|
272
|
+
page=SyncCursorPage[CourseListResponse],
|
|
273
|
+
options=make_request_options(
|
|
274
|
+
extra_headers=extra_headers,
|
|
275
|
+
extra_query=extra_query,
|
|
276
|
+
extra_body=extra_body,
|
|
277
|
+
timeout=timeout,
|
|
278
|
+
query=maybe_transform(
|
|
279
|
+
{
|
|
280
|
+
"after": after,
|
|
281
|
+
"before": before,
|
|
282
|
+
"company_id": company_id,
|
|
283
|
+
"experience_id": experience_id,
|
|
284
|
+
"first": first,
|
|
285
|
+
"last": last,
|
|
286
|
+
},
|
|
287
|
+
course_list_params.CourseListParams,
|
|
288
|
+
),
|
|
289
|
+
),
|
|
290
|
+
model=CourseListResponse,
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
def delete(
|
|
294
|
+
self,
|
|
295
|
+
id: str,
|
|
296
|
+
*,
|
|
297
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
298
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
299
|
+
extra_headers: Headers | None = None,
|
|
300
|
+
extra_query: Query | None = None,
|
|
301
|
+
extra_body: Body | None = None,
|
|
302
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
303
|
+
) -> CourseDeleteResponse:
|
|
304
|
+
"""
|
|
305
|
+
Deletes a course
|
|
306
|
+
|
|
307
|
+
Required permissions:
|
|
308
|
+
|
|
309
|
+
- `courses:update`
|
|
310
|
+
|
|
311
|
+
Args:
|
|
312
|
+
extra_headers: Send extra headers
|
|
313
|
+
|
|
314
|
+
extra_query: Add additional query parameters to the request
|
|
315
|
+
|
|
316
|
+
extra_body: Add additional JSON properties to the request
|
|
317
|
+
|
|
318
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
319
|
+
"""
|
|
320
|
+
if not id:
|
|
321
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
322
|
+
return self._delete(
|
|
323
|
+
f"/courses/{id}",
|
|
324
|
+
options=make_request_options(
|
|
325
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
326
|
+
),
|
|
327
|
+
cast_to=CourseDeleteResponse,
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
class AsyncCoursesResource(AsyncAPIResource):
|
|
332
|
+
@cached_property
|
|
333
|
+
def with_raw_response(self) -> AsyncCoursesResourceWithRawResponse:
|
|
334
|
+
"""
|
|
335
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
336
|
+
the raw response object instead of the parsed content.
|
|
337
|
+
|
|
338
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
339
|
+
"""
|
|
340
|
+
return AsyncCoursesResourceWithRawResponse(self)
|
|
341
|
+
|
|
342
|
+
@cached_property
|
|
343
|
+
def with_streaming_response(self) -> AsyncCoursesResourceWithStreamingResponse:
|
|
344
|
+
"""
|
|
345
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
346
|
+
|
|
347
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
348
|
+
"""
|
|
349
|
+
return AsyncCoursesResourceWithStreamingResponse(self)
|
|
350
|
+
|
|
351
|
+
async def create(
|
|
352
|
+
self,
|
|
353
|
+
*,
|
|
354
|
+
experience_id: str,
|
|
355
|
+
title: str,
|
|
356
|
+
cover_image: Optional[str] | Omit = omit,
|
|
357
|
+
tagline: Optional[str] | Omit = omit,
|
|
358
|
+
thumbnail: Optional[course_create_params.Thumbnail] | Omit = omit,
|
|
359
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
360
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
361
|
+
extra_headers: Headers | None = None,
|
|
362
|
+
extra_query: Query | None = None,
|
|
363
|
+
extra_body: Body | None = None,
|
|
364
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
365
|
+
) -> Course:
|
|
366
|
+
"""
|
|
367
|
+
Creates a new course module in an experience
|
|
368
|
+
|
|
369
|
+
Required permissions:
|
|
370
|
+
|
|
371
|
+
- `courses:update`
|
|
372
|
+
|
|
373
|
+
Args:
|
|
374
|
+
experience_id: The ID of the experience to create the course in
|
|
375
|
+
|
|
376
|
+
title: The title of the course
|
|
377
|
+
|
|
378
|
+
cover_image: The cover image URL of the course
|
|
379
|
+
|
|
380
|
+
tagline: The tagline of the course
|
|
381
|
+
|
|
382
|
+
thumbnail: The thumbnail for the course in png, jpeg, or gif format
|
|
383
|
+
|
|
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
|
+
return await self._post(
|
|
393
|
+
"/courses",
|
|
394
|
+
body=await async_maybe_transform(
|
|
395
|
+
{
|
|
396
|
+
"experience_id": experience_id,
|
|
397
|
+
"title": title,
|
|
398
|
+
"cover_image": cover_image,
|
|
399
|
+
"tagline": tagline,
|
|
400
|
+
"thumbnail": thumbnail,
|
|
401
|
+
},
|
|
402
|
+
course_create_params.CourseCreateParams,
|
|
403
|
+
),
|
|
404
|
+
options=make_request_options(
|
|
405
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
406
|
+
),
|
|
407
|
+
cast_to=Course,
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
async def retrieve(
|
|
411
|
+
self,
|
|
412
|
+
id: str,
|
|
413
|
+
*,
|
|
414
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
415
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
416
|
+
extra_headers: Headers | None = None,
|
|
417
|
+
extra_query: Query | None = None,
|
|
418
|
+
extra_body: Body | None = None,
|
|
419
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
420
|
+
) -> Course:
|
|
421
|
+
"""
|
|
422
|
+
Retrieves a course by ID
|
|
423
|
+
|
|
424
|
+
Required permissions:
|
|
425
|
+
|
|
426
|
+
- `courses:read`
|
|
427
|
+
|
|
428
|
+
Args:
|
|
429
|
+
extra_headers: Send extra headers
|
|
430
|
+
|
|
431
|
+
extra_query: Add additional query parameters to the request
|
|
432
|
+
|
|
433
|
+
extra_body: Add additional JSON properties to the request
|
|
434
|
+
|
|
435
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
436
|
+
"""
|
|
437
|
+
if not id:
|
|
438
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
439
|
+
return await self._get(
|
|
440
|
+
f"/courses/{id}",
|
|
441
|
+
options=make_request_options(
|
|
442
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
443
|
+
),
|
|
444
|
+
cast_to=Course,
|
|
445
|
+
)
|
|
446
|
+
|
|
447
|
+
async def update(
|
|
448
|
+
self,
|
|
449
|
+
id: str,
|
|
450
|
+
*,
|
|
451
|
+
certificate_after_completion_enabled: Optional[bool] | Omit = omit,
|
|
452
|
+
chapters: Optional[Iterable[course_update_params.Chapter]] | Omit = omit,
|
|
453
|
+
cover_image: Optional[str] | Omit = omit,
|
|
454
|
+
description: Optional[str] | Omit = omit,
|
|
455
|
+
language: Optional[Languages] | Omit = omit,
|
|
456
|
+
require_completing_lessons_in_order: Optional[bool] | Omit = omit,
|
|
457
|
+
tagline: Optional[str] | Omit = omit,
|
|
458
|
+
thumbnail: Optional[course_update_params.Thumbnail] | Omit = omit,
|
|
459
|
+
title: Optional[str] | Omit = omit,
|
|
460
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
461
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
462
|
+
extra_headers: Headers | None = None,
|
|
463
|
+
extra_query: Query | None = None,
|
|
464
|
+
extra_body: Body | None = None,
|
|
465
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
466
|
+
) -> Course:
|
|
467
|
+
"""
|
|
468
|
+
Updates a course
|
|
469
|
+
|
|
470
|
+
Required permissions:
|
|
471
|
+
|
|
472
|
+
- `courses:update`
|
|
473
|
+
|
|
474
|
+
Args:
|
|
475
|
+
certificate_after_completion_enabled: Whether the course will award its students a PDF certificate after completing
|
|
476
|
+
all lessons
|
|
477
|
+
|
|
478
|
+
chapters: The chapters and lessons to update
|
|
479
|
+
|
|
480
|
+
cover_image: The cover image URL of the course
|
|
481
|
+
|
|
482
|
+
description: A short description of the course
|
|
483
|
+
|
|
484
|
+
language: The available languages for a course
|
|
485
|
+
|
|
486
|
+
require_completing_lessons_in_order: Whether the course requires students to complete the previous lesson before
|
|
487
|
+
moving on to the next one
|
|
488
|
+
|
|
489
|
+
tagline: A short tagline for the course
|
|
490
|
+
|
|
491
|
+
thumbnail: The thumbnail for the course in png, jpeg, or gif format
|
|
492
|
+
|
|
493
|
+
title: The title of the course
|
|
494
|
+
|
|
495
|
+
extra_headers: Send extra headers
|
|
496
|
+
|
|
497
|
+
extra_query: Add additional query parameters to the request
|
|
498
|
+
|
|
499
|
+
extra_body: Add additional JSON properties to the request
|
|
500
|
+
|
|
501
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
502
|
+
"""
|
|
503
|
+
if not id:
|
|
504
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
505
|
+
return await self._patch(
|
|
506
|
+
f"/courses/{id}",
|
|
507
|
+
body=await async_maybe_transform(
|
|
508
|
+
{
|
|
509
|
+
"certificate_after_completion_enabled": certificate_after_completion_enabled,
|
|
510
|
+
"chapters": chapters,
|
|
511
|
+
"cover_image": cover_image,
|
|
512
|
+
"description": description,
|
|
513
|
+
"language": language,
|
|
514
|
+
"require_completing_lessons_in_order": require_completing_lessons_in_order,
|
|
515
|
+
"tagline": tagline,
|
|
516
|
+
"thumbnail": thumbnail,
|
|
517
|
+
"title": title,
|
|
518
|
+
},
|
|
519
|
+
course_update_params.CourseUpdateParams,
|
|
520
|
+
),
|
|
521
|
+
options=make_request_options(
|
|
522
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
523
|
+
),
|
|
524
|
+
cast_to=Course,
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
def list(
|
|
528
|
+
self,
|
|
529
|
+
*,
|
|
530
|
+
after: Optional[str] | Omit = omit,
|
|
531
|
+
before: Optional[str] | Omit = omit,
|
|
532
|
+
company_id: Optional[str] | Omit = omit,
|
|
533
|
+
experience_id: Optional[str] | Omit = omit,
|
|
534
|
+
first: Optional[int] | Omit = omit,
|
|
535
|
+
last: Optional[int] | Omit = omit,
|
|
536
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
537
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
538
|
+
extra_headers: Headers | None = None,
|
|
539
|
+
extra_query: Query | None = None,
|
|
540
|
+
extra_body: Body | None = None,
|
|
541
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
542
|
+
) -> AsyncPaginator[CourseListResponse, AsyncCursorPage[CourseListResponse]]:
|
|
543
|
+
"""
|
|
544
|
+
Lists courses for an experience or company
|
|
545
|
+
|
|
546
|
+
Required permissions:
|
|
547
|
+
|
|
548
|
+
- `courses:read`
|
|
549
|
+
|
|
550
|
+
Args:
|
|
551
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
552
|
+
|
|
553
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
554
|
+
|
|
555
|
+
company_id: The ID of the company
|
|
556
|
+
|
|
557
|
+
experience_id: The ID of the experience
|
|
558
|
+
|
|
559
|
+
first: Returns the first _n_ elements from the list.
|
|
560
|
+
|
|
561
|
+
last: Returns the last _n_ elements from the list.
|
|
562
|
+
|
|
563
|
+
extra_headers: Send extra headers
|
|
564
|
+
|
|
565
|
+
extra_query: Add additional query parameters to the request
|
|
566
|
+
|
|
567
|
+
extra_body: Add additional JSON properties to the request
|
|
568
|
+
|
|
569
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
570
|
+
"""
|
|
571
|
+
return self._get_api_list(
|
|
572
|
+
"/courses",
|
|
573
|
+
page=AsyncCursorPage[CourseListResponse],
|
|
574
|
+
options=make_request_options(
|
|
575
|
+
extra_headers=extra_headers,
|
|
576
|
+
extra_query=extra_query,
|
|
577
|
+
extra_body=extra_body,
|
|
578
|
+
timeout=timeout,
|
|
579
|
+
query=maybe_transform(
|
|
580
|
+
{
|
|
581
|
+
"after": after,
|
|
582
|
+
"before": before,
|
|
583
|
+
"company_id": company_id,
|
|
584
|
+
"experience_id": experience_id,
|
|
585
|
+
"first": first,
|
|
586
|
+
"last": last,
|
|
587
|
+
},
|
|
588
|
+
course_list_params.CourseListParams,
|
|
589
|
+
),
|
|
590
|
+
),
|
|
591
|
+
model=CourseListResponse,
|
|
592
|
+
)
|
|
593
|
+
|
|
594
|
+
async def delete(
|
|
595
|
+
self,
|
|
596
|
+
id: str,
|
|
597
|
+
*,
|
|
598
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
599
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
600
|
+
extra_headers: Headers | None = None,
|
|
601
|
+
extra_query: Query | None = None,
|
|
602
|
+
extra_body: Body | None = None,
|
|
603
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
604
|
+
) -> CourseDeleteResponse:
|
|
605
|
+
"""
|
|
606
|
+
Deletes a course
|
|
607
|
+
|
|
608
|
+
Required permissions:
|
|
609
|
+
|
|
610
|
+
- `courses:update`
|
|
611
|
+
|
|
612
|
+
Args:
|
|
613
|
+
extra_headers: Send extra headers
|
|
614
|
+
|
|
615
|
+
extra_query: Add additional query parameters to the request
|
|
616
|
+
|
|
617
|
+
extra_body: Add additional JSON properties to the request
|
|
618
|
+
|
|
619
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
620
|
+
"""
|
|
621
|
+
if not id:
|
|
622
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
623
|
+
return await self._delete(
|
|
624
|
+
f"/courses/{id}",
|
|
625
|
+
options=make_request_options(
|
|
626
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
627
|
+
),
|
|
628
|
+
cast_to=CourseDeleteResponse,
|
|
629
|
+
)
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
class CoursesResourceWithRawResponse:
|
|
633
|
+
def __init__(self, courses: CoursesResource) -> None:
|
|
634
|
+
self._courses = courses
|
|
635
|
+
|
|
636
|
+
self.create = to_raw_response_wrapper(
|
|
637
|
+
courses.create,
|
|
638
|
+
)
|
|
639
|
+
self.retrieve = to_raw_response_wrapper(
|
|
640
|
+
courses.retrieve,
|
|
641
|
+
)
|
|
642
|
+
self.update = to_raw_response_wrapper(
|
|
643
|
+
courses.update,
|
|
644
|
+
)
|
|
645
|
+
self.list = to_raw_response_wrapper(
|
|
646
|
+
courses.list,
|
|
647
|
+
)
|
|
648
|
+
self.delete = to_raw_response_wrapper(
|
|
649
|
+
courses.delete,
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
class AsyncCoursesResourceWithRawResponse:
|
|
654
|
+
def __init__(self, courses: AsyncCoursesResource) -> None:
|
|
655
|
+
self._courses = courses
|
|
656
|
+
|
|
657
|
+
self.create = async_to_raw_response_wrapper(
|
|
658
|
+
courses.create,
|
|
659
|
+
)
|
|
660
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
661
|
+
courses.retrieve,
|
|
662
|
+
)
|
|
663
|
+
self.update = async_to_raw_response_wrapper(
|
|
664
|
+
courses.update,
|
|
665
|
+
)
|
|
666
|
+
self.list = async_to_raw_response_wrapper(
|
|
667
|
+
courses.list,
|
|
668
|
+
)
|
|
669
|
+
self.delete = async_to_raw_response_wrapper(
|
|
670
|
+
courses.delete,
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
class CoursesResourceWithStreamingResponse:
|
|
675
|
+
def __init__(self, courses: CoursesResource) -> None:
|
|
676
|
+
self._courses = courses
|
|
677
|
+
|
|
678
|
+
self.create = to_streamed_response_wrapper(
|
|
679
|
+
courses.create,
|
|
680
|
+
)
|
|
681
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
682
|
+
courses.retrieve,
|
|
683
|
+
)
|
|
684
|
+
self.update = to_streamed_response_wrapper(
|
|
685
|
+
courses.update,
|
|
686
|
+
)
|
|
687
|
+
self.list = to_streamed_response_wrapper(
|
|
688
|
+
courses.list,
|
|
689
|
+
)
|
|
690
|
+
self.delete = to_streamed_response_wrapper(
|
|
691
|
+
courses.delete,
|
|
692
|
+
)
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
class AsyncCoursesResourceWithStreamingResponse:
|
|
696
|
+
def __init__(self, courses: AsyncCoursesResource) -> None:
|
|
697
|
+
self._courses = courses
|
|
698
|
+
|
|
699
|
+
self.create = async_to_streamed_response_wrapper(
|
|
700
|
+
courses.create,
|
|
701
|
+
)
|
|
702
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
703
|
+
courses.retrieve,
|
|
704
|
+
)
|
|
705
|
+
self.update = async_to_streamed_response_wrapper(
|
|
706
|
+
courses.update,
|
|
707
|
+
)
|
|
708
|
+
self.list = async_to_streamed_response_wrapper(
|
|
709
|
+
courses.list,
|
|
710
|
+
)
|
|
711
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
712
|
+
courses.delete,
|
|
713
|
+
)
|