type Acumbamail = {
	authToken: string
}
export async function main(
	resource: Acumbamail,
	origin_template_id: number,
	template_name: string
) {
	const endpoint = 'https://acumbamail.com/api/1/duplicateTemplate/'
	const formData = new FormData()
	formData.append('auth_token', resource.authToken)
	formData.append('origin_template_id', origin_template_id.toString())
	formData.append('template_name', template_name)
	const response = await fetch(endpoint, {
		method: 'POST',
		headers: {
			'Cache-Control': 'no-cache'
		},
		body: formData
	})
	if (!response.ok) {
		throw new Error(`HTTP error! status: ${response.status}`)
	}
	const data = await response.json()
	return data
}
Submitted by hugo697 385 days ago