//native
type Zuplo = {
apiKey: string
}
/**
* Deletes a plan
* Deletes a plan (if there are no associated subscriptions)
*/
export async function main(auth: Zuplo, bucketId: string, planId: string) {
const url = new URL(`https://dev.zuplo.com/v1/metering/${bucketId}/plans/${planId}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago