//native
type Clerk = {
apiKey: string;
};
/**
* Update a domain
* The `proxy_url` can be updated only for production instances.
*/
export async function main(
auth: Clerk,
domain_id: string,
body: { name?: string; proxy_url?: string; is_secondary?: false | true },
) {
const url = new URL(`https://api.clerk.com/v1/domains/${domain_id}`);
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