//native
type Phrase = {
token: string
baseUrl: string
}
/**
* Redeliver a single webhook delivery
* Trigger an individual webhook delivery to be redelivered.
*/
export async function main(auth: Phrase, project_id: string, webhook_id: string, id: string) {
const url = new URL(
`${auth.baseUrl}/projects/${project_id}/webhooks/${webhook_id}/deliveries/${id}/redeliver`
)
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: 'ApiToken ' + 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 235 days ago