//native
type Buttondown = {
token: string;
};
/**
* Send Email To
*
*/
export async function main(
auth: Buttondown,
id_or_email: string,
email_id: string,
) {
const url = new URL(
`https://api.buttondown.com/v1/subscribers/${id_or_email}/emails/${email_id}`,
);
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: "Token " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago