import { whopApi } from "@/lib/whop-api";

const result = await whopApi.forums.listForumPostsFromForum({
	// The ID of the experience to fetch posts from
	experienceId: "exp_XXXXXXXX" /* Required! */,
});

Example output:

const response = {
	// List of posts
	posts: [
		{
			// The unique identifier for the entity
			id: "xxxxxxxxxxx",

			// The time the entity was created (in milliseconds since Unix epoch)
			createdAt: "9999999",

			// The time the entity was last updated (in milliseconds since Unix epoch)
			updatedAt: "9999999",

			// The text content of the forum post
			content: "some string",

			// The rich content of the forum post
			richContent: "some string",

			// Whether the entity has been deleted
			isDeleted: true,

			// The attachments to this message
			attachments: [
				{
					// The ID of the attachment
					id: "xxxxxxxxxxx",

					// The attachment's content type (e.g., image/jpg, video/mp4)
					contentType: "some string",

					// The original URL of the attachment, such as a direct link to S3. This should
					// never be displayed on the client and always passed to an Imgproxy transformer.
					sourceUrl: "some string",
				},
			],

			// Whether the forum post has been edited
			isEdited: true,

			// Whether this forum post is pinned
			isPinned: true,

			// The IDs of the users mentioned in this forum post
			mentionedUserIds: ["xxxxxxxxxxx"],

			// The ID of the parent forum post, if applicable
			parentId: "xxxxxxxxxxx",

			// The number of times this message has been viewed
			viewCount: 10,

			// The user who created this forum post
			user: {
				// The internal ID of the user.
				id: "xxxxxxxxxxx",

				// The name of the user from their Whop account.
				name: "some string",

				// The username of the user from their Whop account.
				username: "some string",

				// The user's profile picture
				profilePicture: {
					// The original URL of the attachment, such as a direct link to S3. This should
					// never be displayed on the client and always passed to an Imgproxy transformer.
					sourceUrl: "some string",
				},

				// Whether or not the user's phone is verified
				phoneVerified: true,

				// The city the user is from.
				city: "some string",

				// The country the user is from.
				country: "some string",
			},
		},
	],
};