export type DeleteApiApiV5WebhooksWebhookIdArgs = {webhook_id: number}; export type DeleteApiApiV5WebhooksWebhookIdOptions = {baseUrl?: string | undefined, RWAPIKeyHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete webhook * * DELETE /api/v5/webhooks/{webhook_id} */ export const deleteApiApiV5WebhooksWebhookId = async (args: DeleteApiApiV5WebhooksWebhookIdArgs, options?: DeleteApiApiV5WebhooksWebhookIdOptions) => { const {baseUrl = "https://api.pavlok.com", fetch: fetchFn = fetch, RWAPIKeyHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (RWAPIKeyHeader !== undefined) headers.set("Authorization", RWAPIKeyHeader) const url = `${baseUrl.replace(/\/+$/, '')}/api/v5/webhooks/${encodeURIComponent(String(args.webhook_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };