type Resend = {
token: string;
};
/**
* Update an existing domain
*
*/
export async function main(
auth: Resend,
domain_id: string,
body: {
click_tracking?: boolean;
open_tracking?: boolean;
[k: string]: unknown;
}
) {
const url = new URL(`https://api.resend.com/domains/${domain_id}`);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
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 399 days ago
type Resend = {
token: string;
};
/**
* Update an existing domain
*
*/
export async function main(
auth: Resend,
domain_id: string,
body: {
click_tracking?: boolean;
open_tracking?: boolean;
[k: string]: unknown;
}
) {
const url = new URL(`https://api.resend.com/domains/${domain_id}`);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
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 826 days ago