type Resend = {
token: string;
};
/**
* Create a new domain
*
*/
export async function main(
auth: Resend,
body: {
name: string;
region?: "us-east-1" | "eu-west-1" | "sa-east-1";
[k: string]: unknown;
}
) {
const url = new URL(`https://api.resend.com/domains`);
const response = await fetch(url, {
method: "POST",
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;
};
/**
* Create a new domain
*
*/
export async function main(
auth: Resend,
body: {
name: string;
region?: "us-east-1" | "eu-west-1" | "sa-east-1";
[k: string]: unknown;
}
) {
const url = new URL(`https://api.resend.com/domains`);
const response = await fetch(url, {
method: "POST",
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 960 days ago
export type Resend = {
token: string;
};
/**
* Create a new domain
*
*/
export async function main(
auth: Resend,
body: {
/** * The name of the domain you want to create. */ name: string;
/** * The region where emails will be sent from. Possible values are us-east-1' | 'eu-west-1' | 'sa-east-1 */ region?:
| "us-east-1"
| "eu-west-1"
| "sa-east-1";
[k: string]: unknown;
}
) {
const url = new URL(`https://api.resend.com/domains`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
return await response.json();
}
Submitted by rubenfiszel 961 days ago