This operation is only available on the server.
import { whopApi } from "@/lib/whop-api";

const result = await whopApi.apps.createAppBuild({
	// Attachment input for the app build file. This should be an upload in .zip
	// format. The zip should contain at least one main_js_bundle.hbc file and
	// optionally an assets folder next to it.
	attachment: {
		// This ID should be used the first time you upload an attachment. It is the ID
		// of the direct upload that was created when uploading the file to S3 via the
		// mediaDirectUpload mutation.
		directUploadId: "xxxxxxxxxxx",

		// The ID of an existing attachment object. Use this when updating a resource and
		// keeping a subset of the attachments. Don't use this unless you know what you're doing.
		id: "xxxxxxxxxxx",
	} /* Required! */,

	// Checksum of the app build file. This is generated by the client and used to
	// verify the integrity of the file that is submitted when un-packaged later on a device.
	checksum: "some string" /* Required! */,

	// The platform of the app build (ios, android, web)
	platform: "android" /* Valid values: android | ios | web */ /* Required! */,

	// Supported app view types for the app build. A build can specify multiple view
	// types, but should only specify ones that its code supports.
	supportedAppViewTypes: [
		"analytics" /* Valid values: analytics | dash | hub */,
	],
});

Example output:

const response = {
	// The ID of the app build. It will look like apbu_xxxxx.
	id: "xxxxxxxxxxx",

	// When this app build was created.
	createdAt: 1716931200,

	// The URL to download the app build .zip file.
	fileUrl: "some string",

	// This is generated by the client and used to verify the integrity of the file
	// that is submitted. It is a SHA256 hash of the app build file.
	checksum: "some string",

	// The platform of the app build (ios, android, web)
	platform: "android" /* Valid values: android | ios | web */,

	// The review message for the app build, if any. This is populated when the build
	// is rejected and there is a reason specified by the reviewer.
	reviewMessage: "some string",

	// The supported app view types for the app build. These are the views that the
	// developer has specified that this build supports.
	supportedAppViewTypes: [
		"analytics" /* Valid values: analytics | dash | hub */,
	],

	// The status of the app build (draft, approved, rejected, pending, etc)
	status: "approved" /* Valid values: approved | draft | pending | rejected */,
};