1 | |
2 | type Zoho = { |
3 | token: string; |
4 | }; |
5 | |
6 | * Delete a note |
7 | * Delete a specific note. |
8 | */ |
9 | export async function main( |
10 | auth: Zoho, |
11 | subscription_id: string, |
12 | note_id: string, |
13 | X_com_zoho_subscriptions_organizationid: string, |
14 | ) { |
15 | const url = new URL( |
16 | `https://www.zohoapis.com/billing/v1/subscriptions/${subscription_id}/notes/${note_id}`, |
17 | ); |
18 |
|
19 | const response = await fetch(url, { |
20 | method: "DELETE", |
21 | headers: { |
22 | "X-com-zoho-subscriptions-organizationid": |
23 | X_com_zoho_subscriptions_organizationid, |
24 | Authorization: "Zoho-oauthtoken " + auth.token, |
25 | }, |
26 | body: undefined, |
27 | }); |
28 | if (!response.ok) { |
29 | const text = await response.text(); |
30 | throw new Error(`${response.status} ${text}`); |
31 | } |
32 | return await response.json(); |
33 | } |
34 |
|