whop-sdk 0.0.2__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 +47 -2
- whop_sdk/_version.py +1 -1
- whop_sdk/resources/__init__.py +70 -0
- whop_sdk/resources/checkout_configurations.py +4 -0
- 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/members.py +8 -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 +74 -2
- 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 +39 -0
- 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 +65 -2
- whop_sdk/types/checkout_configuration_list_response.py +4 -1
- 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_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/experience_duplicate_params.py +13 -0
- whop_sdk/types/forum_post_list_response.py +7 -0
- whop_sdk/types/forum_post_update_params.py +41 -0
- 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 +3 -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_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/plan_create_params.py +19 -1
- 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/checkout_configuration.py +4 -1
- 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/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_params/__init__.py +1 -0
- whop_sdk/types/shared_params/promo_type.py +9 -0
- {whop_sdk-0.0.2.dist-info → whop_sdk-0.0.3.dist-info}/METADATA +1 -1
- {whop_sdk-0.0.2.dist-info → whop_sdk-0.0.3.dist-info}/RECORD +86 -41
- {whop_sdk-0.0.2.dist-info → whop_sdk-0.0.3.dist-info}/WHEEL +0 -0
- {whop_sdk-0.0.2.dist-info → whop_sdk-0.0.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,722 @@
|
|
|
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 (
|
|
10
|
+
LessonTypes,
|
|
11
|
+
LessonVisibilities,
|
|
12
|
+
course_lesson_list_params,
|
|
13
|
+
course_lesson_create_params,
|
|
14
|
+
course_lesson_update_params,
|
|
15
|
+
)
|
|
16
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
17
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
18
|
+
from .._compat import cached_property
|
|
19
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
20
|
+
from .._response import (
|
|
21
|
+
to_raw_response_wrapper,
|
|
22
|
+
to_streamed_response_wrapper,
|
|
23
|
+
async_to_raw_response_wrapper,
|
|
24
|
+
async_to_streamed_response_wrapper,
|
|
25
|
+
)
|
|
26
|
+
from ..pagination import SyncCursorPage, AsyncCursorPage
|
|
27
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
28
|
+
from ..types.lesson import Lesson
|
|
29
|
+
from ..types.lesson_types import LessonTypes
|
|
30
|
+
from ..types.lesson_visibilities import LessonVisibilities
|
|
31
|
+
from ..types.course_lesson_list_response import CourseLessonListResponse
|
|
32
|
+
from ..types.course_lesson_delete_response import CourseLessonDeleteResponse
|
|
33
|
+
|
|
34
|
+
__all__ = ["CourseLessonsResource", "AsyncCourseLessonsResource"]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class CourseLessonsResource(SyncAPIResource):
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_raw_response(self) -> CourseLessonsResourceWithRawResponse:
|
|
40
|
+
"""
|
|
41
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
42
|
+
the raw response object instead of the parsed content.
|
|
43
|
+
|
|
44
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
45
|
+
"""
|
|
46
|
+
return CourseLessonsResourceWithRawResponse(self)
|
|
47
|
+
|
|
48
|
+
@cached_property
|
|
49
|
+
def with_streaming_response(self) -> CourseLessonsResourceWithStreamingResponse:
|
|
50
|
+
"""
|
|
51
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
52
|
+
|
|
53
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
54
|
+
"""
|
|
55
|
+
return CourseLessonsResourceWithStreamingResponse(self)
|
|
56
|
+
|
|
57
|
+
def create(
|
|
58
|
+
self,
|
|
59
|
+
*,
|
|
60
|
+
chapter_id: str,
|
|
61
|
+
lesson_type: LessonTypes,
|
|
62
|
+
content: Optional[str] | Omit = omit,
|
|
63
|
+
days_from_course_start_until_unlock: Optional[int] | Omit = omit,
|
|
64
|
+
title: Optional[str] | Omit = omit,
|
|
65
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
67
|
+
extra_headers: Headers | None = None,
|
|
68
|
+
extra_query: Query | None = None,
|
|
69
|
+
extra_body: Body | None = None,
|
|
70
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
71
|
+
) -> Lesson:
|
|
72
|
+
"""
|
|
73
|
+
Creates a new course lesson
|
|
74
|
+
|
|
75
|
+
Required permissions:
|
|
76
|
+
|
|
77
|
+
- `courses:update`
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
chapter_id: The ID of the chapter to create the lesson in
|
|
81
|
+
|
|
82
|
+
lesson_type: The type of the lesson
|
|
83
|
+
|
|
84
|
+
content: The content of the lesson
|
|
85
|
+
|
|
86
|
+
days_from_course_start_until_unlock: Days from course start until unlock
|
|
87
|
+
|
|
88
|
+
title: The title of the lesson
|
|
89
|
+
|
|
90
|
+
extra_headers: Send extra headers
|
|
91
|
+
|
|
92
|
+
extra_query: Add additional query parameters to the request
|
|
93
|
+
|
|
94
|
+
extra_body: Add additional JSON properties to the request
|
|
95
|
+
|
|
96
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
97
|
+
"""
|
|
98
|
+
return self._post(
|
|
99
|
+
"/course_lessons",
|
|
100
|
+
body=maybe_transform(
|
|
101
|
+
{
|
|
102
|
+
"chapter_id": chapter_id,
|
|
103
|
+
"lesson_type": lesson_type,
|
|
104
|
+
"content": content,
|
|
105
|
+
"days_from_course_start_until_unlock": days_from_course_start_until_unlock,
|
|
106
|
+
"title": title,
|
|
107
|
+
},
|
|
108
|
+
course_lesson_create_params.CourseLessonCreateParams,
|
|
109
|
+
),
|
|
110
|
+
options=make_request_options(
|
|
111
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
112
|
+
),
|
|
113
|
+
cast_to=Lesson,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
def retrieve(
|
|
117
|
+
self,
|
|
118
|
+
id: str,
|
|
119
|
+
*,
|
|
120
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
121
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
122
|
+
extra_headers: Headers | None = None,
|
|
123
|
+
extra_query: Query | None = None,
|
|
124
|
+
extra_body: Body | None = None,
|
|
125
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
126
|
+
) -> Lesson:
|
|
127
|
+
"""
|
|
128
|
+
Retrieves a course lesson by ID
|
|
129
|
+
|
|
130
|
+
Required permissions:
|
|
131
|
+
|
|
132
|
+
- `courses:read`
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
extra_headers: Send extra headers
|
|
136
|
+
|
|
137
|
+
extra_query: Add additional query parameters to the request
|
|
138
|
+
|
|
139
|
+
extra_body: Add additional JSON properties to the request
|
|
140
|
+
|
|
141
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
142
|
+
"""
|
|
143
|
+
if not id:
|
|
144
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
145
|
+
return self._get(
|
|
146
|
+
f"/course_lessons/{id}",
|
|
147
|
+
options=make_request_options(
|
|
148
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
149
|
+
),
|
|
150
|
+
cast_to=Lesson,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
def update(
|
|
154
|
+
self,
|
|
155
|
+
id: str,
|
|
156
|
+
*,
|
|
157
|
+
assessment_questions: Optional[Iterable[course_lesson_update_params.AssessmentQuestion]] | Omit = omit,
|
|
158
|
+
attachments: Optional[Iterable[course_lesson_update_params.Attachment]] | Omit = omit,
|
|
159
|
+
content: Optional[str] | Omit = omit,
|
|
160
|
+
days_from_course_start_until_unlock: Optional[int] | Omit = omit,
|
|
161
|
+
lesson_type: Optional[LessonTypes] | Omit = omit,
|
|
162
|
+
main_pdf: Optional[course_lesson_update_params.MainPdf] | Omit = omit,
|
|
163
|
+
mux_asset_id: Optional[str] | Omit = omit,
|
|
164
|
+
title: Optional[str] | Omit = omit,
|
|
165
|
+
visibility: Optional[LessonVisibilities] | Omit = omit,
|
|
166
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
167
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
168
|
+
extra_headers: Headers | None = None,
|
|
169
|
+
extra_query: Query | None = None,
|
|
170
|
+
extra_body: Body | None = None,
|
|
171
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
172
|
+
) -> Lesson:
|
|
173
|
+
"""
|
|
174
|
+
Updates a course lesson
|
|
175
|
+
|
|
176
|
+
Required permissions:
|
|
177
|
+
|
|
178
|
+
- `courses:update`
|
|
179
|
+
|
|
180
|
+
Args:
|
|
181
|
+
assessment_questions: Assessment questions for quiz/knowledge check lessons. Replaces all existing
|
|
182
|
+
questions.
|
|
183
|
+
|
|
184
|
+
attachments: General attachments for the lesson (PDFs, files, etc). Replaces all existing
|
|
185
|
+
attachments.
|
|
186
|
+
|
|
187
|
+
content: The content of the lesson
|
|
188
|
+
|
|
189
|
+
days_from_course_start_until_unlock: Days from course start until unlock
|
|
190
|
+
|
|
191
|
+
lesson_type: The available types for a lesson
|
|
192
|
+
|
|
193
|
+
main_pdf: The main PDF file for this lesson
|
|
194
|
+
|
|
195
|
+
mux_asset_id: The ID of the Mux asset to attach to this lesson for video lessons
|
|
196
|
+
|
|
197
|
+
title: The title of the lesson
|
|
198
|
+
|
|
199
|
+
visibility: The available visibilities for a lesson. Determines how / whether a lesson is
|
|
200
|
+
visible to users.
|
|
201
|
+
|
|
202
|
+
extra_headers: Send extra headers
|
|
203
|
+
|
|
204
|
+
extra_query: Add additional query parameters to the request
|
|
205
|
+
|
|
206
|
+
extra_body: Add additional JSON properties to the request
|
|
207
|
+
|
|
208
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
209
|
+
"""
|
|
210
|
+
if not id:
|
|
211
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
212
|
+
return self._patch(
|
|
213
|
+
f"/course_lessons/{id}",
|
|
214
|
+
body=maybe_transform(
|
|
215
|
+
{
|
|
216
|
+
"assessment_questions": assessment_questions,
|
|
217
|
+
"attachments": attachments,
|
|
218
|
+
"content": content,
|
|
219
|
+
"days_from_course_start_until_unlock": days_from_course_start_until_unlock,
|
|
220
|
+
"lesson_type": lesson_type,
|
|
221
|
+
"main_pdf": main_pdf,
|
|
222
|
+
"mux_asset_id": mux_asset_id,
|
|
223
|
+
"title": title,
|
|
224
|
+
"visibility": visibility,
|
|
225
|
+
},
|
|
226
|
+
course_lesson_update_params.CourseLessonUpdateParams,
|
|
227
|
+
),
|
|
228
|
+
options=make_request_options(
|
|
229
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
230
|
+
),
|
|
231
|
+
cast_to=Lesson,
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
def list(
|
|
235
|
+
self,
|
|
236
|
+
*,
|
|
237
|
+
after: Optional[str] | Omit = omit,
|
|
238
|
+
before: Optional[str] | Omit = omit,
|
|
239
|
+
chapter_id: Optional[str] | Omit = omit,
|
|
240
|
+
course_id: Optional[str] | Omit = omit,
|
|
241
|
+
first: Optional[int] | Omit = omit,
|
|
242
|
+
last: Optional[int] | Omit = omit,
|
|
243
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
244
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
245
|
+
extra_headers: Headers | None = None,
|
|
246
|
+
extra_query: Query | None = None,
|
|
247
|
+
extra_body: Body | None = None,
|
|
248
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
249
|
+
) -> SyncCursorPage[CourseLessonListResponse]:
|
|
250
|
+
"""
|
|
251
|
+
Lists lessons for a course or chapter
|
|
252
|
+
|
|
253
|
+
Required permissions:
|
|
254
|
+
|
|
255
|
+
- `courses:read`
|
|
256
|
+
|
|
257
|
+
Args:
|
|
258
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
259
|
+
|
|
260
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
261
|
+
|
|
262
|
+
chapter_id: The ID of the chapter (returns lessons only for this chapter)
|
|
263
|
+
|
|
264
|
+
course_id: The ID of the course (returns all lessons across all chapters)
|
|
265
|
+
|
|
266
|
+
first: Returns the first _n_ elements from the list.
|
|
267
|
+
|
|
268
|
+
last: Returns the last _n_ elements from the list.
|
|
269
|
+
|
|
270
|
+
extra_headers: Send extra headers
|
|
271
|
+
|
|
272
|
+
extra_query: Add additional query parameters to the request
|
|
273
|
+
|
|
274
|
+
extra_body: Add additional JSON properties to the request
|
|
275
|
+
|
|
276
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
277
|
+
"""
|
|
278
|
+
return self._get_api_list(
|
|
279
|
+
"/course_lessons",
|
|
280
|
+
page=SyncCursorPage[CourseLessonListResponse],
|
|
281
|
+
options=make_request_options(
|
|
282
|
+
extra_headers=extra_headers,
|
|
283
|
+
extra_query=extra_query,
|
|
284
|
+
extra_body=extra_body,
|
|
285
|
+
timeout=timeout,
|
|
286
|
+
query=maybe_transform(
|
|
287
|
+
{
|
|
288
|
+
"after": after,
|
|
289
|
+
"before": before,
|
|
290
|
+
"chapter_id": chapter_id,
|
|
291
|
+
"course_id": course_id,
|
|
292
|
+
"first": first,
|
|
293
|
+
"last": last,
|
|
294
|
+
},
|
|
295
|
+
course_lesson_list_params.CourseLessonListParams,
|
|
296
|
+
),
|
|
297
|
+
),
|
|
298
|
+
model=CourseLessonListResponse,
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
def delete(
|
|
302
|
+
self,
|
|
303
|
+
id: str,
|
|
304
|
+
*,
|
|
305
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
306
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
307
|
+
extra_headers: Headers | None = None,
|
|
308
|
+
extra_query: Query | None = None,
|
|
309
|
+
extra_body: Body | None = None,
|
|
310
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
311
|
+
) -> CourseLessonDeleteResponse:
|
|
312
|
+
"""
|
|
313
|
+
Deletes a course lesson
|
|
314
|
+
|
|
315
|
+
Required permissions:
|
|
316
|
+
|
|
317
|
+
- `courses:update`
|
|
318
|
+
|
|
319
|
+
Args:
|
|
320
|
+
extra_headers: Send extra headers
|
|
321
|
+
|
|
322
|
+
extra_query: Add additional query parameters to the request
|
|
323
|
+
|
|
324
|
+
extra_body: Add additional JSON properties to the request
|
|
325
|
+
|
|
326
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
327
|
+
"""
|
|
328
|
+
if not id:
|
|
329
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
330
|
+
return self._delete(
|
|
331
|
+
f"/course_lessons/{id}",
|
|
332
|
+
options=make_request_options(
|
|
333
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
334
|
+
),
|
|
335
|
+
cast_to=CourseLessonDeleteResponse,
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
class AsyncCourseLessonsResource(AsyncAPIResource):
|
|
340
|
+
@cached_property
|
|
341
|
+
def with_raw_response(self) -> AsyncCourseLessonsResourceWithRawResponse:
|
|
342
|
+
"""
|
|
343
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
344
|
+
the raw response object instead of the parsed content.
|
|
345
|
+
|
|
346
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
347
|
+
"""
|
|
348
|
+
return AsyncCourseLessonsResourceWithRawResponse(self)
|
|
349
|
+
|
|
350
|
+
@cached_property
|
|
351
|
+
def with_streaming_response(self) -> AsyncCourseLessonsResourceWithStreamingResponse:
|
|
352
|
+
"""
|
|
353
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
354
|
+
|
|
355
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
356
|
+
"""
|
|
357
|
+
return AsyncCourseLessonsResourceWithStreamingResponse(self)
|
|
358
|
+
|
|
359
|
+
async def create(
|
|
360
|
+
self,
|
|
361
|
+
*,
|
|
362
|
+
chapter_id: str,
|
|
363
|
+
lesson_type: LessonTypes,
|
|
364
|
+
content: Optional[str] | Omit = omit,
|
|
365
|
+
days_from_course_start_until_unlock: Optional[int] | Omit = omit,
|
|
366
|
+
title: Optional[str] | Omit = omit,
|
|
367
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
368
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
369
|
+
extra_headers: Headers | None = None,
|
|
370
|
+
extra_query: Query | None = None,
|
|
371
|
+
extra_body: Body | None = None,
|
|
372
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
373
|
+
) -> Lesson:
|
|
374
|
+
"""
|
|
375
|
+
Creates a new course lesson
|
|
376
|
+
|
|
377
|
+
Required permissions:
|
|
378
|
+
|
|
379
|
+
- `courses:update`
|
|
380
|
+
|
|
381
|
+
Args:
|
|
382
|
+
chapter_id: The ID of the chapter to create the lesson in
|
|
383
|
+
|
|
384
|
+
lesson_type: The type of the lesson
|
|
385
|
+
|
|
386
|
+
content: The content of the lesson
|
|
387
|
+
|
|
388
|
+
days_from_course_start_until_unlock: Days from course start until unlock
|
|
389
|
+
|
|
390
|
+
title: The title of the lesson
|
|
391
|
+
|
|
392
|
+
extra_headers: Send extra headers
|
|
393
|
+
|
|
394
|
+
extra_query: Add additional query parameters to the request
|
|
395
|
+
|
|
396
|
+
extra_body: Add additional JSON properties to the request
|
|
397
|
+
|
|
398
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
399
|
+
"""
|
|
400
|
+
return await self._post(
|
|
401
|
+
"/course_lessons",
|
|
402
|
+
body=await async_maybe_transform(
|
|
403
|
+
{
|
|
404
|
+
"chapter_id": chapter_id,
|
|
405
|
+
"lesson_type": lesson_type,
|
|
406
|
+
"content": content,
|
|
407
|
+
"days_from_course_start_until_unlock": days_from_course_start_until_unlock,
|
|
408
|
+
"title": title,
|
|
409
|
+
},
|
|
410
|
+
course_lesson_create_params.CourseLessonCreateParams,
|
|
411
|
+
),
|
|
412
|
+
options=make_request_options(
|
|
413
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
414
|
+
),
|
|
415
|
+
cast_to=Lesson,
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
async def retrieve(
|
|
419
|
+
self,
|
|
420
|
+
id: str,
|
|
421
|
+
*,
|
|
422
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
423
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
424
|
+
extra_headers: Headers | None = None,
|
|
425
|
+
extra_query: Query | None = None,
|
|
426
|
+
extra_body: Body | None = None,
|
|
427
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
428
|
+
) -> Lesson:
|
|
429
|
+
"""
|
|
430
|
+
Retrieves a course lesson by ID
|
|
431
|
+
|
|
432
|
+
Required permissions:
|
|
433
|
+
|
|
434
|
+
- `courses:read`
|
|
435
|
+
|
|
436
|
+
Args:
|
|
437
|
+
extra_headers: Send extra headers
|
|
438
|
+
|
|
439
|
+
extra_query: Add additional query parameters to the request
|
|
440
|
+
|
|
441
|
+
extra_body: Add additional JSON properties to the request
|
|
442
|
+
|
|
443
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
444
|
+
"""
|
|
445
|
+
if not id:
|
|
446
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
447
|
+
return await self._get(
|
|
448
|
+
f"/course_lessons/{id}",
|
|
449
|
+
options=make_request_options(
|
|
450
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
451
|
+
),
|
|
452
|
+
cast_to=Lesson,
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
async def update(
|
|
456
|
+
self,
|
|
457
|
+
id: str,
|
|
458
|
+
*,
|
|
459
|
+
assessment_questions: Optional[Iterable[course_lesson_update_params.AssessmentQuestion]] | Omit = omit,
|
|
460
|
+
attachments: Optional[Iterable[course_lesson_update_params.Attachment]] | Omit = omit,
|
|
461
|
+
content: Optional[str] | Omit = omit,
|
|
462
|
+
days_from_course_start_until_unlock: Optional[int] | Omit = omit,
|
|
463
|
+
lesson_type: Optional[LessonTypes] | Omit = omit,
|
|
464
|
+
main_pdf: Optional[course_lesson_update_params.MainPdf] | Omit = omit,
|
|
465
|
+
mux_asset_id: Optional[str] | Omit = omit,
|
|
466
|
+
title: Optional[str] | Omit = omit,
|
|
467
|
+
visibility: Optional[LessonVisibilities] | Omit = omit,
|
|
468
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
469
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
470
|
+
extra_headers: Headers | None = None,
|
|
471
|
+
extra_query: Query | None = None,
|
|
472
|
+
extra_body: Body | None = None,
|
|
473
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
474
|
+
) -> Lesson:
|
|
475
|
+
"""
|
|
476
|
+
Updates a course lesson
|
|
477
|
+
|
|
478
|
+
Required permissions:
|
|
479
|
+
|
|
480
|
+
- `courses:update`
|
|
481
|
+
|
|
482
|
+
Args:
|
|
483
|
+
assessment_questions: Assessment questions for quiz/knowledge check lessons. Replaces all existing
|
|
484
|
+
questions.
|
|
485
|
+
|
|
486
|
+
attachments: General attachments for the lesson (PDFs, files, etc). Replaces all existing
|
|
487
|
+
attachments.
|
|
488
|
+
|
|
489
|
+
content: The content of the lesson
|
|
490
|
+
|
|
491
|
+
days_from_course_start_until_unlock: Days from course start until unlock
|
|
492
|
+
|
|
493
|
+
lesson_type: The available types for a lesson
|
|
494
|
+
|
|
495
|
+
main_pdf: The main PDF file for this lesson
|
|
496
|
+
|
|
497
|
+
mux_asset_id: The ID of the Mux asset to attach to this lesson for video lessons
|
|
498
|
+
|
|
499
|
+
title: The title of the lesson
|
|
500
|
+
|
|
501
|
+
visibility: The available visibilities for a lesson. Determines how / whether a lesson is
|
|
502
|
+
visible to users.
|
|
503
|
+
|
|
504
|
+
extra_headers: Send extra headers
|
|
505
|
+
|
|
506
|
+
extra_query: Add additional query parameters to the request
|
|
507
|
+
|
|
508
|
+
extra_body: Add additional JSON properties to the request
|
|
509
|
+
|
|
510
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
511
|
+
"""
|
|
512
|
+
if not id:
|
|
513
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
514
|
+
return await self._patch(
|
|
515
|
+
f"/course_lessons/{id}",
|
|
516
|
+
body=await async_maybe_transform(
|
|
517
|
+
{
|
|
518
|
+
"assessment_questions": assessment_questions,
|
|
519
|
+
"attachments": attachments,
|
|
520
|
+
"content": content,
|
|
521
|
+
"days_from_course_start_until_unlock": days_from_course_start_until_unlock,
|
|
522
|
+
"lesson_type": lesson_type,
|
|
523
|
+
"main_pdf": main_pdf,
|
|
524
|
+
"mux_asset_id": mux_asset_id,
|
|
525
|
+
"title": title,
|
|
526
|
+
"visibility": visibility,
|
|
527
|
+
},
|
|
528
|
+
course_lesson_update_params.CourseLessonUpdateParams,
|
|
529
|
+
),
|
|
530
|
+
options=make_request_options(
|
|
531
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
532
|
+
),
|
|
533
|
+
cast_to=Lesson,
|
|
534
|
+
)
|
|
535
|
+
|
|
536
|
+
def list(
|
|
537
|
+
self,
|
|
538
|
+
*,
|
|
539
|
+
after: Optional[str] | Omit = omit,
|
|
540
|
+
before: Optional[str] | Omit = omit,
|
|
541
|
+
chapter_id: Optional[str] | Omit = omit,
|
|
542
|
+
course_id: Optional[str] | Omit = omit,
|
|
543
|
+
first: Optional[int] | Omit = omit,
|
|
544
|
+
last: Optional[int] | Omit = omit,
|
|
545
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
546
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
547
|
+
extra_headers: Headers | None = None,
|
|
548
|
+
extra_query: Query | None = None,
|
|
549
|
+
extra_body: Body | None = None,
|
|
550
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
551
|
+
) -> AsyncPaginator[CourseLessonListResponse, AsyncCursorPage[CourseLessonListResponse]]:
|
|
552
|
+
"""
|
|
553
|
+
Lists lessons for a course or chapter
|
|
554
|
+
|
|
555
|
+
Required permissions:
|
|
556
|
+
|
|
557
|
+
- `courses:read`
|
|
558
|
+
|
|
559
|
+
Args:
|
|
560
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
561
|
+
|
|
562
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
563
|
+
|
|
564
|
+
chapter_id: The ID of the chapter (returns lessons only for this chapter)
|
|
565
|
+
|
|
566
|
+
course_id: The ID of the course (returns all lessons across all chapters)
|
|
567
|
+
|
|
568
|
+
first: Returns the first _n_ elements from the list.
|
|
569
|
+
|
|
570
|
+
last: Returns the last _n_ elements from the list.
|
|
571
|
+
|
|
572
|
+
extra_headers: Send extra headers
|
|
573
|
+
|
|
574
|
+
extra_query: Add additional query parameters to the request
|
|
575
|
+
|
|
576
|
+
extra_body: Add additional JSON properties to the request
|
|
577
|
+
|
|
578
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
579
|
+
"""
|
|
580
|
+
return self._get_api_list(
|
|
581
|
+
"/course_lessons",
|
|
582
|
+
page=AsyncCursorPage[CourseLessonListResponse],
|
|
583
|
+
options=make_request_options(
|
|
584
|
+
extra_headers=extra_headers,
|
|
585
|
+
extra_query=extra_query,
|
|
586
|
+
extra_body=extra_body,
|
|
587
|
+
timeout=timeout,
|
|
588
|
+
query=maybe_transform(
|
|
589
|
+
{
|
|
590
|
+
"after": after,
|
|
591
|
+
"before": before,
|
|
592
|
+
"chapter_id": chapter_id,
|
|
593
|
+
"course_id": course_id,
|
|
594
|
+
"first": first,
|
|
595
|
+
"last": last,
|
|
596
|
+
},
|
|
597
|
+
course_lesson_list_params.CourseLessonListParams,
|
|
598
|
+
),
|
|
599
|
+
),
|
|
600
|
+
model=CourseLessonListResponse,
|
|
601
|
+
)
|
|
602
|
+
|
|
603
|
+
async def delete(
|
|
604
|
+
self,
|
|
605
|
+
id: str,
|
|
606
|
+
*,
|
|
607
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
608
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
609
|
+
extra_headers: Headers | None = None,
|
|
610
|
+
extra_query: Query | None = None,
|
|
611
|
+
extra_body: Body | None = None,
|
|
612
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
613
|
+
) -> CourseLessonDeleteResponse:
|
|
614
|
+
"""
|
|
615
|
+
Deletes a course lesson
|
|
616
|
+
|
|
617
|
+
Required permissions:
|
|
618
|
+
|
|
619
|
+
- `courses:update`
|
|
620
|
+
|
|
621
|
+
Args:
|
|
622
|
+
extra_headers: Send extra headers
|
|
623
|
+
|
|
624
|
+
extra_query: Add additional query parameters to the request
|
|
625
|
+
|
|
626
|
+
extra_body: Add additional JSON properties to the request
|
|
627
|
+
|
|
628
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
629
|
+
"""
|
|
630
|
+
if not id:
|
|
631
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
632
|
+
return await self._delete(
|
|
633
|
+
f"/course_lessons/{id}",
|
|
634
|
+
options=make_request_options(
|
|
635
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
636
|
+
),
|
|
637
|
+
cast_to=CourseLessonDeleteResponse,
|
|
638
|
+
)
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
class CourseLessonsResourceWithRawResponse:
|
|
642
|
+
def __init__(self, course_lessons: CourseLessonsResource) -> None:
|
|
643
|
+
self._course_lessons = course_lessons
|
|
644
|
+
|
|
645
|
+
self.create = to_raw_response_wrapper(
|
|
646
|
+
course_lessons.create,
|
|
647
|
+
)
|
|
648
|
+
self.retrieve = to_raw_response_wrapper(
|
|
649
|
+
course_lessons.retrieve,
|
|
650
|
+
)
|
|
651
|
+
self.update = to_raw_response_wrapper(
|
|
652
|
+
course_lessons.update,
|
|
653
|
+
)
|
|
654
|
+
self.list = to_raw_response_wrapper(
|
|
655
|
+
course_lessons.list,
|
|
656
|
+
)
|
|
657
|
+
self.delete = to_raw_response_wrapper(
|
|
658
|
+
course_lessons.delete,
|
|
659
|
+
)
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
class AsyncCourseLessonsResourceWithRawResponse:
|
|
663
|
+
def __init__(self, course_lessons: AsyncCourseLessonsResource) -> None:
|
|
664
|
+
self._course_lessons = course_lessons
|
|
665
|
+
|
|
666
|
+
self.create = async_to_raw_response_wrapper(
|
|
667
|
+
course_lessons.create,
|
|
668
|
+
)
|
|
669
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
670
|
+
course_lessons.retrieve,
|
|
671
|
+
)
|
|
672
|
+
self.update = async_to_raw_response_wrapper(
|
|
673
|
+
course_lessons.update,
|
|
674
|
+
)
|
|
675
|
+
self.list = async_to_raw_response_wrapper(
|
|
676
|
+
course_lessons.list,
|
|
677
|
+
)
|
|
678
|
+
self.delete = async_to_raw_response_wrapper(
|
|
679
|
+
course_lessons.delete,
|
|
680
|
+
)
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
class CourseLessonsResourceWithStreamingResponse:
|
|
684
|
+
def __init__(self, course_lessons: CourseLessonsResource) -> None:
|
|
685
|
+
self._course_lessons = course_lessons
|
|
686
|
+
|
|
687
|
+
self.create = to_streamed_response_wrapper(
|
|
688
|
+
course_lessons.create,
|
|
689
|
+
)
|
|
690
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
691
|
+
course_lessons.retrieve,
|
|
692
|
+
)
|
|
693
|
+
self.update = to_streamed_response_wrapper(
|
|
694
|
+
course_lessons.update,
|
|
695
|
+
)
|
|
696
|
+
self.list = to_streamed_response_wrapper(
|
|
697
|
+
course_lessons.list,
|
|
698
|
+
)
|
|
699
|
+
self.delete = to_streamed_response_wrapper(
|
|
700
|
+
course_lessons.delete,
|
|
701
|
+
)
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
class AsyncCourseLessonsResourceWithStreamingResponse:
|
|
705
|
+
def __init__(self, course_lessons: AsyncCourseLessonsResource) -> None:
|
|
706
|
+
self._course_lessons = course_lessons
|
|
707
|
+
|
|
708
|
+
self.create = async_to_streamed_response_wrapper(
|
|
709
|
+
course_lessons.create,
|
|
710
|
+
)
|
|
711
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
712
|
+
course_lessons.retrieve,
|
|
713
|
+
)
|
|
714
|
+
self.update = async_to_streamed_response_wrapper(
|
|
715
|
+
course_lessons.update,
|
|
716
|
+
)
|
|
717
|
+
self.list = async_to_streamed_response_wrapper(
|
|
718
|
+
course_lessons.list,
|
|
719
|
+
)
|
|
720
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
721
|
+
course_lessons.delete,
|
|
722
|
+
)
|