@whop/sdk 0.0.2 → 0.0.4

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.
Files changed (196) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/client.d.mts +30 -12
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +30 -12
  5. package/client.d.ts.map +1 -1
  6. package/client.js +19 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +21 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/app-builds.d.mts +16 -13
  12. package/resources/app-builds.d.mts.map +1 -1
  13. package/resources/app-builds.d.ts +16 -13
  14. package/resources/app-builds.d.ts.map +1 -1
  15. package/resources/app-builds.js +1 -1
  16. package/resources/app-builds.mjs +1 -1
  17. package/resources/apps.d.mts +15 -10
  18. package/resources/apps.d.mts.map +1 -1
  19. package/resources/apps.d.ts +15 -10
  20. package/resources/apps.d.ts.map +1 -1
  21. package/resources/checkout-configurations.d.mts +252 -140
  22. package/resources/checkout-configurations.d.mts.map +1 -1
  23. package/resources/checkout-configurations.d.ts +252 -140
  24. package/resources/checkout-configurations.d.ts.map +1 -1
  25. package/resources/checkout-configurations.js +6 -20
  26. package/resources/checkout-configurations.js.map +1 -1
  27. package/resources/checkout-configurations.mjs +6 -20
  28. package/resources/checkout-configurations.mjs.map +1 -1
  29. package/resources/companies.d.mts +157 -0
  30. package/resources/companies.d.mts.map +1 -1
  31. package/resources/companies.d.ts +157 -0
  32. package/resources/companies.d.ts.map +1 -1
  33. package/resources/companies.js +22 -0
  34. package/resources/companies.js.map +1 -1
  35. package/resources/companies.mjs +22 -0
  36. package/resources/companies.mjs.map +1 -1
  37. package/resources/course-chapters.d.mts +185 -0
  38. package/resources/course-chapters.d.mts.map +1 -0
  39. package/resources/course-chapters.d.ts +185 -0
  40. package/resources/course-chapters.d.ts.map +1 -0
  41. package/resources/course-chapters.js +103 -0
  42. package/resources/course-chapters.js.map +1 -0
  43. package/resources/course-chapters.mjs +99 -0
  44. package/resources/course-chapters.mjs.map +1 -0
  45. package/resources/course-lesson-interactions.d.mts +2 -2
  46. package/resources/course-lesson-interactions.d.ts +2 -2
  47. package/resources/course-lesson-interactions.js +2 -2
  48. package/resources/course-lesson-interactions.mjs +2 -2
  49. package/resources/course-lessons.d.mts +563 -0
  50. package/resources/course-lessons.d.mts.map +1 -0
  51. package/resources/course-lessons.d.ts +563 -0
  52. package/resources/course-lessons.d.ts.map +1 -0
  53. package/resources/course-lessons.js +101 -0
  54. package/resources/course-lessons.js.map +1 -0
  55. package/resources/course-lessons.mjs +97 -0
  56. package/resources/course-lessons.mjs.map +1 -0
  57. package/resources/course-students.d.mts +187 -0
  58. package/resources/course-students.d.mts.map +1 -0
  59. package/resources/course-students.d.ts +187 -0
  60. package/resources/course-students.d.ts.map +1 -0
  61. package/resources/course-students.js +36 -0
  62. package/resources/course-students.js.map +1 -0
  63. package/resources/course-students.mjs +32 -0
  64. package/resources/course-students.mjs.map +1 -0
  65. package/resources/courses.d.mts +485 -0
  66. package/resources/courses.d.mts.map +1 -0
  67. package/resources/courses.d.ts +485 -0
  68. package/resources/courses.d.ts.map +1 -0
  69. package/resources/courses.js +98 -0
  70. package/resources/courses.js.map +1 -0
  71. package/resources/courses.mjs +94 -0
  72. package/resources/courses.mjs.map +1 -0
  73. package/resources/experiences.d.mts +42 -11
  74. package/resources/experiences.d.mts.map +1 -1
  75. package/resources/experiences.d.ts +42 -11
  76. package/resources/experiences.d.ts.map +1 -1
  77. package/resources/experiences.js +22 -0
  78. package/resources/experiences.js.map +1 -1
  79. package/resources/experiences.mjs +22 -0
  80. package/resources/experiences.mjs.map +1 -1
  81. package/resources/forum-posts.d.mts +75 -10
  82. package/resources/forum-posts.d.mts.map +1 -1
  83. package/resources/forum-posts.d.ts +75 -10
  84. package/resources/forum-posts.d.ts.map +1 -1
  85. package/resources/forum-posts.js +11 -0
  86. package/resources/forum-posts.js.map +1 -1
  87. package/resources/forum-posts.mjs +11 -0
  88. package/resources/forum-posts.mjs.map +1 -1
  89. package/resources/index.d.mts +12 -6
  90. package/resources/index.d.mts.map +1 -1
  91. package/resources/index.d.ts +12 -6
  92. package/resources/index.d.ts.map +1 -1
  93. package/resources/index.js +13 -1
  94. package/resources/index.js.map +1 -1
  95. package/resources/index.mjs +7 -1
  96. package/resources/index.mjs.map +1 -1
  97. package/resources/invoices.d.mts +529 -146
  98. package/resources/invoices.d.mts.map +1 -1
  99. package/resources/invoices.d.ts +529 -146
  100. package/resources/invoices.d.ts.map +1 -1
  101. package/resources/invoices.js +2 -24
  102. package/resources/invoices.js.map +1 -1
  103. package/resources/invoices.mjs +2 -24
  104. package/resources/invoices.mjs.map +1 -1
  105. package/resources/ledger-accounts.d.mts +1 -1
  106. package/resources/ledger-accounts.d.mts.map +1 -1
  107. package/resources/ledger-accounts.d.ts +1 -1
  108. package/resources/ledger-accounts.d.ts.map +1 -1
  109. package/resources/members.d.mts +4 -0
  110. package/resources/members.d.mts.map +1 -1
  111. package/resources/members.d.ts +4 -0
  112. package/resources/members.d.ts.map +1 -1
  113. package/resources/memberships.d.mts +26 -5
  114. package/resources/memberships.d.mts.map +1 -1
  115. package/resources/memberships.d.ts +26 -5
  116. package/resources/memberships.d.ts.map +1 -1
  117. package/resources/memberships.js +1 -1
  118. package/resources/memberships.js.map +1 -1
  119. package/resources/memberships.mjs +1 -1
  120. package/resources/memberships.mjs.map +1 -1
  121. package/resources/messages.d.mts +57 -10
  122. package/resources/messages.d.mts.map +1 -1
  123. package/resources/messages.d.ts +57 -10
  124. package/resources/messages.d.ts.map +1 -1
  125. package/resources/messages.js +6 -0
  126. package/resources/messages.js.map +1 -1
  127. package/resources/messages.mjs +6 -0
  128. package/resources/messages.mjs.map +1 -1
  129. package/resources/payments.d.mts +35 -13
  130. package/resources/payments.d.mts.map +1 -1
  131. package/resources/payments.d.ts +35 -13
  132. package/resources/payments.d.ts.map +1 -1
  133. package/resources/plans.d.mts +161 -17
  134. package/resources/plans.d.mts.map +1 -1
  135. package/resources/plans.d.ts +161 -17
  136. package/resources/plans.d.ts.map +1 -1
  137. package/resources/plans.js.map +1 -1
  138. package/resources/plans.mjs.map +1 -1
  139. package/resources/products.d.mts +30 -33
  140. package/resources/products.d.mts.map +1 -1
  141. package/resources/products.d.ts +30 -33
  142. package/resources/products.d.ts.map +1 -1
  143. package/resources/promo-codes.d.mts +394 -0
  144. package/resources/promo-codes.d.mts.map +1 -0
  145. package/resources/promo-codes.d.ts +394 -0
  146. package/resources/promo-codes.d.ts.map +1 -0
  147. package/resources/promo-codes.js +91 -0
  148. package/resources/promo-codes.js.map +1 -0
  149. package/resources/promo-codes.mjs +87 -0
  150. package/resources/promo-codes.mjs.map +1 -0
  151. package/resources/reviews.d.mts +277 -0
  152. package/resources/reviews.d.mts.map +1 -0
  153. package/resources/reviews.d.ts +277 -0
  154. package/resources/reviews.d.ts.map +1 -0
  155. package/resources/reviews.js +23 -0
  156. package/resources/reviews.js.map +1 -0
  157. package/resources/reviews.mjs +19 -0
  158. package/resources/reviews.mjs.map +1 -0
  159. package/resources/shared.d.mts +117 -14
  160. package/resources/shared.d.mts.map +1 -1
  161. package/resources/shared.d.ts +117 -14
  162. package/resources/shared.d.ts.map +1 -1
  163. package/resources/transfers.d.mts +12 -0
  164. package/resources/transfers.d.mts.map +1 -1
  165. package/resources/transfers.d.ts +12 -0
  166. package/resources/transfers.d.ts.map +1 -1
  167. package/src/client.ts +166 -11
  168. package/src/resources/app-builds.ts +19 -14
  169. package/src/resources/apps.ts +16 -11
  170. package/src/resources/checkout-configurations.ts +278 -143
  171. package/src/resources/companies.ts +196 -0
  172. package/src/resources/course-chapters.ts +236 -0
  173. package/src/resources/course-lesson-interactions.ts +2 -2
  174. package/src/resources/course-lessons.ts +699 -0
  175. package/src/resources/course-students.ts +238 -0
  176. package/src/resources/courses.ts +622 -0
  177. package/src/resources/experiences.ts +54 -11
  178. package/src/resources/forum-posts.ts +95 -10
  179. package/src/resources/index.ts +73 -2
  180. package/src/resources/invoices.ts +620 -149
  181. package/src/resources/ledger-accounts.ts +13 -1
  182. package/src/resources/members.ts +5 -0
  183. package/src/resources/memberships.ts +31 -6
  184. package/src/resources/messages.ts +74 -10
  185. package/src/resources/payments.ts +146 -19
  186. package/src/resources/plans.ts +184 -17
  187. package/src/resources/products.ts +36 -37
  188. package/src/resources/promo-codes.ts +490 -0
  189. package/src/resources/reviews.ts +348 -0
  190. package/src/resources/shared.ts +128 -14
  191. package/src/resources/transfers.ts +10 -0
  192. package/src/version.ts +1 -1
  193. package/version.d.mts +1 -1
  194. package/version.d.ts +1 -1
  195. package/version.js +1 -1
  196. package/version.mjs +1 -1
