1 | type Convertkit = { |
2 | apiSecret: string |
3 | } |
4 |
|
5 | export async function main(resource: Convertkit, broadcastId: string) { |
6 | const endpoint = `https://api.convertkit.com/v3/broadcasts/${broadcastId}` |
7 |
|
8 | const body = { |
9 | api_secret: resource.apiSecret |
10 | } |
11 |
|
12 | const response = await fetch(endpoint, { |
13 | method: 'DELETE', |
14 | headers: { |
15 | 'Content-Type': 'application/json' |
16 | }, |
17 | body: JSON.stringify(body) |
18 | }) |
19 |
|
20 | if (!response.ok) { |
21 | throw new Error(`HTTP error! status: ${response.status}`) |
22 | } |
23 |
|
24 | return {success: true} |
25 | } |
26 |
|