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,602 @@
|
|
|
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 course_chapter_list_params, course_chapter_create_params, course_chapter_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_chapter import CourseChapter
|
|
23
|
+
from ..types.course_chapter_list_response import CourseChapterListResponse
|
|
24
|
+
from ..types.course_chapter_delete_response import CourseChapterDeleteResponse
|
|
25
|
+
|
|
26
|
+
__all__ = ["CourseChaptersResource", "AsyncCourseChaptersResource"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CourseChaptersResource(SyncAPIResource):
|
|
30
|
+
@cached_property
|
|
31
|
+
def with_raw_response(self) -> CourseChaptersResourceWithRawResponse:
|
|
32
|
+
"""
|
|
33
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
34
|
+
the raw response object instead of the parsed content.
|
|
35
|
+
|
|
36
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
37
|
+
"""
|
|
38
|
+
return CourseChaptersResourceWithRawResponse(self)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_streaming_response(self) -> CourseChaptersResourceWithStreamingResponse:
|
|
42
|
+
"""
|
|
43
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
44
|
+
|
|
45
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
46
|
+
"""
|
|
47
|
+
return CourseChaptersResourceWithStreamingResponse(self)
|
|
48
|
+
|
|
49
|
+
def create(
|
|
50
|
+
self,
|
|
51
|
+
*,
|
|
52
|
+
course_id: str,
|
|
53
|
+
title: Optional[str] | Omit = omit,
|
|
54
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
55
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
56
|
+
extra_headers: Headers | None = None,
|
|
57
|
+
extra_query: Query | None = None,
|
|
58
|
+
extra_body: Body | None = None,
|
|
59
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
60
|
+
) -> CourseChapter:
|
|
61
|
+
"""
|
|
62
|
+
Creates a new course chapter
|
|
63
|
+
|
|
64
|
+
Required permissions:
|
|
65
|
+
|
|
66
|
+
- `courses:update`
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
course_id: The ID of the course to create the chapter in
|
|
70
|
+
|
|
71
|
+
title: The title of the chapter
|
|
72
|
+
|
|
73
|
+
extra_headers: Send extra headers
|
|
74
|
+
|
|
75
|
+
extra_query: Add additional query parameters to the request
|
|
76
|
+
|
|
77
|
+
extra_body: Add additional JSON properties to the request
|
|
78
|
+
|
|
79
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
80
|
+
"""
|
|
81
|
+
return self._post(
|
|
82
|
+
"/course_chapters",
|
|
83
|
+
body=maybe_transform(
|
|
84
|
+
{
|
|
85
|
+
"course_id": course_id,
|
|
86
|
+
"title": title,
|
|
87
|
+
},
|
|
88
|
+
course_chapter_create_params.CourseChapterCreateParams,
|
|
89
|
+
),
|
|
90
|
+
options=make_request_options(
|
|
91
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
92
|
+
),
|
|
93
|
+
cast_to=CourseChapter,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
def retrieve(
|
|
97
|
+
self,
|
|
98
|
+
id: str,
|
|
99
|
+
*,
|
|
100
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
101
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
102
|
+
extra_headers: Headers | None = None,
|
|
103
|
+
extra_query: Query | None = None,
|
|
104
|
+
extra_body: Body | None = None,
|
|
105
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
106
|
+
) -> CourseChapter:
|
|
107
|
+
"""
|
|
108
|
+
Retrieves a course chapter by ID
|
|
109
|
+
|
|
110
|
+
Required permissions:
|
|
111
|
+
|
|
112
|
+
- `courses:read`
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
extra_headers: Send extra headers
|
|
116
|
+
|
|
117
|
+
extra_query: Add additional query parameters to the request
|
|
118
|
+
|
|
119
|
+
extra_body: Add additional JSON properties to the request
|
|
120
|
+
|
|
121
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
122
|
+
"""
|
|
123
|
+
if not id:
|
|
124
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
125
|
+
return self._get(
|
|
126
|
+
f"/course_chapters/{id}",
|
|
127
|
+
options=make_request_options(
|
|
128
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
129
|
+
),
|
|
130
|
+
cast_to=CourseChapter,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
def update(
|
|
134
|
+
self,
|
|
135
|
+
id: str,
|
|
136
|
+
*,
|
|
137
|
+
title: str,
|
|
138
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
139
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
140
|
+
extra_headers: Headers | None = None,
|
|
141
|
+
extra_query: Query | None = None,
|
|
142
|
+
extra_body: Body | None = None,
|
|
143
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
144
|
+
) -> CourseChapter:
|
|
145
|
+
"""
|
|
146
|
+
Updates a course chapter
|
|
147
|
+
|
|
148
|
+
Required permissions:
|
|
149
|
+
|
|
150
|
+
- `courses:update`
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
title: The title of the chapter
|
|
154
|
+
|
|
155
|
+
extra_headers: Send extra headers
|
|
156
|
+
|
|
157
|
+
extra_query: Add additional query parameters to the request
|
|
158
|
+
|
|
159
|
+
extra_body: Add additional JSON properties to the request
|
|
160
|
+
|
|
161
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
162
|
+
"""
|
|
163
|
+
if not id:
|
|
164
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
165
|
+
return self._patch(
|
|
166
|
+
f"/course_chapters/{id}",
|
|
167
|
+
body=maybe_transform({"title": title}, course_chapter_update_params.CourseChapterUpdateParams),
|
|
168
|
+
options=make_request_options(
|
|
169
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
170
|
+
),
|
|
171
|
+
cast_to=CourseChapter,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
def list(
|
|
175
|
+
self,
|
|
176
|
+
*,
|
|
177
|
+
course_id: str,
|
|
178
|
+
after: Optional[str] | Omit = omit,
|
|
179
|
+
before: Optional[str] | Omit = omit,
|
|
180
|
+
first: Optional[int] | Omit = omit,
|
|
181
|
+
last: Optional[int] | Omit = omit,
|
|
182
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
183
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
184
|
+
extra_headers: Headers | None = None,
|
|
185
|
+
extra_query: Query | None = None,
|
|
186
|
+
extra_body: Body | None = None,
|
|
187
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
188
|
+
) -> SyncCursorPage[CourseChapterListResponse]:
|
|
189
|
+
"""
|
|
190
|
+
Lists chapters for a course
|
|
191
|
+
|
|
192
|
+
Required permissions:
|
|
193
|
+
|
|
194
|
+
- `courses:read`
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
course_id: The ID of the course
|
|
198
|
+
|
|
199
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
200
|
+
|
|
201
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
202
|
+
|
|
203
|
+
first: Returns the first _n_ elements from the list.
|
|
204
|
+
|
|
205
|
+
last: Returns the last _n_ elements from the list.
|
|
206
|
+
|
|
207
|
+
extra_headers: Send extra headers
|
|
208
|
+
|
|
209
|
+
extra_query: Add additional query parameters to the request
|
|
210
|
+
|
|
211
|
+
extra_body: Add additional JSON properties to the request
|
|
212
|
+
|
|
213
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
214
|
+
"""
|
|
215
|
+
return self._get_api_list(
|
|
216
|
+
"/course_chapters",
|
|
217
|
+
page=SyncCursorPage[CourseChapterListResponse],
|
|
218
|
+
options=make_request_options(
|
|
219
|
+
extra_headers=extra_headers,
|
|
220
|
+
extra_query=extra_query,
|
|
221
|
+
extra_body=extra_body,
|
|
222
|
+
timeout=timeout,
|
|
223
|
+
query=maybe_transform(
|
|
224
|
+
{
|
|
225
|
+
"course_id": course_id,
|
|
226
|
+
"after": after,
|
|
227
|
+
"before": before,
|
|
228
|
+
"first": first,
|
|
229
|
+
"last": last,
|
|
230
|
+
},
|
|
231
|
+
course_chapter_list_params.CourseChapterListParams,
|
|
232
|
+
),
|
|
233
|
+
),
|
|
234
|
+
model=CourseChapterListResponse,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
def delete(
|
|
238
|
+
self,
|
|
239
|
+
id: str,
|
|
240
|
+
*,
|
|
241
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
242
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
243
|
+
extra_headers: Headers | None = None,
|
|
244
|
+
extra_query: Query | None = None,
|
|
245
|
+
extra_body: Body | None = None,
|
|
246
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
247
|
+
) -> CourseChapterDeleteResponse:
|
|
248
|
+
"""
|
|
249
|
+
Deletes a course chapter
|
|
250
|
+
|
|
251
|
+
Required permissions:
|
|
252
|
+
|
|
253
|
+
- `courses:update`
|
|
254
|
+
|
|
255
|
+
Args:
|
|
256
|
+
extra_headers: Send extra headers
|
|
257
|
+
|
|
258
|
+
extra_query: Add additional query parameters to the request
|
|
259
|
+
|
|
260
|
+
extra_body: Add additional JSON properties to the request
|
|
261
|
+
|
|
262
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
263
|
+
"""
|
|
264
|
+
if not id:
|
|
265
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
266
|
+
return self._delete(
|
|
267
|
+
f"/course_chapters/{id}",
|
|
268
|
+
options=make_request_options(
|
|
269
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
270
|
+
),
|
|
271
|
+
cast_to=CourseChapterDeleteResponse,
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class AsyncCourseChaptersResource(AsyncAPIResource):
|
|
276
|
+
@cached_property
|
|
277
|
+
def with_raw_response(self) -> AsyncCourseChaptersResourceWithRawResponse:
|
|
278
|
+
"""
|
|
279
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
280
|
+
the raw response object instead of the parsed content.
|
|
281
|
+
|
|
282
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#accessing-raw-response-data-eg-headers
|
|
283
|
+
"""
|
|
284
|
+
return AsyncCourseChaptersResourceWithRawResponse(self)
|
|
285
|
+
|
|
286
|
+
@cached_property
|
|
287
|
+
def with_streaming_response(self) -> AsyncCourseChaptersResourceWithStreamingResponse:
|
|
288
|
+
"""
|
|
289
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
290
|
+
|
|
291
|
+
For more information, see https://www.github.com/whopio/whopsdk-python#with_streaming_response
|
|
292
|
+
"""
|
|
293
|
+
return AsyncCourseChaptersResourceWithStreamingResponse(self)
|
|
294
|
+
|
|
295
|
+
async def create(
|
|
296
|
+
self,
|
|
297
|
+
*,
|
|
298
|
+
course_id: str,
|
|
299
|
+
title: Optional[str] | Omit = omit,
|
|
300
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
301
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
302
|
+
extra_headers: Headers | None = None,
|
|
303
|
+
extra_query: Query | None = None,
|
|
304
|
+
extra_body: Body | None = None,
|
|
305
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
306
|
+
) -> CourseChapter:
|
|
307
|
+
"""
|
|
308
|
+
Creates a new course chapter
|
|
309
|
+
|
|
310
|
+
Required permissions:
|
|
311
|
+
|
|
312
|
+
- `courses:update`
|
|
313
|
+
|
|
314
|
+
Args:
|
|
315
|
+
course_id: The ID of the course to create the chapter in
|
|
316
|
+
|
|
317
|
+
title: The title of the chapter
|
|
318
|
+
|
|
319
|
+
extra_headers: Send extra headers
|
|
320
|
+
|
|
321
|
+
extra_query: Add additional query parameters to the request
|
|
322
|
+
|
|
323
|
+
extra_body: Add additional JSON properties to the request
|
|
324
|
+
|
|
325
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
326
|
+
"""
|
|
327
|
+
return await self._post(
|
|
328
|
+
"/course_chapters",
|
|
329
|
+
body=await async_maybe_transform(
|
|
330
|
+
{
|
|
331
|
+
"course_id": course_id,
|
|
332
|
+
"title": title,
|
|
333
|
+
},
|
|
334
|
+
course_chapter_create_params.CourseChapterCreateParams,
|
|
335
|
+
),
|
|
336
|
+
options=make_request_options(
|
|
337
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
338
|
+
),
|
|
339
|
+
cast_to=CourseChapter,
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
async def retrieve(
|
|
343
|
+
self,
|
|
344
|
+
id: str,
|
|
345
|
+
*,
|
|
346
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
347
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
348
|
+
extra_headers: Headers | None = None,
|
|
349
|
+
extra_query: Query | None = None,
|
|
350
|
+
extra_body: Body | None = None,
|
|
351
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
352
|
+
) -> CourseChapter:
|
|
353
|
+
"""
|
|
354
|
+
Retrieves a course chapter by ID
|
|
355
|
+
|
|
356
|
+
Required permissions:
|
|
357
|
+
|
|
358
|
+
- `courses:read`
|
|
359
|
+
|
|
360
|
+
Args:
|
|
361
|
+
extra_headers: Send extra headers
|
|
362
|
+
|
|
363
|
+
extra_query: Add additional query parameters to the request
|
|
364
|
+
|
|
365
|
+
extra_body: Add additional JSON properties to the request
|
|
366
|
+
|
|
367
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
368
|
+
"""
|
|
369
|
+
if not id:
|
|
370
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
371
|
+
return await self._get(
|
|
372
|
+
f"/course_chapters/{id}",
|
|
373
|
+
options=make_request_options(
|
|
374
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
375
|
+
),
|
|
376
|
+
cast_to=CourseChapter,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
async def update(
|
|
380
|
+
self,
|
|
381
|
+
id: str,
|
|
382
|
+
*,
|
|
383
|
+
title: str,
|
|
384
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
385
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
386
|
+
extra_headers: Headers | None = None,
|
|
387
|
+
extra_query: Query | None = None,
|
|
388
|
+
extra_body: Body | None = None,
|
|
389
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
390
|
+
) -> CourseChapter:
|
|
391
|
+
"""
|
|
392
|
+
Updates a course chapter
|
|
393
|
+
|
|
394
|
+
Required permissions:
|
|
395
|
+
|
|
396
|
+
- `courses:update`
|
|
397
|
+
|
|
398
|
+
Args:
|
|
399
|
+
title: The title of the chapter
|
|
400
|
+
|
|
401
|
+
extra_headers: Send extra headers
|
|
402
|
+
|
|
403
|
+
extra_query: Add additional query parameters to the request
|
|
404
|
+
|
|
405
|
+
extra_body: Add additional JSON properties to the request
|
|
406
|
+
|
|
407
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
408
|
+
"""
|
|
409
|
+
if not id:
|
|
410
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
411
|
+
return await self._patch(
|
|
412
|
+
f"/course_chapters/{id}",
|
|
413
|
+
body=await async_maybe_transform({"title": title}, course_chapter_update_params.CourseChapterUpdateParams),
|
|
414
|
+
options=make_request_options(
|
|
415
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
416
|
+
),
|
|
417
|
+
cast_to=CourseChapter,
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
def list(
|
|
421
|
+
self,
|
|
422
|
+
*,
|
|
423
|
+
course_id: str,
|
|
424
|
+
after: Optional[str] | Omit = omit,
|
|
425
|
+
before: Optional[str] | Omit = omit,
|
|
426
|
+
first: Optional[int] | Omit = omit,
|
|
427
|
+
last: Optional[int] | Omit = omit,
|
|
428
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
429
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
430
|
+
extra_headers: Headers | None = None,
|
|
431
|
+
extra_query: Query | None = None,
|
|
432
|
+
extra_body: Body | None = None,
|
|
433
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
434
|
+
) -> AsyncPaginator[CourseChapterListResponse, AsyncCursorPage[CourseChapterListResponse]]:
|
|
435
|
+
"""
|
|
436
|
+
Lists chapters for a course
|
|
437
|
+
|
|
438
|
+
Required permissions:
|
|
439
|
+
|
|
440
|
+
- `courses:read`
|
|
441
|
+
|
|
442
|
+
Args:
|
|
443
|
+
course_id: The ID of the course
|
|
444
|
+
|
|
445
|
+
after: Returns the elements in the list that come after the specified cursor.
|
|
446
|
+
|
|
447
|
+
before: Returns the elements in the list that come before the specified cursor.
|
|
448
|
+
|
|
449
|
+
first: Returns the first _n_ elements from the list.
|
|
450
|
+
|
|
451
|
+
last: Returns the last _n_ elements from the list.
|
|
452
|
+
|
|
453
|
+
extra_headers: Send extra headers
|
|
454
|
+
|
|
455
|
+
extra_query: Add additional query parameters to the request
|
|
456
|
+
|
|
457
|
+
extra_body: Add additional JSON properties to the request
|
|
458
|
+
|
|
459
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
460
|
+
"""
|
|
461
|
+
return self._get_api_list(
|
|
462
|
+
"/course_chapters",
|
|
463
|
+
page=AsyncCursorPage[CourseChapterListResponse],
|
|
464
|
+
options=make_request_options(
|
|
465
|
+
extra_headers=extra_headers,
|
|
466
|
+
extra_query=extra_query,
|
|
467
|
+
extra_body=extra_body,
|
|
468
|
+
timeout=timeout,
|
|
469
|
+
query=maybe_transform(
|
|
470
|
+
{
|
|
471
|
+
"course_id": course_id,
|
|
472
|
+
"after": after,
|
|
473
|
+
"before": before,
|
|
474
|
+
"first": first,
|
|
475
|
+
"last": last,
|
|
476
|
+
},
|
|
477
|
+
course_chapter_list_params.CourseChapterListParams,
|
|
478
|
+
),
|
|
479
|
+
),
|
|
480
|
+
model=CourseChapterListResponse,
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
async def delete(
|
|
484
|
+
self,
|
|
485
|
+
id: str,
|
|
486
|
+
*,
|
|
487
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
488
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
489
|
+
extra_headers: Headers | None = None,
|
|
490
|
+
extra_query: Query | None = None,
|
|
491
|
+
extra_body: Body | None = None,
|
|
492
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
493
|
+
) -> CourseChapterDeleteResponse:
|
|
494
|
+
"""
|
|
495
|
+
Deletes a course chapter
|
|
496
|
+
|
|
497
|
+
Required permissions:
|
|
498
|
+
|
|
499
|
+
- `courses:update`
|
|
500
|
+
|
|
501
|
+
Args:
|
|
502
|
+
extra_headers: Send extra headers
|
|
503
|
+
|
|
504
|
+
extra_query: Add additional query parameters to the request
|
|
505
|
+
|
|
506
|
+
extra_body: Add additional JSON properties to the request
|
|
507
|
+
|
|
508
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
509
|
+
"""
|
|
510
|
+
if not id:
|
|
511
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
512
|
+
return await self._delete(
|
|
513
|
+
f"/course_chapters/{id}",
|
|
514
|
+
options=make_request_options(
|
|
515
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
516
|
+
),
|
|
517
|
+
cast_to=CourseChapterDeleteResponse,
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
class CourseChaptersResourceWithRawResponse:
|
|
522
|
+
def __init__(self, course_chapters: CourseChaptersResource) -> None:
|
|
523
|
+
self._course_chapters = course_chapters
|
|
524
|
+
|
|
525
|
+
self.create = to_raw_response_wrapper(
|
|
526
|
+
course_chapters.create,
|
|
527
|
+
)
|
|
528
|
+
self.retrieve = to_raw_response_wrapper(
|
|
529
|
+
course_chapters.retrieve,
|
|
530
|
+
)
|
|
531
|
+
self.update = to_raw_response_wrapper(
|
|
532
|
+
course_chapters.update,
|
|
533
|
+
)
|
|
534
|
+
self.list = to_raw_response_wrapper(
|
|
535
|
+
course_chapters.list,
|
|
536
|
+
)
|
|
537
|
+
self.delete = to_raw_response_wrapper(
|
|
538
|
+
course_chapters.delete,
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
class AsyncCourseChaptersResourceWithRawResponse:
|
|
543
|
+
def __init__(self, course_chapters: AsyncCourseChaptersResource) -> None:
|
|
544
|
+
self._course_chapters = course_chapters
|
|
545
|
+
|
|
546
|
+
self.create = async_to_raw_response_wrapper(
|
|
547
|
+
course_chapters.create,
|
|
548
|
+
)
|
|
549
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
550
|
+
course_chapters.retrieve,
|
|
551
|
+
)
|
|
552
|
+
self.update = async_to_raw_response_wrapper(
|
|
553
|
+
course_chapters.update,
|
|
554
|
+
)
|
|
555
|
+
self.list = async_to_raw_response_wrapper(
|
|
556
|
+
course_chapters.list,
|
|
557
|
+
)
|
|
558
|
+
self.delete = async_to_raw_response_wrapper(
|
|
559
|
+
course_chapters.delete,
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
class CourseChaptersResourceWithStreamingResponse:
|
|
564
|
+
def __init__(self, course_chapters: CourseChaptersResource) -> None:
|
|
565
|
+
self._course_chapters = course_chapters
|
|
566
|
+
|
|
567
|
+
self.create = to_streamed_response_wrapper(
|
|
568
|
+
course_chapters.create,
|
|
569
|
+
)
|
|
570
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
571
|
+
course_chapters.retrieve,
|
|
572
|
+
)
|
|
573
|
+
self.update = to_streamed_response_wrapper(
|
|
574
|
+
course_chapters.update,
|
|
575
|
+
)
|
|
576
|
+
self.list = to_streamed_response_wrapper(
|
|
577
|
+
course_chapters.list,
|
|
578
|
+
)
|
|
579
|
+
self.delete = to_streamed_response_wrapper(
|
|
580
|
+
course_chapters.delete,
|
|
581
|
+
)
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
class AsyncCourseChaptersResourceWithStreamingResponse:
|
|
585
|
+
def __init__(self, course_chapters: AsyncCourseChaptersResource) -> None:
|
|
586
|
+
self._course_chapters = course_chapters
|
|
587
|
+
|
|
588
|
+
self.create = async_to_streamed_response_wrapper(
|
|
589
|
+
course_chapters.create,
|
|
590
|
+
)
|
|
591
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
592
|
+
course_chapters.retrieve,
|
|
593
|
+
)
|
|
594
|
+
self.update = async_to_streamed_response_wrapper(
|
|
595
|
+
course_chapters.update,
|
|
596
|
+
)
|
|
597
|
+
self.list = async_to_streamed_response_wrapper(
|
|
598
|
+
course_chapters.list,
|
|
599
|
+
)
|
|
600
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
601
|
+
course_chapters.delete,
|
|
602
|
+
)
|