//native
type Kustomer = {
apiKey: string;
};
/**
* Update Custom Domain
* Updates the domainName, or reissues a certificate in the `VALIDATION_TIMED_OUT` state
*/
export async function main(
auth: Kustomer,
id: string,
domainId: string,
body: { domain: string },
) {
const url = new URL(
`https://api.kustomerapp.com/v1/kb/knowledge-bases/${id}/domain/${domainId}`,
);
const response = await fetch(url, {
method: "PUT",
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.text();
}
Submitted by hugo697 235 days ago