1
//native
2
3
type Mailchimp = {
4
api_key: string;
5
server: string;
6
};
7
export async function main(auth: Mailchimp, campaign_id: string) {
8
const url = `https://${auth.server}.api.mailchimp.com/3.0/campaigns/${campaign_id}`;
9
const response = await fetch(url, {
10
method: "DELETE",
11
headers: {
12
Authorization: `Bearer ${auth.api_key}`,
13
},
14
});
15
if (!response.ok) {
16
throw Error(await response.text());
17
}
18
return `Successfully deleted campaign with ID '${campaign_id}'`;
19
20