//native
type Clerk = {
apiKey: string;
};
/**
* Create a waitlist entry
* Creates a new waitlist entry for the given email address.
If the email address is already on the waitlist, no new entry will be created and the existing waitlist entry will be returned.
*/
export async function main(
auth: Clerk,
body: { email_address: string; notify?: false | true },
) {
const url = new URL(`https://api.clerk.com/v1/waitlist_entries`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago