//native
type Clerk = {
apiKey: string;
};
/**
* Update a phone number
* Updates a phone number
*/
export async function main(
auth: Clerk,
phone_number_id: string,
body: {
verified?: false | true;
primary?: false | true;
reserved_for_second_factor?: false | true;
},
) {
const url = new URL(
`https://api.clerk.com/v1/phone_numbers/${phone_number_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