//native
type Enode = {
token: string
}
export async function main(auth: Enode, actionId: string) {
const url = new URL(`https://enode-api.production.enode.io/batteries/actions/${actionId}/cancel`)
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 581 days ago