@@ -0,0 +1,622 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as CourseLessonsAPI from './course-lessons';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { CursorPage, type CursorPageParams, PagePromise } from '../core/pagination';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { path } from '../internal/utils/path';
9
+
10
+ export class Courses extends APIResource {
11
+ /**
12
+ * Creates a new course module in an experience
13
+ *
14
+ * Required permissions:
15
+ *
16
+ * - `courses:update`
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const course = await client.courses.create({
21
+ * experience_id: 'exp_xxxxxxxxxxxxxx',
22
+ * title: 'title',
23
+ * });
24
+ * ```
25
+ */
26
+ create(body: CourseCreateParams, options?: RequestOptions): APIPromise<Course> {
27
+ return this._client.post('/courses', { body, ...options });
28
+ }
29
+
30
+ /**
31
+ * Retrieves a course by ID
32
+ *
33
+ * Required permissions:
34
+ *
35
+ * - `courses:read`
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * const course = await client.courses.retrieve(
40
+ * 'cors_xxxxxxxxxxxxx',
41
+ * );
42
+ * ```
43
+ */
44
+ retrieve(id: string, options?: RequestOptions): APIPromise<Course> {
45
+ return this._client.get(path`/courses/${id}`, options);
46
+ }
47
+
48
+ /**
49
+ * Updates a course
50
+ *
51
+ * Required permissions:
52
+ *
53
+ * - `courses:update`
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const course = await client.courses.update(
58
+ * 'cors_xxxxxxxxxxxxx',
59
+ * );
60
+ * ```
61
+ */
62
+ update(
63
+ id: string,
64
+ body: CourseUpdateParams | null | undefined = {},
65
+ options?: RequestOptions,
66
+ ): APIPromise<Course> {
67
+ return this._client.patch(path`/courses/${id}`, { body, ...options });
68
+ }
69
+
70
+ /**
71
+ * Lists courses for an experience or company
72
+ *
73
+ * Required permissions:
74
+ *
75
+ * - `courses:read`
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * // Automatically fetches more pages as needed.
80
+ * for await (const courseListResponse of client.courses.list()) {
81
+ * // ...
82
+ * }
83
+ * ```
84
+ */
85
+ list(
86
+ query: CourseListParams | null | undefined = {},
87
+ options?: RequestOptions,
88
+ ): PagePromise<CourseListResponsesCursorPage, CourseListResponse> {
89
+ return this._client.getAPIList('/courses', CursorPage<CourseListResponse>, { query, ...options });
90
+ }
91
+
92
+ /**
93
+ * Deletes a course
94
+ *
95
+ * Required permissions:
96
+ *
97
+ * - `courses:update`
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const course = await client.courses.delete(
102
+ * 'cors_xxxxxxxxxxxxx',
103
+ * );
104
+ * ```
105
+ */
106
+ delete(id: string, options?: RequestOptions): APIPromise<CourseDeleteResponse> {
107
+ return this._client.delete(path`/courses/${id}`, options);
108
+ }
109
+ }
110
+
111
+ export type CourseListResponsesCursorPage = CursorPage<CourseListResponse>;
112
+
113
+ /**
114
+ * A course from the courses app
115
+ */
116
+ export interface Course {
117
+ /**
118
+ * The ID of the course. Looks like cors_XXX
119
+ */
120
+ id: string;
121
+
122
+ /**
123
+ * Whether the course will award its students a PDF certificate after completing
124
+ * all lessons
125
+ */
126
+ certificate_after_completion_enabled: boolean | null;
127
+
128
+ /**
129
+ * The chapters in this course
130
+ */
131
+ chapters: Array<Course.Chapter>;
132
+
133
+ /**
134
+ * The timestamp of when the course was created
135
+ */
136
+ created_at: string;
137
+
138
+ /**
139
+ * A short description of the course
140
+ */
141
+ description: string | null;
142
+
143
+ /**
144
+ * The language spoken in the video content of the course, used to generate closed
145
+ * captions in the right language
146
+ */
147
+ language: Languages;
148
+
149
+ /**
150
+ * Whether the course requires students to complete the previous lesson before
151
+ * moving on to the next one
152
+ */
153
+ require_completing_lessons_in_order: boolean;
154
+
155
+ /**
156
+ * A short tagline for the course. It is displayed under the course title in the UI
157
+ */
158
+ tagline: string | null;
159
+
160
+ /**
161
+ * The thumbnail for the course
162
+ */
163
+ thumbnail: Course.Thumbnail | null;
164
+
165
+ /**
166
+ * The title of the course
167
+ */
168
+ title: string | null;
169
+
170
+ /**
171
+ * The timestamp of when the course was last updated
172
+ */
173
+ updated_at: string;
174
+ }
175
+
176
+ export namespace Course {
177
+ /**
178
+ * A chapter from the courses app
179
+ */
180
+ export interface Chapter {
181
+ /**
182
+ * The ID of the chapter. Looks like chap_XXX
183
+ */
184
+ id: string;
185
+
186
+ /**
187
+ * The lessons in this chapter
188
+ */
189
+ lessons: Array<Chapter.Lesson>;
190
+
191
+ /**
192
+ * The order of the chapter within its course
193
+ */
194
+ order: number;
195
+
196
+ /**
197
+ * The title of the chapter
198
+ */
199
+ title: string;
200
+ }
201
+
202
+ export namespace Chapter {
203
+ /**
204
+ * A lesson from the courses app
205
+ */
206
+ export interface Lesson {
207
+ /**
208
+ * The ID of the lesson
209
+ */
210
+ id: string;
211
+
212
+ /**
213
+ * The type of the lesson (text, video, pdf, multi, quiz, knowledge_check)
214
+ */
215
+ lesson_type: CourseLessonsAPI.LessonTypes;
216
+
217
+ /**
218
+ * The order of the lesson within its chapter
219
+ */
220
+ order: number;
221
+
222
+ /**
223
+ * The title of the lesson
224
+ */
225
+ title: string;
226
+ }
227
+ }
228
+
229
+ /**
230
+ * The thumbnail for the course
231
+ */
232
+ export interface Thumbnail {
233
+ /**
234
+ * The ID of the attachment
235
+ */
236
+ id: string;
237
+
238
+ /**
239
+ * The attachment's content type (e.g., image/jpg, video/mp4)
240
+ */
241
+ content_type: string | null;
242
+
243
+ /**
244
+ * The name of the file
245
+ */
246
+ filename: string | null;
247
+
248
+ /**
249
+ * This is the URL you use to render optimized attachments on the client. This
250
+ * should be used for apps.
251
+ */
252
+ optimized_url: string | null;
253
+
254
+ /**
255
+ * The original URL of the attachment, such as a direct link to S3. This should
256
+ * never be displayed on the client and always passed to an Imgproxy transformer.
257
+ */
258
+ source_url: string | null;
259
+ }
260
+ }
261
+
262
+ /**
263
+ * The available languages for a course
264
+ */
265
+ export type Languages =
266
+ | 'en'
267
+ | 'es'
268
+ | 'it'
269
+ | 'pt'
270
+ | 'de'
271
+ | 'fr'
272
+ | 'pl'
273
+ | 'ru'
274
+ | 'nl'
275
+ | 'ca'
276
+ | 'tr'
277
+ | 'sv'
278
+ | 'uk'
279
+ | 'no'
280
+ | 'fi'
281
+ | 'sk'
282
+ | 'el'
283
+ | 'cs'
284
+ | 'hr'
285
+ | 'da'
286
+ | 'ro'
287
+ | 'bg';
288
+
289
+ /**
290
+ * A course from the courses app
291
+ */
292
+ export interface CourseListResponse {
293
+ /**
294
+ * The ID of the course. Looks like cors_XXX
295
+ */
296
+ id: string;
297
+
298
+ /**
299
+ * Whether the course will award its students a PDF certificate after completing
300
+ * all lessons
301
+ */
302
+ certificate_after_completion_enabled: boolean | null;
303
+
304
+ /**
305
+ * The timestamp of when the course was created
306
+ */
307
+ created_at: string;
308
+
309
+ /**
310
+ * A short description of the course
311
+ */
312
+ description: string | null;
313
+
314
+ /**
315
+ * The language spoken in the video content of the course, used to generate closed
316
+ * captions in the right language
317
+ */
318
+ language: Languages;
319
+
320
+ /**
321
+ * Whether the course requires students to complete the previous lesson before
322
+ * moving on to the next one
323
+ */
324
+ require_completing_lessons_in_order: boolean;
325
+
326
+ /**
327
+ * A short tagline for the course. It is displayed under the course title in the UI
328
+ */
329
+ tagline: string | null;
330
+
331
+ /**
332
+ * The thumbnail for the course
333
+ */
334
+ thumbnail: CourseListResponse.Thumbnail | null;
335
+
336
+ /**
337
+ * The title of the course
338
+ */
339
+ title: string | null;
340
+
341
+ /**
342
+ * The timestamp of when the course was last updated
343
+ */
344
+ updated_at: string;
345
+ }
346
+
347
+ export namespace CourseListResponse {
348
+ /**
349
+ * The thumbnail for the course
350
+ */
351
+ export interface Thumbnail {
352
+ /**
353
+ * The ID of the attachment
354
+ */
355
+ id: string;
356
+
357
+ /**
358
+ * The attachment's content type (e.g., image/jpg, video/mp4)
359
+ */
360
+ content_type: string | null;
361
+
362
+ /**
363
+ * The name of the file
364
+ */
365
+ filename: string | null;
366
+
367
+ /**
368
+ * This is the URL you use to render optimized attachments on the client. This
369
+ * should be used for apps.
370
+ */
371
+ optimized_url: string | null;
372
+
373
+ /**
374
+ * The original URL of the attachment, such as a direct link to S3. This should
375
+ * never be displayed on the client and always passed to an Imgproxy transformer.
376
+ */
377
+ source_url: string | null;
378
+ }
379
+ }
380
+
381
+ /**
382
+ * Represents `true` or `false` values.
383
+ */
384
+ export type CourseDeleteResponse = boolean;
385
+
386
+ export interface CourseCreateParams {
387
+ /**
388
+ * The ID of the experience to create the course in
389
+ */
390
+ experience_id: string;
391
+
392
+ /**
393
+ * The title of the course
394
+ */
395
+ title: string;
396
+
397
+ /**
398
+ * Whether the course will award its students a PDF certificate after completing
399
+ * all lessons
400
+ */
401
+ certificate_after_completion_enabled?: boolean | null;
402
+
403
+ /**
404
+ * The cover image URL of the course
405
+ */
406
+ cover_image?: string | null;
407
+
408
+ /**
409
+ * Whether the course requires students to complete the previous lesson before
410
+ * moving on to the next one
411
+ */
412
+ require_completing_lessons_in_order?: boolean | null;
413
+
414
+ /**
415
+ * The tagline of the course
416
+ */
417
+ tagline?: string | null;
418
+
419
+ /**
420
+ * The thumbnail for the course in png, jpeg, or gif format
421
+ */
422
+ thumbnail?:
423
+ | CourseCreateParams.AttachmentInputWithDirectUploadID
424
+ | CourseCreateParams.AttachmentInputWithID
425
+ | null;
426
+ }
427
+
428
+ export namespace CourseCreateParams {
429
+ /**
430
+ * Input for an attachment
431
+ */
432
+ export interface AttachmentInputWithDirectUploadID {
433
+ /**
434
+ * This ID should be used the first time you upload an attachment. It is the ID of
435
+ * the direct upload that was created when uploading the file to S3 via the
436
+ * mediaDirectUpload mutation.
437
+ */
438
+ direct_upload_id: string;
439
+ }
440
+
441
+ /**
442
+ * Input for an attachment
443
+ */
444
+ export interface AttachmentInputWithID {
445
+ /**
446
+ * The ID of an existing attachment object. Use this when updating a resource and
447
+ * keeping a subset of the attachments. Don't use this unless you know what you're
448
+ * doing.
449
+ */
450
+ id: string;
451
+ }
452
+ }
453
+
454
+ export interface CourseUpdateParams {
455
+ /**
456
+ * Whether the course will award its students a PDF certificate after completing
457
+ * all lessons
458
+ */
459
+ certificate_after_completion_enabled?: boolean | null;
460
+
461
+ /**
462
+ * The chapters and lessons to update
463
+ */
464
+ chapters?: Array<CourseUpdateParams.Chapter> | null;
465
+
466
+ /**
467
+ * The cover image URL of the course
468
+ */
469
+ cover_image?: string | null;
470
+
471
+ /**
472
+ * A short description of the course
473
+ */
474
+ description?: string | null;
475
+
476
+ /**
477
+ * The available languages for a course
478
+ */
479
+ language?: Languages | null;
480
+
481
+ /**
482
+ * Whether the course requires students to complete the previous lesson before
483
+ * moving on to the next one
484
+ */
485
+ require_completing_lessons_in_order?: boolean | null;
486
+
487
+ /**
488
+ * A short tagline for the course
489
+ */
490
+ tagline?: string | null;
491
+
492
+ /**
493
+ * The thumbnail for the course in png, jpeg, or gif format
494
+ */
495
+ thumbnail?:
496
+ | CourseUpdateParams.AttachmentInputWithDirectUploadID
497
+ | CourseUpdateParams.AttachmentInputWithID
498
+ | null;
499
+
500
+ /**
501
+ * The title of the course
502
+ */
503
+ title?: string | null;
504
+ }
505
+
506
+ export namespace CourseUpdateParams {
507
+ /**
508
+ * Input for updating a chapter while updating a course
509
+ */
510
+ export interface Chapter {
511
+ /**
512
+ * The ID of the chapter to update
513
+ */
514
+ id: string;
515
+
516
+ /**
517
+ * The order of the chapter within its course
518
+ */
519
+ order: number;
520
+
521
+ /**
522
+ * The title of the chapter
523
+ */
524
+ title: string;
525
+
526
+ /**
527
+ * The lessons to update within this chapter
528
+ */
529
+ lessons?: Array<Chapter.Lesson> | null;
530
+ }
531
+
532
+ export namespace Chapter {
533
+ /**
534
+ * Input for updating a lesson while updating a course
535
+ */
536
+ export interface Lesson {
537
+ /**
538
+ * The ID of the lesson to update
539
+ */
540
+ id: string;
541
+
542
+ /**
543
+ * The ID of the chapter this lesson belongs to (for moving between chapters)
544
+ */
545
+ chapter_id: string;
546
+
547
+ /**
548
+ * The order of the lesson within its chapter
549
+ */
550
+ order: number;
551
+
552
+ /**
553
+ * The title of the lesson
554
+ */
555
+ title: string;
556
+ }
557
+ }
558
+
559
+ /**
560
+ * Input for an attachment
561
+ */
562
+ export interface AttachmentInputWithDirectUploadID {
563
+ /**
564
+ * This ID should be used the first time you upload an attachment. It is the ID of
565
+ * the direct upload that was created when uploading the file to S3 via the
566
+ * mediaDirectUpload mutation.
567
+ */
568
+ direct_upload_id: string;
569
+ }
570
+
571
+ /**
572
+ * Input for an attachment
573
+ */
574
+ export interface AttachmentInputWithID {
575
+ /**
576
+ * The ID of an existing attachment object. Use this when updating a resource and
577
+ * keeping a subset of the attachments. Don't use this unless you know what you're
578
+ * doing.
579
+ */
580
+ id: string;
581
+ }
582
+ }
583
+
584
+ export interface CourseListParams extends CursorPageParams {
585
+ /**
586
+ * Returns the elements in the list that come before the specified cursor.
587
+ */
588
+ before?: string | null;
589
+
590
+ /**
591
+ * The ID of the company
592
+ */
593
+ company_id?: string | null;
594
+
595
+ /**
596
+ * The ID of the experience
597
+ */
598
+ experience_id?: string | null;
599
+
600
+ /**
601
+ * Returns the first _n_ elements from the list.
602
+ */
603
+ first?: number | null;
604
+
605
+ /**
606
+ * Returns the last _n_ elements from the list.
607
+ */
608
+ last?: number | null;
609
+ }
610
+
611
+ export declare namespace Courses {
612
+ export {
613
+ type Course as Course,
614
+ type Languages as Languages,
615
+ type CourseListResponse as CourseListResponse,
616
+ type CourseDeleteResponse as CourseDeleteResponse,
617
+ type CourseListResponsesCursorPage as CourseListResponsesCursorPage,
618
+ type CourseCreateParams as CourseCreateParams,
619
+ type CourseUpdateParams as CourseUpdateParams,
620
+ type CourseListParams as CourseListParams,
621
+ };
622
+ }
@@ -138,6 +138,33 @@ export class Experiences extends APIResource {
138
138
  detach(id: string, body: ExperienceDetachParams, options?: RequestOptions): APIPromise<Shared.Experience> {
139
139
  return this._client.post(path`/experiences/${id}/detach`, { body, ...options });
140
140
  }
141
+
142
+ /**
143
+ * Duplicates an existing experience. The name will be copied, unless provided. The
144
+ * new experience will be attached to the same products as the original experience.
145
+ * If duplicating a Forum or Chat experience, the new experience will have the same
146
+ * settings as the original experience, e.g. who can post, who can comment, etc. No
147
+ * content, e.g. posts, messages, lessons from within the original experience will
148
+ * be copied.
149
+ *
150
+ * Required permissions:
151
+ *
152
+ * - `experience:create`
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * const experience = await client.experiences.duplicate(
157
+ * 'exp_xxxxxxxxxxxxxx',
158
+ * );
159
+ * ```
160
+ */
161
+ duplicate(
162
+ id: string,
163
+ body: ExperienceDuplicateParams | null | undefined = {},
164
+ options?: RequestOptions,
165
+ ): APIPromise<Shared.Experience> {
166
+ return this._client.post(path`/experiences/${id}/duplicate`, { body, ...options });
167
+ }
141
168
  }
142
169
 
143
170
  export type ExperienceListResponsesCursorPage = CursorPage<ExperienceListResponse>;
@@ -286,7 +313,10 @@ export interface ExperienceUpdateParams {
286
313
  /**
287
314
  * The logo for the experience
288
315
  */
289
- logo?: ExperienceUpdateParams.Logo | null;
316
+ logo?:
317
+ | ExperienceUpdateParams.AttachmentInputWithDirectUploadID
318
+ | ExperienceUpdateParams.AttachmentInputWithID
319
+ | null;
290
320
 
291
321
  /**
292
322
  * The name of the experience.
@@ -306,22 +336,27 @@ export interface ExperienceUpdateParams {
306
336
 
307
337
  export namespace ExperienceUpdateParams {
308
338
  /**
309
- * The logo for the experience
339
+ * Input for an attachment
310
340
  */
311
- export interface Logo {
312
- /**
313
- * The ID of an existing attachment object. Use this when updating a resource and
314
- * keeping a subset of the attachments. Don't use this unless you know what you're
315
- * doing.
316
- */
317
- id?: string | null;
318
-
341
+ export interface AttachmentInputWithDirectUploadID {
319
342
  /**
320
343
  * This ID should be used the first time you upload an attachment. It is the ID of
321
344
  * the direct upload that was created when uploading the file to S3 via the
322
345
  * mediaDirectUpload mutation.
323
346
  */
324
- direct_upload_id?: string | null;
347
+ direct_upload_id: string;
348
+ }
349
+
350
+ /**
351
+ * Input for an attachment
352
+ */
353
+ export interface AttachmentInputWithID {
354
+ /**
355
+ * The ID of an existing attachment object. Use this when updating a resource and
356
+ * keeping a subset of the attachments. Don't use this unless you know what you're
357
+ * doing.
358
+ */
359
+ id: string;
325
360
  }
326
361
  }
327
362
 
@@ -371,6 +406,13 @@ export interface ExperienceDetachParams {
371
406
  product_id: string;
372
407
  }
373
408
 
409
+ export interface ExperienceDuplicateParams {
410
+ /**
411
+ * The name of the new experience
412
+ */
413
+ name?: string | null;
414
+ }
415
+
374
416
  export declare namespace Experiences {
375
417
  export {
376
418
  type ExperienceListResponse as ExperienceListResponse,
@@ -381,5 +423,6 @@ export declare namespace Experiences {
381
423
  type ExperienceListParams as ExperienceListParams,
382
424
  type ExperienceAttachParams as ExperienceAttachParams,
383
425
  type ExperienceDetachParams as ExperienceDetachParams,
426
+ type ExperienceDuplicateParams as ExperienceDuplicateParams,
384
427
  };
385
428
  }