type Mailchimp = {
  api_key: string;
  server: string;
};
export async function main(auth: Mailchimp, campaign_id: string) {
  const url = `https://${auth.server}.api.mailchimp.com/3.0/campaigns/${campaign_id}/actions/cancel-send`;
  const response = await fetch(url, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${auth.api_key}`,
    },
  });
  if (!response.ok) {
    throw Error(await response.text());
  }
  return await response.json();
}
 Submitted by hugo697 181 days ago
type Mailchimp = {
  api_key: string;
  server: string;
};
export async function main(auth: Mailchimp, campaign_id: string) {
  const url = `https://${auth.server}.api.mailchimp.com/3.0/campaigns/${campaign_id}/actions/cancel-send`;
  const response = await fetch(url, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${auth.api_key}`,
    },
  });
  if (!response.ok) {
    throw Error(await response.text());
  }
  return await response.json();
}
 Submitted by admin 814 days ago
type Mailchimp = {
  api_key: string;
  server: string;
};
export async function main(
  auth: Mailchimp,
  campaign_id: string
) {
  const url = `https://${auth.server}.api.mailchimp.com/3.0/campaigns/${campaign_id}/actions/cancel-send`
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${auth.api_key}`
    }
  })
  
  if(!response.ok) {
    throw Error(await response.text())
  }
  return await response.json()
}
 Submitted by admin 817 days ago
import { Resource } from 'https://deno.land/x/windmill@v1.85.0/mod.ts'
export async function main(
  auth: Resource<'mailchimp'>,
  campaign_id: string
) {
  const url = `https://${auth.server}.api.mailchimp.com/3.0/campaigns/${campaign_id}/actions/cancel-send`
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${auth.api_key}`
    }
  })
  
  if(!response.ok) {
    throw Error(await response.text())
  }
  return await response.json()
}
 Submitted by adam186 945 days ago
import { Resource } from 'https://deno.land/x/windmill@v1.70.1/mod.ts'
export async function main(
  auth: Resource<'mailchimp'>,
  campaign_id: string
) {
  const url = `https://${auth.server}.api.mailchimp.com/3.0/campaigns/${campaign_id}/actions/cancel-send`
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${auth.api_key}`
    }
  })
  
  if(!response.ok) {
    throw Error(await response.text())
  }
  return await response.json()
}
 Submitted by adam186 980 days ago
import { Resource } from 'https://deno.land/x/windmill@v1.55.0/mod.ts'
export async function main(
  auth: Resource<'mailchimp'>,
  campaign_id: string
) {
  const url = `https://${auth.server}.api.mailchimp.com/3.0/campaigns/${campaign_id}/actions/cancel-send`
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${auth.api_key}`
    }
  })
  
  if(!response.ok) {
    throw Error(await response.text())
  }
  return await response.json()
}
 Submitted by adam186 1051 days ago
/**
 * @param server The data center for your Mailchimp account.
 */
export async function main(
  api_key: string,
  server: string,
  campaign_id: string
) {
  const url = `https://${server}.api.mailchimp.com/3.0/campaigns/${campaign_id}/actions/cancel-send`
  const response = await fetch(url, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${api_key}`
    }
  })
  
  if(!response.ok) {
    throw Error(await response.text())
  }
  return await response.json()
}
 Submitted by adam186 1072 days ago