//native
type Clerk = {
apiKey: string;
};
/**
* Update instance restrictions
* Updates the restriction settings of an instance
*/
export async function main(
auth: Clerk,
body: {
allowlist?: false | true;
blocklist?: false | true;
block_email_subaddresses?: false | true;
block_disposable_email_domains?: false | true;
ignore_dots_for_gmail_addresses?: false | true;
},
) {
const url = new URL(`https://api.clerk.com/v1/instance/restrictions`);
const response = await fetch(url, {
method: "PATCH",
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