import { whopSdk } from "@/lib/whop-sdk";

const result = await whopSdk.courses.listCoursesForExperience({
	// The ID of the experience
	experienceId: "exp_XXXXXXXX" /* Required! */,

	first: 10,

	after: "pageInfo.endCursor",
});

Example output:
const response = {
	// The courses for the experience
	courses: {
		// A list of nodes.
		nodes: [
			{
				// Whether the course will award its students a PDF certificate after completing all lessons
				certificateAfterCompletionEnabled: true,

				// The chapters in this course
				chapters: [
					{
						// The ID of the chapter. Looks like chap_XXX
						id: "xxxxxxxxxxx",

						// The title of the chapter
						title: "some string",

						// The order of the chapter within its course
						order: 10,

						// The lessons in this chapter
						lessons: [
							{
								// The ID of the lesson
								id: "xxxxxxxxxxx",

								// The type of the lesson (text, video, pdf, multi, quiz, knowledge_check)
								lessonType:
									"knowledge_check" /* Valid values: knowledge_check | multi | pdf | quiz | text | video */,

								// The title of the lesson
								title: "some string",

								// The order of the lesson within its chapter
								order: 10,

								// Number of days from course start until the lesson is unlocked
								daysFromCourseStartUntilUnlock: 10,

								// The content of the lesson
								content: "some string",

								// The associated Mux asset for video lessons
								muxAsset: {
									// The ID of the Mux asset
									id: "xxxxxxxxxxx",

									// The Mux-provided ID of the asset
									muxAssetId: "some string",

									// The public playback ID of the Mux asset
									playbackId: "some string",

									// The signed playback ID of the Mux asset
									signedPlaybackId: "some string",

									// The signed thumbnail playback token of the Mux asset
									signedThumbnailPlaybackToken: "some string",

									// The signed video playback token of the Mux asset
									signedVideoPlaybackToken: "some string",

									// The signed storyboard playback token of the Mux asset
									signedStoryboardPlaybackToken: "some string",

									// The duration of the video in seconds
									durationSeconds: 10,

									// The status of the Mux asset
									status:
										"created" /* Valid values: created | ready | uploading */,

									// The time at which the video finished uploading
									finishedUploadingAt: 1716931200,
								},
							},
						],
					},
				],

				// The URL of the course's cover image, which is shown in course preview cards
				coverImage: "some string",

				// A short description of the course
				description: "some string",

				// The ID of the course. Looks like cors_XXX
				id: "xxxxxxxxxxx",

				// The language spoken in the video content of the course, used to generate closed captions in the right language
				language:
					"bg" /* Valid values: bg | ca | cs | da | de | el | en | es | fi | fr | hr | it | nl | no | pl | pt | ro | ru | sk | sv | tr | uk */,

				// Whether the course requires students to complete the previous lesson before moving on to the next one
				requireCompletingLessonsInOrder: true,

				// A short tagline for the course. It is displayed under the course title in the UI
				tagline: "some string",

				// The title of the course
				title: "some string",

				// Whether to apply protections on videos in the course (such as overlaying your user id, and logging tampering attempts)
				videoProtectionEnabled: true,
			},
		],

		// The total number of items in this connection.
		totalCount: 10,

		// Information to aid in pagination.
		pageInfo: {
			// When paginating forwards, are there more items?
			hasNextPage: true,

			// When paginating forwards, the cursor to continue.
			endCursor: "some string",
		},
	},
};