1 | |
2 | type Zoho = { |
3 | token: string; |
4 | }; |
5 | |
6 | * Delete notes |
7 | * |
8 | */ |
9 | export async function main(auth: Zoho, ids: string) { |
10 | const url = new URL(`https://zohoapis.com/crm/v8/Notes?ids=${ids}`); |
11 | const response = await fetch(url, { |
12 | method: "DELETE", |
13 | headers: { |
14 | Authorization: "Zoho-oauthtoken " + auth.token, |
15 | }, |
16 | body: undefined, |
17 | }); |
18 | if (!response.ok) { |
19 | const text = await response.text(); |
20 | throw new Error(`${response.status} ${text}`); |
21 | } |
22 | return await response.json(); |
23 | } |
24 |
|