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

const result = await whopApi.listMessagesFromChat({
	// The ID of the experience to fetch posts from
	chatExperienceId: "exp_XXXXXXXX",
});

Example output:
const response = {
	// Fetch feed posts for the current user
	feedPosts: {
		// 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 message
				content: "some string",

				// The rich content of the message
				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",

						// This is the URL you use to render optimized attachments on the client. This should be used for apps.
						url: "some string",
					},
				],

				// Whether the message has been edited
				isEdited: true,

				// Whether this message is pinned
				isPinned: true,

				// Whether everyone was mentioned in this message
				isEveryoneMentioned: true,

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

				// The type of post
				messageType:
					"automated" /* Valid values: automated | regular | system */,

				// The ID of the message this is replying to, if applicable
				replyingToPostId: "xxxxxxxxxxx",

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

				// The user who sent this message
				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: {
						// This is the URL you use to render optimized attachments on the client. This should be used for apps.
						url: "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",
				},
			},
		],
	},
};